[mapserver-commits] r9466 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Thu Oct 15 16:47:28 EDT 2009
Author: warmerdam
Date: 2009-10-15 16:47:26 -0400 (Thu, 15 Oct 2009)
New Revision: 9466
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapdrawgdal.c
Log:
fix SCALE_BUCKETS for int16 data (#3174)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2009-10-15 18:27:01 UTC (rev 9465)
+++ trunk/mapserver/HISTORY.TXT 2009-10-15 20:47:26 UTC (rev 9466)
@@ -58,7 +58,9 @@
- Correct FEATURE_COUNT limits on WMS GetFeatureInfo raster queries (#3168)
+- Correct SCALE_BUCKETS issue with 16bit raster scaling (#3174)
+
Version 5.6.0-beta3 (2009-10-07):
---------------------------------
Modified: trunk/mapserver/mapdrawgdal.c
===================================================================
--- trunk/mapserver/mapdrawgdal.c 2009-10-15 18:27:01 UTC (rev 9465)
+++ trunk/mapserver/mapdrawgdal.c 2009-10-15 20:47:26 UTC (rev 9466)
@@ -1884,6 +1884,7 @@
GDALDataType eDataType;
float fDataMin=0.0, fDataMax=255.0, fNoDataValue;
const char *pszScaleInfo;
+ const char *pszBuckets;
int bUseIntegers = FALSE;
int *cmap, c, j, k, bGotNoData = FALSE, bGotFirstValue;
gdImagePtr gdImg = image->img.gd;
@@ -1948,6 +1949,7 @@
/* -------------------------------------------------------------------- */
/* Fetch the scale processing option. */
/* -------------------------------------------------------------------- */
+ pszBuckets = CSLFetchNameValue( layer->processing, "SCALE_BUCKETS" );
pszScaleInfo = CSLFetchNameValue( layer->processing, "SCALE" );
if( pszScaleInfo != NULL )
@@ -1987,10 +1989,17 @@
if( eDataType == GDT_Byte || eDataType == GDT_Int16
|| eDataType == GDT_UInt16 )
{
- dfScaleMin = fDataMin - 0.5;
- dfScaleMax = fDataMax + 0.5;
- nBucketCount = (int) floor(fDataMax - fDataMin + 1.1);
- bUseIntegers = TRUE;
+ if( pszScaleInfo == NULL )
+ {
+ dfScaleMin = fDataMin - 0.5;
+ dfScaleMax = fDataMax + 0.5;
+ }
+
+ if( pszBuckets == NULL )
+ {
+ nBucketCount = (int) floor(fDataMax - fDataMin + 1.1);
+ bUseIntegers = TRUE;
+ }
}
/* -------------------------------------------------------------------- */
@@ -2006,25 +2015,22 @@
/* -------------------------------------------------------------------- */
/* How many buckets? Only set if we don't already have a value. */
/* -------------------------------------------------------------------- */
- if( nBucketCount == 0 )
+ if( pszBuckets == NULL )
{
- const char *pszBuckets;
-
- pszBuckets = CSLFetchNameValue( layer->processing, "SCALE_BUCKETS" );
- if( pszBuckets == NULL )
+ if( nBucketCount == 0 )
nBucketCount = 65536;
- else
+ }
+ else
+ {
+ nBucketCount = atoi(pszBuckets);
+ if( nBucketCount < 2 )
{
- nBucketCount = atoi(pszBuckets);
- if( nBucketCount < 2 )
- {
- free( pafRawData );
- msSetError( MS_MISCERR,
- "SCALE_BUCKETS PROCESSING option is not a value of 2 or more: %s.",
- pszBuckets,
- "msDrawRasterLayerGDAL_16BitClassification()" );
- return -1;
- }
+ free( pafRawData );
+ msSetError( MS_MISCERR,
+ "SCALE_BUCKETS PROCESSING option is not a value of 2 or more: %s.",
+ pszBuckets,
+ "msDrawRasterLayerGDAL_16BitClassification()" );
+ return -1;
}
}
More information about the mapserver-commits
mailing list