diff --git a/src/osgTerrain/DataSet.cpp b/src/osgTerrain/DataSet.cpp index e168b5799..25f0f5a1a 100644 --- a/src/osgTerrain/DataSet.cpp +++ b/src/osgTerrain/DataSet.cpp @@ -346,20 +346,28 @@ bool DataSet::SourceData::intersects(const SpatialProperties& sp) const void DataSet::SourceData::read(DestinationData& destination) { + std::cout<<"A"<getType()) { case(Source::IMAGE): + std::cout<<"B.1"<_gdalDataSet->GetRasterBand(i+1); double noDataValue = band->GetNoDataValue(&success); - double new_noDataValue = 0.0; + double new_noDataValue = noDataValue; if (success) { std::cout<<"\tassinging no data value "<papszWarpOptions = (char**)CPLMalloc(2*sizeof(char*)); psWO->papszWarpOptions[0] = strdup("INIT_DEST=NO_DATA"); psWO->papszWarpOptions[1] = 0; -#endif -#if 0 - psWO->pfnSrcValidityMaskFunc = (GDALMaskFunc)GDALWarpNoDataMasker; -#endif + } + else + { + + psWO->padfSrcNoDataReal = (double*) CPLMalloc(psWO->nBandCount*sizeof(double)); + psWO->padfSrcNoDataImag = (double*) CPLMalloc(psWO->nBandCount*sizeof(double)); + + psWO->padfDstNoDataReal = (double*) CPLMalloc(psWO->nBandCount*sizeof(double)); + psWO->padfDstNoDataImag = (double*) CPLMalloc(psWO->nBandCount*sizeof(double)); + + for(i = 0; i < _sourceData->_gdalDataSet->GetRasterCount(); i++ ) + { + int success = 0; + GDALRasterBand* band = _sourceData->_gdalDataSet->GetRasterBand(i+1); + double noDataValue = band->GetNoDataValue(&success); + double new_noDataValue = 0.0; + if (success) + { + std::cout<<"\tassinging no data value "<padfSrcNoDataReal[i] = noDataValue; + psWO->padfSrcNoDataImag[i] = 0.0; + psWO->padfDstNoDataReal[i] = noDataValue; + psWO->padfDstNoDataImag[i] = 0.0; + + GDALRasterBandH band = GDALGetRasterBand(hDstDS,i+1); + GDALSetRasterNoDataValue( band, new_noDataValue); + } + else + { + psWO->padfSrcNoDataReal[i] = 0.0; + psWO->padfSrcNoDataImag[i] = 0.0; + psWO->padfDstNoDataReal[i] = new_noDataValue; + psWO->padfDstNoDataImag[i] = 0.0; + + GDALRasterBandH band = GDALGetRasterBand(hDstDS,i+1); + GDALSetRasterNoDataValue( band, new_noDataValue); + } + } + + psWO->papszWarpOptions = (char**)CPLMalloc(2*sizeof(char*)); + psWO->papszWarpOptions[0] = strdup("INIT_DEST=NO_DATA"); + psWO->papszWarpOptions[1] = 0; + } @@ -933,14 +981,16 @@ DataSet::Source* DataSet::Source::doReproject(const std::string& filename, osgTe /* -------------------------------------------------------------------- */ GDALDestroyGenImgProjTransformer( hTransformArg ); - +#if 0 int anOverviewList[4] = { 2, 4, 8, 16 }; GDALBuildOverviews( hDstDS, "AVERAGE", 4, anOverviewList, 0, NULL, GDALTermProgress/*GDALDummyProgress*/, NULL ); +#endif GDALClose( hDstDS ); Source* newSource = new Source; + newSource->_type = _type; newSource->_filename = filename; newSource->_temporaryFile = true; newSource->_cs = cs; @@ -1679,7 +1729,7 @@ void DataSet::DestinationTile::readFrom(CompositeSource* sourceGraph) SourceData* data = (*itr)->getSourceData(); if (data) { - std::cout<<"SourceData::read() "< SourceData::read() "<read(*_imagery); if (_terrain.valid()) data->read(*_terrain); }