~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to frmts/georaster/georaster_rasterband.cpp

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 * DEALINGS IN THE SOFTWARE.
29
29
 *****************************************************************************/
30
30
 
 
31
#include "gdal_priv.h"
 
32
 
 
33
#include <string.h>
 
34
 
31
35
#include "georaster_priv.h"
32
36
#include "cpl_vsi.h"
 
37
#include "cpl_error.h"
33
38
 
34
39
//  ---------------------------------------------------------------------------
35
40
//                                                        GeoRasterRasterBand()
42
47
    poDS                = (GDALDataset*) poGDS;
43
48
    poGeoRaster         = poGDS->poGeoRaster;
44
49
    this->nBand         = nBand;
45
 
    this->eDataType     = OWGetDataType( poGeoRaster->pszCellDepth );
 
50
    this->eDataType     = OWGetDataType( poGeoRaster->sCellDepth.c_str() );
46
51
    poColorTable        = new GDALColorTable();
47
52
    poDefaultRAT        = NULL;
48
53
    pszVATName          = NULL;
54
59
    bValidStats         = false;
55
60
    nOverviewLevel      = nLevel;
56
61
    papoOverviews       = NULL;
57
 
    nOverviews          = 0;
58
 
 
 
62
    nOverviewCount      = 0;
 
63
    pahNoDataArray      = NULL;
 
64
    nNoDataArraySz      = 0;
 
65
    bHasNoDataArray     = false;
 
66
    
59
67
    //  -----------------------------------------------------------------------
60
68
    //  Initialize overview list
61
69
    //  -----------------------------------------------------------------------
62
70
 
63
71
    if( nLevel == 0 && poGeoRaster->nPyramidMaxLevel > 0 )
64
72
    {
65
 
        nOverviews      = poGeoRaster->nPyramidMaxLevel;
 
73
        nOverviewCount  = poGeoRaster->nPyramidMaxLevel;
66
74
        papoOverviews   = (GeoRasterRasterBand**) VSIMalloc(
67
 
                sizeof(GeoRasterRasterBand*) * nOverviews );
68
 
        for( int i = 0; i < nOverviews; i++ )
 
75
                sizeof(GeoRasterRasterBand*) * nOverviewCount );
 
76
        for( int i = 0; i < nOverviewCount; i++ )
69
77
        {
70
78
          papoOverviews[i] = new GeoRasterRasterBand(
71
79
                (GeoRasterDataset*) poDS, nBand, i + 1 );
90
98
            nBlockYSize = nRasterYSize;
91
99
        }
92
100
    }
 
101
 
 
102
    //  -----------------------------------------------------------------------
 
103
    //  Load NoData values and value ranges for this band (layer)
 
104
    //  -----------------------------------------------------------------------
 
105
 
 
106
    if( ( (GeoRasterDataset*) poDS)->bApplyNoDataArray )
 
107
    {
 
108
        CPLList* psList = NULL;
 
109
        int nLayerCount = 0;
 
110
        int nObjCount = 0;
 
111
 
 
112
        /*
 
113
         *  Count the number of NoData values and value ranges
 
114
         */
 
115
 
 
116
        for( psList = poGeoRaster->psNoDataList; psList ; psList = psList->psNext )
 
117
        {
 
118
            hNoDataItem* phItem = (hNoDataItem*) psList->pData;
 
119
 
 
120
            if( phItem->nBand == nBand )
 
121
            {
 
122
                nLayerCount++;
 
123
            }
 
124
 
 
125
            if( phItem->nBand == 0 )
 
126
            {
 
127
                nObjCount++;
 
128
            }
 
129
 
 
130
            if( phItem->nBand > nBand )
 
131
            {
 
132
                break;
 
133
            }
 
134
        }
 
135
 
 
136
        /*
 
137
         * Join the object nodata values to layer NoData values
 
138
         */
 
139
 
 
140
        nNoDataArraySz = nLayerCount + nObjCount;
 
141
 
 
142
        pahNoDataArray = (hNoDataItem*) VSIMalloc2( sizeof(hNoDataItem),
 
143
                nNoDataArraySz );
 
144
 
 
145
        int i = 0;
 
146
        bool bFirst = true;
 
147
 
 
148
        for( psList = poGeoRaster->psNoDataList ; psList && i < nNoDataArraySz;
 
149
             psList = psList->psNext )
 
150
        {
 
151
            hNoDataItem* phItem = (hNoDataItem*) psList->pData;
 
152
 
 
153
            if( phItem->nBand == nBand || phItem->nBand == 0 )
 
154
            {
 
155
                pahNoDataArray[i].nBand = nBand;
 
156
                pahNoDataArray[i].dfLower = phItem->dfLower;
 
157
                pahNoDataArray[i].dfUpper = phItem->dfUpper;
 
158
                i++;
 
159
 
 
160
                if( bFirst )
 
161
                {
 
162
                    bFirst = false;
 
163
 
 
164
                    /*
 
165
                     * Use the first value to assigned pixel values
 
166
                     * on method ApplyNoDataArray()
 
167
                     */
 
168
                    
 
169
                    dfNoData = phItem->dfLower;
 
170
                }
 
171
            }
 
172
        }
 
173
 
 
174
        bHasNoDataArray = nNoDataArraySz > 0;
 
175
    }
