| 1301 | /************************************************************************/ |
| 1302 | |
| 1303 | int msResampleGDALToMap( mapObj *map, layerObj *layer, imageObj *image, |
| 1304 | rasterBufferObj *rb, GDALDatasetH hDS ) |
| 1305 | |
| 1306 | { |
| 1307 | /* -------------------------------------------------------------------- */ |
| 1308 | /* We require PROJ.4 4.4.2 or later. Earlier versions don't */ |
| 1309 | /* have PJD_GRIDSHIFT. */ |
| 1310 | /* -------------------------------------------------------------------- */ |
| 1311 | #if !defined(PJD_GRIDSHIFT) && !defined(PJ_VERSION) |
| 1312 | msSetError(MS_PROJERR, |
| 1313 | "Projection support is not available, so msResampleGDALToMap() fails.", |
| 1314 | "msProjectRect()"); |
| 1315 | return(MS_FAILURE); |
| 1316 | #else |
| 1317 | int nSrcXSize, nSrcYSize, nDstXSize, nDstYSize; |
| 1318 | int result, bSuccess; |
| 1319 | double adfSrcGeoTransform[6], adfDstGeoTransform[6]; |
| 1320 | double adfInvSrcGeoTransform[6], dfNominalCellSize; |
| 1321 | rectObj sSrcExtent, sOrigSrcExtent; |
| 1322 | mapObj sDummyMap; |
| 1323 | imageObj *srcImage; |
| 1324 | void *pTCBData; |
| 1325 | void *pACBData; |
| 1326 | int anCMap[256]; |
| 1327 | char **papszAlteredProcessing = NULL; |
| 1328 | int nLoadImgXSize, nLoadImgYSize; |
| 1329 | double dfOversampleRatio; |
| 1330 | rasterBufferObj src_rb, *psrc_rb = NULL; |
| 1331 | |
| 1332 | |
| 1333 | const char *resampleMode = CSLFetchNameValue( layer->processing, |
| 1334 | "RESAMPLE" ); |
| 1335 | |
| 1336 | if( resampleMode == NULL ) |
| 1337 | resampleMode = "NEAREST"; |
| 1338 | |
| 1339 | /* -------------------------------------------------------------------- */ |
| 1340 | /* We will require source and destination to have a valid */ |
| 1341 | /* projection object. */ |
| 1342 | /* -------------------------------------------------------------------- */ |
| 1343 | if( map->projection.proj == NULL |
| 1344 | || layer->projection.proj == NULL ) |
| 1345 | { |
| 1346 | if( layer->debug ) |
| 1347 | msDebug( "msResampleGDALToMap(): " |
| 1348 | "Either map or layer projection is NULL, assuming compatible.\n" ); |
| 1349 | } |
| 1350 | |
| 1351 | /* -------------------------------------------------------------------- */ |
| 1352 | /* Initialize some information. */ |
| 1353 | /* -------------------------------------------------------------------- */ |
| 1354 | nDstXSize = image->width; |
| 1355 | nDstYSize = image->height; |
| 1356 | |
| 1357 | memcpy( adfDstGeoTransform, map->gt.geotransform, sizeof(double)*6 ); |
| 1358 | |
| 1359 | msGetGDALGeoTransform( hDS, map, layer, adfSrcGeoTransform ); |
| 1360 |
no test coverage detected