MCPcopy Create free account
hub / github.com/MapServer/MapServer / LoadGDALImages

Function LoadGDALImages

mapdrawgdal.c:1399–1657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1397/************************************************************************/
1398
1399static int
1400LoadGDALImages( GDALDatasetH hDS, int band_numbers[4], int band_count,
1401 layerObj *layer,
1402 int src_xoff, int src_yoff, int src_xsize, int src_ysize,
1403 GByte *pabyWholeBuffer,
1404 int dst_xsize, int dst_ysize,
1405 int *pbHaveRGBNoData,
1406 int *pnNoData1, int *pnNoData2, int *pnNoData3 )
1407
1408{
1409 int iColorIndex, result_code=0;
1410 CPLErr eErr;
1411 float *pafWholeRawData;
1412
1413/* -------------------------------------------------------------------- */
1414/* If we have no alpha band, but we do have three input */
1415/* bands, then check for nodata values. If we only have one */
1416/* input band, then nodata will already have been adderssed as */
1417/* part of the real or manufactured color table. */
1418/* -------------------------------------------------------------------- */
1419 if( band_count == 3 )
1420 {
1421 *pnNoData1 = (int)
1422 msGetGDALNoDataValue( layer,
1423 GDALGetRasterBand(hDS,band_numbers[0]),
1424 pbHaveRGBNoData);
1425
1426 if( *pbHaveRGBNoData )
1427 *pnNoData2 = (int)
1428 msGetGDALNoDataValue( layer,
1429 GDALGetRasterBand(hDS,band_numbers[1]),
1430 pbHaveRGBNoData);
1431 if( *pbHaveRGBNoData )
1432 *pnNoData3 = (int)
1433 msGetGDALNoDataValue( layer,
1434 GDALGetRasterBand(hDS,band_numbers[2]),
1435 pbHaveRGBNoData);
1436 }
1437
1438/* -------------------------------------------------------------------- */
1439/* Are we doing a simple, non-scaling case? If so, read directly */
1440/* and return. */
1441/* -------------------------------------------------------------------- */
1442 if( CSLFetchNameValue( layer->processing, "SCALE" ) == NULL
1443 && CSLFetchNameValue( layer->processing, "SCALE_1" ) == NULL
1444 && CSLFetchNameValue( layer->processing, "SCALE_2" ) == NULL
1445 && CSLFetchNameValue( layer->processing, "SCALE_3" ) == NULL
1446 && CSLFetchNameValue( layer->processing, "SCALE_4" ) == NULL )
1447 {
1448 eErr = GDALDatasetRasterIO( hDS, GF_Read,
1449 src_xoff, src_yoff, src_xsize, src_ysize,
1450 pabyWholeBuffer,
1451 dst_xsize, dst_ysize, GDT_Byte,
1452 band_count, band_numbers,
1453 0,0,0);
1454
1455 if( eErr != CE_None )
1456 {

Callers 1

msDrawRasterLayerGDALFunction · 0.85

Calls 4

msGetGDALNoDataValueFunction · 0.85
msSetErrorFunction · 0.85
ApplyLUTFunction · 0.85
msDebugFunction · 0.85

Tested by

no test coverage detected