]> granicus.if.org Git - postgis/commitdiff
Added clamped value comparisons and updated comments for rt_band_get_pixel_of_value()
authorBborie Park <bkpark at ucdavis.edu>
Thu, 9 Aug 2012 00:18:11 +0000 (00:18 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Thu, 9 Aug 2012 00:18:11 +0000 (00:18 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10173 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_core/rt_api.c
raster/rt_core/rt_api.h

index b350fad0618a3b5d8d3ae95415b6c41ff28966e6..f8f32a74e8520278ea324803eec842781c2222c8 100644 (file)
@@ -2580,8 +2580,9 @@ int rt_band_get_nearest_pixel(
  *
  * @param band: the band to query for minimum and maximum pixel values
  * @param exclude_nodata_value: if non-zero, ignore nodata values
- * @param search_values: array of values to count
- * @param search_values_count: the number of search values
+ * @param searchset: array of values to count
+ * @param searchcount: the number of search values
+ * @param pixels: pixels with the search value
  *
  * @return -1 on error, otherwise number of pixels
  */
@@ -2624,8 +2625,12 @@ rt_band_get_pixel_of_value(
                        }
 
                        for (i = 0; i < searchcount; i++) {
-                               if (FLT_NEQ(pixval, searchset[i]))
+                               if (
+                                       FLT_NEQ(pixval, searchset[i]) ||
+                                       (rt_pixtype_compare_clamped_values(band->pixtype, searchset[i], pixval) != 1)
+                               ) {
                                        continue;
+                               }
 
                                /* match found */
                                count++;
index a1516556fbcbe41ae93b7265c155a147896ff06f..c79f791f9e1f6428d4802d3d2d4ae176096bc062 100644 (file)
@@ -621,8 +621,9 @@ int rt_band_get_nearest_pixel(
  *
  * @param band: the band to query for minimum and maximum pixel values
  * @param exclude_nodata_value: if non-zero, ignore nodata values
- * @param search_values: array of values to count
- * @param search_values_count: the number of search values
+ * @param searchset: array of values to count
+ * @param searchcount: the number of search values
+ * @param pixels: pixels with the search value
  *
  * @return -1 on error, otherwise number of pixels
  */