93
176
}
94
177
 
95
178
//  ---------------------------------------------------------------------------
102
185
    delete poDefaultRAT;
103
186
    
104
187
    CPLFree( pszVATName );
 
188
    CPLFree( pahNoDataArray );
105
189
 
106
 
    if( nOverviews && papoOverviews )
 
190
    if( nOverviewCount && papoOverviews )
107
191
    {
108
 
        for( int i = 0; i < nOverviews; i++ )
 
192
        for( int i = 0; i < nOverviewCount; i++ )
109
193
        {
110
194
            delete papoOverviews[i];
111
195
        }
128
212
                                   nBlockYOff,
129
213
                                   pImage ) )
130
214
    {
 
215
        if( bHasNoDataArray )
 
216
        {
 
217
            ApplyNoDataArry( pImage );
 
218
        }
 
219
 
131
220
        return CE_None;
132
221
    }
133
222
    else
332
421
{
333
422
    if( pbSuccess )
334
423
    {
335
 
        *pbSuccess = (int) poGeoRaster->GetNoData( &dfNoData );
 
424
        if( nNoDataArraySz )
 
425
        {
 
426
            *pbSuccess = true;
 
427
        }
 
428
        else
 
429
        {
 
430
            *pbSuccess = (int) poGeoRaster->GetNoData( nBand, &dfNoData );
 
431
        }
336
432
    }
337
433
 
338
434
    return dfNoData;
344
440
 
345
441
CPLErr GeoRasterRasterBand::SetNoDataValue( double dfNoDataValue )
346
442
{
347
 
    poGeoRaster->SetNoData( dfNoDataValue );
 
443
    const char* pszFormat = 
 
444
        (eDataType == GDT_Float32 || eDataType == GDT_Float64) ? "%f" : "%.0f";
 
445
 
 
446
    poGeoRaster->SetNoData( (poDS->GetRasterCount() == 1) ? 0 : nBand,
 
447
        CPLSPrintf( pszFormat, dfNoDataValue ) );
348
448
 
349
449
    return CE_None;
350
450
}
370
470
    poDefaultRAT = poRAT->Clone();
371
471
 
372
472
    // ----------------------------------------------------------
 
473
    // Check if RAT is just colortable and/or histogram
 
474
    // ----------------------------------------------------------
 
475
 
 
476
    CPLString sColName = "";
 
477
    int  iCol = 0;
 
478
    int  nColCount = poRAT->GetColumnCount();
 
479
 
 
480
    for( iCol = 0; iCol < poRAT->GetColumnCount(); iCol++ )
 
481
    {
 
482
        sColName = poRAT->GetNameOfCol( iCol );
 
483
 
 
484
        if( EQUAL( sColName, "histogram" ) ||
 
485
            EQUAL( sColName, "red" ) ||
 
486
            EQUAL( sColName, "green" ) ||
 
487
            EQUAL( sColName, "blue" ) ||
 
488
            EQUAL( sColName, "opacity" ) )
 
489
        {
 
490
            nColCount--;
 
491
        }
 
492
    }
 
493
 
 
494
    if( nColCount < 2 )
 
495
    {
 
496
        return CE_None;
 
497
    }
 
498
 
 
499
    // ----------------------------------------------------------
373
500
    // Format Table description
374
501
    // ----------------------------------------------------------
375
502
 
376
503
    char szName[OWTEXT];
377
504
    char szDescription[OWTEXT];
378
 
    int  iCol = 0;
379
505
 
380
506
    strcpy( szDescription, "( ID NUMBER" );
381
507
 
383
509
    {
384
510
        strcpy( szName, poRAT->GetNameOfCol( iCol ) );
385
511
 
386
 
    if( EQUAL( szName, "histogram" ) )
387
 
    {
388
 
        return CE_None;
389
 
    }
390
 
 
391
512
        strcpy( szDescription, CPLSPrintf( "%s, %s",
392
513
            szDescription, szName ) );
393
514
 
403
524
        }
404
525
        if( poRAT->GetTypeOfCol( iCol ) == GFT_String )
405
526
        {
406
 
            strcpy( szDescription, CPLSPrintf( "%s VARCHAR2(128)",
407
 
                szDescription ) );
 
527
            strcpy( szDescription, CPLSPrintf( "%s VARCHAR2(%d)",
 
528
                szDescription, MAXLEN_VATSTR) );
408
529
        }
409
530
    }
