Ticket #4021 (closed defect: fixed)
AIG datasets with colormap
| Reported by: | rprinceley | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.9.0 |
| Component: | GDAL_Raster | Version: | svn-trunk |
| Severity: | normal | Keywords: | HFA AIG |
| Cc: | gaopeng |
Description
In HFARasterBand::HFARasterBand(), we need a way to specify that padfBins should be ignored. This is for compatibility with ArcGIS 9.x which does not map entries to "BinValues?" (when reading .aux).
/* -------------------------------------------------------------------- */
/* Collect color table if present. */
/* -------------------------------------------------------------------- */
double *padfRed, *padfGreen, *padfBlue, *padfAlpha, *padfBins;
int nColors;
if( iOverview == -1
&& HFAGetPCT( hHFA, nBand, &nColors,
&padfRed, &padfGreen, &padfBlue, &padfAlpha,
&padfBins ) == CE_None
&& nColors > 0 )
{
poCT = new GDALColorTable();
for( int iColor = 0; iColor < nColors; iColor++ )
{
GDALColorEntry sEntry;
// The following mapping assigns "equal sized" section of
// the [0...1] range to each possible output value and avoid
// rounding issues for the "normal" values generated using n/255.
// See bug #1732 for some discussion.
sEntry.c1 = MIN(255,(short) (padfRed[iColor] * 256));
sEntry.c2 = MIN(255,(short) (padfGreen[iColor] * 256));
sEntry.c3 = MIN(255,(short) (padfBlue[iColor] * 256));
sEntry.c4 = MIN(255,(short) (padfAlpha[iColor] * 256));
if( padfBins != NULL )
poCT->SetColorEntry( (int) padfBins[iColor], &sEntry );
else
poCT->SetColorEntry( iColor, &sEntry );
The attached dataset is supposed to have 14 entries in it's color table (GDAL creates 19 based on "BinValues?" mapping).
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

