diff --git a/examples/osgdem/DataSet.cpp b/examples/osgdem/DataSet.cpp index cadc4f530..c8f66aa80 100644 --- a/examples/osgdem/DataSet.cpp +++ b/examples/osgdem/DataSet.cpp @@ -142,63 +142,10 @@ DataSet::SourceData* DataSet::SourceData::readData(Source* source) osg::BoundingBox DataSet::SourceData::getExtents(const osgTerrain::CoordinateSystem* cs) const { - if (_cs==cs) return _extents; - if (_cs.valid() && cs) - { - if (*_cs == *cs) return _extents; - - if (_gdalDataSet) - { - - //std::cout<<"Projecting bounding volume for "<<_source->getFileName()<getProjectionRef().c_str(), - NULL, cs->getProjectionRef().c_str(), - TRUE, 0.0, 1 ); - - if (!hTransformArg) - { - std::cout<<" failed to create transformer"<(cs); sp._geoTransform.set( adfDstGeoTransform[1], adfDstGeoTransform[4], 0.0, 0.0, adfDstGeoTransform[2], adfDstGeoTransform[5], 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, @@ -428,7 +375,8 @@ void DataSet::SourceData::readHeightField(DestinationData& destination) else if (!bandSelected && bandGreen) bandSelected = bandGreen; else if (!bandSelected && bandBlue) bandSelected = bandBlue; - float heightRatio = 1.0/65536; + //float heightRatio = 1.0/65536; + float heightRatio = 1.0; if (bandSelected) { @@ -1906,10 +1854,19 @@ void DataSet::computeDestinationGraphFromSources(unsigned int numLevels) for(CompositeSource::source_iterator itr(_sourceGraph.get());itr.valid();++itr) { SourceData* sd = (*itr)->getSourceData(); - if (sd) extents.expandBy(sd->getExtents(_coordinateSystem.get())); + if (sd) + { + osg::BoundingBox local_extents(sd->getExtents(_coordinateSystem.get())); + std::cout<<"local_extents = xMin()"< _model; GDALDataset* _gdalDataSet; - typedef std::map SpatialPropertiesMap; + typedef std::map SpatialPropertiesMap; mutable SpatialPropertiesMap _spatialPropertiesMap; @@ -769,8 +769,11 @@ class DataSet : public osg::Referenced void loadSources(); + void setDestinationCoordinateSystem(const std::string& wellKnownText) { _coordinateSystem = new osgTerrain::CoordinateSystem(wellKnownText); } void setDestinationCoordinateSystem(osgTerrain::CoordinateSystem* cs) { _coordinateSystem = cs; } + void setDestinationExtents(const osg::BoundingBox& extents) { _extents = extents; } + void setDestinationGeoTransform(const osg::Matrixd& geoTransform) { _geoTransform = geoTransform; } void setDestinationTileBaseName(const std::string& basename) { _tileBasename = basename; } diff --git a/examples/osgdem/osgdem.cpp b/examples/osgdem/osgdem.cpp index 1c8e53975..99ab89422 100644 --- a/examples/osgdem/osgdem.cpp +++ b/examples/osgdem/osgdem.cpp @@ -27,10 +27,12 @@ #include #include +#include #include "DataSet.h" -#include +#include + int main( int argc, char **argv ) { @@ -79,6 +81,8 @@ int main( int argc, char **argv ) { dataset->setDestinationExtents(osg::BoundingBox(x,y,0.0f,x+w,y+h,0.0f)); } + + dataset->setDestinationTileBaseName("output"); dataset->setDestinationTileExtension(".ive"); @@ -110,6 +114,25 @@ int main( int argc, char **argv ) return 1; } + + if (false) + { + // set up the coordinate system + OGRSpatialReference oSRS; + + oSRS.SetProjCS( "UTM 47 (WGS84) in southern hemisphere." ); + oSRS.SetWellKnownGeogCS( "WGS84" ); + oSRS.SetUTM( 47, FALSE ); + + // get the Well Known Text string + char *pszWKT = NULL; + oSRS.exportToWkt( &pszWKT ); + + // set the destination coordinate system + dataset->setDestinationCoordinateSystem(pszWKT); + } + + // any option left unread are converted into errors to write out later. arguments.reportRemainingOptionsAsUnrecognized();