410
531
    strcpy( szDescription, CPLSPrintf( "%s )", szDescription ) );
417
538
    {
418
539
        pszVATName = CPLStrdup( CPLSPrintf(
419
540
            "RAT_%s_%d_%d", 
420
 
            poGeoRaster->pszDataTable, 
 
541
            poGeoRaster->sDataTable.c_str(),
421
542
            poGeoRaster->nRasterId,
422
543
            nBand ) );
423
544
    }
459
580
    int iEntry       = 0;
460
581
    int nEntryCount  = poRAT->GetRowCount();
461
582
    int nColunsCount = poRAT->GetColumnCount();
462
 
 
463
 
    char szInsert[OWTEXT];
464
 
 
465
 
    CPLString osInserts = 
466
 
        "DECLARE\n"
467
 
        "  GR1  SDO_GEORASTER   := NULL;\n"
468
 
        "BEGIN\n";
 
583
    int nVATStrSize  = MAXLEN_VATSTR * poGeoRaster->poConnection->GetCharSize();
 
584
 
 
585
    // ---------------------------
 
586
    // Allocate array of buffers
 
587
    // ---------------------------
 
588
 
 
589
    void** papWriteFields = (void**) VSIMalloc2(sizeof(void*), nColunsCount + 1);
 
590
 
 
591
    papWriteFields[0] = 
 
592
        (void*) VSIMalloc3(sizeof(int), sizeof(int), nEntryCount ); // ID field
 
593
 
 
594
    for(iCol = 0; iCol < nColunsCount; iCol++)
 
595
    {
 
596
        if( poRAT->GetTypeOfCol( iCol ) == GFT_String )
 
597
        {
 
598
            papWriteFields[iCol + 1] =
 
599
                (void*) VSIMalloc3(sizeof(char), nVATStrSize, nEntryCount );
 
600
        }
 
601
        if( poRAT->GetTypeOfCol( iCol ) == GFT_Integer )
 
602
        {
 
603
            papWriteFields[iCol + 1] =
 
604
                (void*) VSIMalloc3(sizeof(int), sizeof(int), nEntryCount );
 
605
        }
 
606
        if( poRAT->GetTypeOfCol( iCol ) == GFT_Real )
 
607
        {
 
608
            papWriteFields[iCol + 1] =
 
609
                 (void*) VSIMalloc3(sizeof(double), sizeof(double), nEntryCount );
 
610
        }
 
611
    }
 
612
    
 
613
    // ---------------------------
 
614
    // Load data to buffers
 
615
    // ---------------------------
469
616
 
470
617
    for( iEntry = 0; iEntry < nEntryCount; iEntry++ )
471
618
    {
472
 
        szInsert[0] = '\0';
473
 
 
474
 
        strcat( szInsert, CPLSPrintf ( "  INSERT INTO %s VALUES (%d", 
475
 
            pszVATName, iEntry ) );
476
 
 
477
 
        for( iCol = 0; iCol < nColunsCount; iCol++ )
 
619
        ((int *)(papWriteFields[0]))[iEntry] = iEntry; // ID field
 
620
 
 
621
        for(iCol = 0; iCol < nColunsCount; iCol++)
478
622
        {
479
623
            if( poRAT->GetTypeOfCol( iCol ) == GFT_String )
480
624
            {
481
 
                strcat( szInsert, CPLSPrintf ( ", '%s'", 
482
 
                    poRAT->GetValueAsString( iEntry, iCol ) ) );
483
 
            }
484
 
            if( poRAT->GetTypeOfCol( iCol ) == GFT_Integer ||
485
 
                poRAT->GetTypeOfCol( iCol ) == GFT_Real )
486
 
            {
487
 
                strcat( szInsert, CPLSPrintf ( ", %s", 
488
 
                    poRAT->GetValueAsString( iEntry, iCol ) ) );
489
 
            }
490
 
        }
491
 
 
492
 
        strcat( szInsert, ");\n" );
493
 
        osInserts += szInsert;
494
 
    }
