Open tbonfort opened 12 years ago
Author: fwarmerdam Date: 2006/02/22 - 04:59
Ross,
I modified the patch a bit, so the locale now looks like:
int s;
/* change colour based on colour range? Currently we
only address the greyscale case properly. */
for(s=0; s<layer->class[c].numstyles; s++)
{
if( MS_VALID_COLOR(layer->class[c].styles[s].mincolor)
&& MS_VALID_COLOR(layer->class[c].styles[s].maxcolor) )
msValueToRange(&layer->class[c].styles[s],
sEntry.c1 );
}
By checking that mincolor and maxcolor are set, I can avoid the need to set
an unused RANGEITEM in the style.
I also modified the 'classifed' test to look like this:
/*
* Is this image classified? We consider it classified if there are
* classes with an expression string *or* a color range. We don't want
* to treat the raster as classified if there is just a bogus class here
* to force inclusion in the legend.
*/
for( i = 0; i < layer->numclasses; i++ )
{
int s;
/* change colour based on colour range? */
for(s=0; s<layer->class[i].numstyles; s++)
{
if( MS_VALID_COLOR(layer->class[i].styles[s].mincolor)
&& MS_VALID_COLOR(layer->class[i].styles[s].maxcolor) )
{
classified = TRUE;
break;
}
}
if( layer->class[i].expression.string != NULL )
{
classified = TRUE;
break;
}
}
Essentially this means you don't have to set a bogus EXPRESSION
on a single class ramped raster in order to get things to go
through the classified case.
I also incorporated the ramp support into the 8bit classification
case, though it only works sensibly for greyscale rasters as it
assumes the range operation will be done based on the "red" value.
I have added two new tests to the msautotest.
msautotest/gdal/class8_range.map
msautotest/gdal/class16_range.map
The changes have only been incorporated in the 4.9 branch
for now. The changes are risky enough, and essentially only
adding a new feature, that I hesitate to backport for 4.8.2.
However, if there is sufficient call for it, I could do so.
Reporter: ross.elliott@infoterra-global.com Date: 2006/02/20 - 13:16