CPLErr RasterliteDataset::IBuildOverviews( const char * pszResampling, int nOverviews, int * panOverviewList, int nBands, int * panBandList, GDALProgressFunc pfnProgress, void * pProgressData ) { CPLErr eErr = CE_None; if (nLevel != 0) { CPLError(CE_Failure, CPLE_AppDefined, "Overviews can only be computed on the base dataset"); return CE_Failure; } if (osTableName.size() == 0) return CE_Failure; /* -------------------------------------------------------------------- */ /* If we don't have read access, then create the overviews */ /* externally. */ /* -------------------------------------------------------------------- */ if( GetAccess() != GA_Update ) { CPLDebug( "Rasterlite", "File open for read-only accessing, " "creating overviews externally." ); if (nResolutions != 1) { CPLError(CE_Failure, CPLE_NotSupported, "Cannot add external overviews to a " "dataset with internal overviews"); return CE_Failure; } bCheckForExistingOverview = FALSE; eErr = GDALDataset::IBuildOverviews( pszResampling, nOverviews, panOverviewList, nBands, panBandList, pfnProgress, pProgressData ); bCheckForExistingOverview = TRUE; return eErr; } /* -------------------------------------------------------------------- */ /* If zero overviews were requested, we need to clear all */ /* existing overviews. */ /* -------------------------------------------------------------------- */ if (nOverviews == 0) { return CleanOverviews(); } if( nBands != GetRasterCount() ) { CPLError( CE_Failure, CPLE_NotSupported, "Generation of overviews in RASTERLITE only" " supported when operating on all bands.\n" "Operation failed.\n" ); return CE_Failure; } if( !EQUALN(pszResampling, "NEAR", 4)) { CPLError( CE_Failure, CPLE_NotSupported, "Only NEAREST resampling is allowed for now " "for RASTERLITE overviews"); return CE_Failure; } int i; for(i=0;i<nOverviews && eErr == CE_None;i++) { if (panOverviewList[i] <= 1) continue; eErr = CleanOverviewLevel(panOverviewList[i]); if (eErr == CE_None) eErr = CreateOverviewLevel(panOverviewList[i], pfnProgress, pProgressData); ReloadOverviews(); } return eErr; }
CPLErr RasterliteDataset::IBuildOverviews( const char * pszResampling, int nOverviews, int * panOverviewList, int nBands, int * panBandList, GDALProgressFunc pfnProgress, void * pProgressData ) { CPLErr eErr = CE_None; if (nLevel != 0) { CPLError(CE_Failure, CPLE_AppDefined, "Overviews can only be computed on the base dataset"); return CE_Failure; } if (osTableName.size() == 0) return CE_Failure; /* -------------------------------------------------------------------- */ /* If we don't have read access, then create the overviews */ /* externally. */ /* -------------------------------------------------------------------- */ if( GetAccess() != GA_Update ) { CPLDebug( "Rasterlite", "File open for read-only accessing, " "creating overviews externally." ); if (nResolutions != 1) { CPLError(CE_Failure, CPLE_NotSupported, "Cannot add external overviews to a " "dataset with internal overviews"); return CE_Failure; } bCheckForExistingOverview = FALSE; eErr = GDALDataset::IBuildOverviews( pszResampling, nOverviews, panOverviewList, nBands, panBandList, pfnProgress, pProgressData ); bCheckForExistingOverview = TRUE; return eErr; } /* -------------------------------------------------------------------- */ /* If zero overviews were requested, we need to clear all */ /* existing overviews. */ /* -------------------------------------------------------------------- */ if (nOverviews == 0) { return CleanOverviews(); } if( nBands != GetRasterCount() ) { CPLError( CE_Failure, CPLE_NotSupported, "Generation of overviews in RASTERLITE only" " supported when operating on all bands.\n" "Operation failed.\n" ); return CE_Failure; } const char* pszOvrOptions = CPLGetConfigOption("RASTERLITE_OVR_OPTIONS", NULL); char** papszOptions = (pszOvrOptions) ? CSLTokenizeString2( pszOvrOptions, ",", 0) : NULL; GDALValidateCreationOptions( GetDriver(), papszOptions); int i; for(i=0;i<nOverviews && eErr == CE_None;i++) { if (panOverviewList[i] <= 1) continue; eErr = CleanOverviewLevel(panOverviewList[i]); if (eErr == CE_None) eErr = CreateOverviewLevel(pszResampling, panOverviewList[i], papszOptions, pfnProgress, pProgressData); ReloadOverviews(); } CSLDestroy(papszOptions); return eErr; }