495
 
 
496
 
    osInserts += CPLSPrintf(
497
 
        "  SELECT %s INTO GR1 FROM %s T WHERE\n"
498
 
        "    T.%s.RasterDataTable = '%s' AND\n"
499
 
        "    T.%s.RasterId = %d FOR UPDATE;\n"
500
 
        "  SDO_GEOR.setVAT(GR1, %d, '%s');\n"
501
 
        "  UPDATE %s T SET %s = GR1 WHERE\n"
502
 
        "    T.%s.RasterDataTable = '%s' AND\n"
503
 
        "    T.%s.RasterId = %d;\n"
504
 
        "END;",
505
 
        poGeoRaster->pszColumn, poGeoRaster->pszTable,
506
 
        poGeoRaster->pszColumn, poGeoRaster->pszDataTable,
507
 
        poGeoRaster->pszColumn, poGeoRaster->nRasterId,
508
 
        nBand, pszVATName,
509
 
        poGeoRaster->pszTable,  poGeoRaster->pszColumn,
510
 
        poGeoRaster->pszColumn, poGeoRaster->pszDataTable,
511
 
        poGeoRaster->pszColumn, poGeoRaster->nRasterId  );
512
 
 
513
 
    poStmt = poGeoRaster->poConnection->CreateStatement( osInserts.c_str() );
514
 
 
515
 
    if( ! poStmt->Execute() )
516
 
    {
517
 
        CPLError( CE_Failure, CPLE_AppDefined, "Insert/registering VAT Error!" );
518
 
        return CE_Failure;
519
 
    }
 
625
 
 
626
                int nOffset = iEntry * nVATStrSize;
 
627
                char* pszTarget = ((char*)papWriteFields[iCol + 1]) + nOffset;
 
628
                const char *pszStrValue = poRAT->GetValueAsString(iEntry, iCol);
 
629
                int nLen = strlen( pszStrValue );
 
630
                nLen = nLen > ( nVATStrSize - 1 ) ? nVATStrSize : ( nVATStrSize - 1 );
 
631
                strncpy( pszTarget, pszStrValue, nLen );
 
632
                pszTarget[nLen] = '\0';
 
633
            }
 
634
            if( poRAT->GetTypeOfCol( iCol ) == GFT_Integer )
 
635
            {
 
636
                ((int *)(papWriteFields[iCol + 1]))[iEntry] =
 
637
                    poRAT->GetValueAsInt(iEntry, iCol);
 
638
            }
 
639
            if( poRAT->GetTypeOfCol( iCol ) == GFT_Real )
 
640
            {
 
641
                ((double *)(papWriteFields[iCol]))[iEntry + 1] =
 
642
                    poRAT->GetValueAsDouble(iEntry, iCol);
 
643
            }
 
644
        }
 
645
    }
 
646
 
 
647
    // ---------------------------
 
648
    // Prepare insert statement
 
649
    // ---------------------------
 
650
 
 
651
    CPLString osInsert = CPLSPrintf( "INSERT INTO %s VALUES (", pszVATName );
 
652
    
 
653
    for( iCol = 0; iCol < ( nColunsCount + 1); iCol++ )
 
654
    {
 
655
        if( iCol > 0 )
 
656
        {
 
657
            osInsert.append(", ");
 
658
        }
 
659
        osInsert.append( CPLSPrintf(":%d", iCol + 1) );
 
660
    }
 
661
    osInsert.append(")");
 
662
 
 
663
    poStmt = poGeoRaster->poConnection->CreateStatement( osInsert.c_str() );
 
664
 
 
665
    // ---------------------------
 
666
    // Bind buffers to columns
 
667
    // ---------------------------
 
668
 
 
669
    poStmt->Bind((int*) papWriteFields[0]); // ID field
 
670
    
 
671
    for(iCol = 0; iCol < nColunsCount; iCol++)
 
