From: Bborie Park Date: Thu, 9 Aug 2012 00:18:11 +0000 (+0000) Subject: Added clamped value comparisons and updated comments for rt_band_get_pixel_of_value() X-Git-Tag: 2.1.0beta2~702 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=891c5ac10b92bbe84b549586e7f4cde2eb1435ca;p=postgis Added clamped value comparisons and updated comments for rt_band_get_pixel_of_value() git-svn-id: http://svn.osgeo.org/postgis/trunk@10173 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/rt_core/rt_api.c b/raster/rt_core/rt_api.c index b350fad06..f8f32a74e 100644 --- a/raster/rt_core/rt_api.c +++ b/raster/rt_core/rt_api.c @@ -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++; diff --git a/raster/rt_core/rt_api.h b/raster/rt_core/rt_api.h index a1516556f..c79f791f9 100644 --- a/raster/rt_core/rt_api.h +++ b/raster/rt_core/rt_api.h @@ -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 */