672
    {
 
673
        if( poRAT->GetTypeOfCol( iCol ) == GFT_String )
 
674
        {
 
675
            poStmt->Bind( (char*) papWriteFields[iCol + 1], nVATStrSize );
 
676
        }
 
677
        if( poRAT->GetTypeOfCol( iCol ) == GFT_Integer )
 
678
        {
 
679
            poStmt->Bind( (int*) papWriteFields[iCol + 1]);
 
680
        }
 
681
        if( poRAT->GetTypeOfCol( iCol ) == GFT_Real )
 
682
        {
 
683
            poStmt->Bind( (double*) papWriteFields[iCol + 1]);
 
684
        }
 
685
    }
 
686
 
 
687
    if( poStmt->Execute( iEntry ) )
 
688
    {
 
689
        poGDS->poGeoRaster->SetVAT( nBand, pszVATName );
 
690
    }
 
691
    else
 
692
    {
 
693
        CPLError( CE_Failure, CPLE_AppDefined, "Insert VAT Error!" );
 
694
    }
 
695
 
 
696
    // ---------------------------
 
697
    // Clean up
 
698
    // ---------------------------
 
699
 
 
700
    for(iCol = 0; iCol < ( nColunsCount + 1); iCol++)
 
701
    {
 
702
        CPLFree( papWriteFields[iCol] );
 
703
    }
 
704
    
 
705
    CPLFree( papWriteFields );
520
706
 
521
707
    delete poStmt;
522
708
 
523
 
    poGDS->poGeoRaster->SetVAT( nBand, pszVATName );
524
 
 
525
709
    return CE_None;
526
710
}
527
711
 
677
861
 
678
862
int GeoRasterRasterBand::GetOverviewCount()
679
863
{
680
 
    return nOverviews;
 
864
    return nOverviewCount;
681
865
}
682
866
 
683
867
//  ---------------------------------------------------------------------------
686
870
 
687
871
GDALRasterBand* GeoRasterRasterBand::GetOverview( int nLevel )
688
872
{
689
 
    if( nLevel < nOverviews && papoOverviews[ nLevel ] )
 
873
    if( nLevel < nOverviewCount && papoOverviews[ nLevel ] )
690
874
    {
691
875
        return (GDALRasterBand*) papoOverviews[ nLevel ];
692
876
    }
741
925
    return GMF_ALL_VALID;
742
926
}
743
927
 
 
928
//  ---------------------------------------------------------------------------
 
929
//                                                            ApplyNoDataArry()
 
930
//  ---------------------------------------------------------------------------
 
931
 
 
932
void GeoRasterRasterBand::ApplyNoDataArry(void* pBuffer)
 
933
{
 
934
    int i = 0;
 
935
    int j = 0;
 
936
    long n = nBlockXSize * nBlockYSize;
 
937
 
 
938
    switch( eDataType )
 
939
    {
 
940
        case GDT_Byte:
 
941
        {
 
942
            GByte* pbBuffer = (GByte*) pBuffer;
 
943
 
 
944
            for( i = 0; i < n; i++ )
 
945
            {
 
946
                for( j = 0; j < nNoDataArraySz; j++ )
 
947
                {
 
948
                    if( pbBuffer[i] == (GByte) pahNoDataArray[j].dfLower ||
 
949
                      ( pbBuffer[i] >  (GByte) pahNoDataArray[j].dfLower &&
 
950
                        pbBuffer[i] <  (GByte) pahNoDataArray[j].dfUpper ) )
 
951
                    {
 
952
                        pbBuffer[i] = (GByte) dfNoData;
 
953
                    }
 
954
                }
 
955
            }
 
956
 
 
957
            break;
 
958
        }
 
959
        case GDT_Float32:
 
960
        case GDT_CFloat32:
 
961
        {
 
962
            float* pfBuffer = (float*) pBuffer;
 
963
 
 
964
            for( i = 0; i < n; i++ )
 
965
            {
 
966
                for( j = 0; j < nNoDataArraySz; j++ )
 
967
                {
 
968
                    if( pfBuffer[i] == (float) pahNoDataArray[j].dfLower ||
 
969
                      ( pfBuffer[i] >  (float) pahNoDataArray[j].dfLower &&
 
970
                        pfBuffer[i] <  (float) pahNoDataArray[j].dfUpper ) )
 
971
                    {
 
972
                        pfBuffer[i] = (float) dfNoData;
 
973
                    }
 
974
                }
 
975
            }
 
976
 
 
977
            break;
 
978
        }
 
979
        case GDT_Float64:
 
980
        case GDT_CFloat64:
 
981
        {
 
982
            double* pdfBuffer = (double*) pBuffer;
 
983
 
 
984
            for( i = 0; i < n; i++ )
 
985
            {
 
986
                for( j = 0; j < nNoDataArraySz; j++ )
 
987
                {
 
988
                    if( pdfBuffer[i] == (double) pahNoDataArray[j].dfLower ||
 
989
                      ( pdfBuffer[i] >  (double) pahNoDataArray[j].dfLower &&
 
990
                        pdfBuffer[i] <  (double) pahNoDataArray[j].dfUpper ) )
 
991
                    {
 
992
                        pdfBuffer[i] = (double) dfNoData;
 
993
                    }
 
994
                }
 
995
            }
 
996
 
 
997
            break;
 
998
        }
 
999
        case GDT_Int16:
 
1000
        case GDT_CInt16:
 
1001
        {
 
1002
            GInt16* pnBuffer = (GInt16*) pBuffer;
 
1003
 
 
1004
            for( i = 0; i < n; i++ )
 
1005
            {
 
1006
                for( j = 0; j < nNoDataArraySz; j++ )
 
1007
                {
 
1008
                    if( pnBuffer[i] == (GInt16) pahNoDataArray[j].dfLower ||
 
1009
                      ( pnBuffer[i] >  (GInt16) pahNoDataArray[j].dfLower &&
 
1010
                        pnBuffer[i] <  (GInt16) pahNoDataArray[j].dfUpper ) )
 
1011
                    {
 
1012
                        pnBuffer[i] = (GInt16) dfNoData;
 
1013
                    }
 
1014
                }
 
1015
            }
 
1016
 
 
1017
            break;
 
1018
        }
 
1019
        case GDT_Int32:
 
1020
        case GDT_CInt32:
 
1021
        {
 
1022
            GInt32* pnBuffer = (GInt32*) pBuffer;
 
1023
 
 
1024
            for( i = 0; i < n; i++ )
 
1025
            {
 
1026
                for( j = 0; j < nNoDataArraySz; j++ )
 
1027
                {
 
1028
                    if( pnBuffer[i] == (GInt32) pahNoDataArray[j].dfLower ||
 
1029
                      ( pnBuffer[i] >  (GInt32) pahNoDataArray[j].dfLower &&
 
1030
                        pnBuffer[i] <  (GInt32) pahNoDataArray[j].dfUpper ) )
 
1031
                    {
 
1032
                        pnBuffer[i] = (GInt32) dfNoData;
 
1033
                    }
 
1034
                }
 
1035
            }
 
1036
 
 
1037
            break;
 
1038
        }
 
1039
        case GDT_UInt16:
 
1040
        {
 
1041
            GUInt16* pnBuffer = (GUInt16*) pBuffer;
 
1042
 
 
1043
            for( i = 0; i < n; i++ )
 
1044
            {
 
1045
                for( j = 0; j < nNoDataArraySz; j++ )
 
1046
                {
 
1047
                    if( pnBuffer[i] == (GUInt16) pahNoDataArray[j].dfLower ||
 
1048
                      ( pnBuffer[i] >  (GUInt16) pahNoDataArray[j].dfLower &&
 
1049
                        pnBuffer[i] <  (GUInt16) pahNoDataArray[j].dfUpper ) )
 
1050
                    {
 
1051
                        pnBuffer[i] = (GUInt16) dfNoData;
 
1052
                    }
 
1053
                }
 
1054
            }
 
1055
 
 
1056
            break;
 
1057
        }
 
1058
        case GDT_UInt32:
 
1059
        {
 
1060
            GUInt32* pnBuffer = (GUInt32*) pBuffer;
 
1061
 
 
1062
            for( i = 0; i < n; i++ )
 
1063
            {
 
1064
                for( j = 0; j < nNoDataArraySz; j++ )
 
1065
                {
 
1066
                    if( pnBuffer[i] == (GUInt32) pahNoDataArray[j].dfLower ||
 
1067
                      ( pnBuffer[i] >  (GUInt32) pahNoDataArray[j].dfLower &&
 
1068
                        pnBuffer[i] <  (GUInt32) pahNoDataArray[j].dfUpper ) )
 
1069
                    {
 
1070
                        pnBuffer[i] = (GUInt32) dfNoData;
 
1071
                    }
 
1072
                }
 
1073
            }
 
1074
 
 
1075
            break;
 
1076
        }
 
1077
        default:
 
1078
            ;
 
1079
    }
 
1080
}