diff --git a/applications/osgdem/osgdem.cpp b/applications/osgdem/osgdem.cpp index 47d71ebec..3dbe00726 100644 --- a/applications/osgdem/osgdem.cpp +++ b/applications/osgdem/osgdem.cpp @@ -85,37 +85,37 @@ void ellipsodeTransformTest(double latitude, double longitude, double height) } void processFile(std::string filename, - osgTerrain::DataSet::Source::Type type, - std::string currentCS, - osg::Matrixd &geoTransform, - bool geoTransformSet, - bool geoTransformScale, + osgTerrain::DataSet::Source::Type type, + std::string currentCS, + osg::Matrixd &geoTransform, + bool geoTransformSet, + bool geoTransformScale, bool minmaxLevelSet, unsigned int min_level, unsigned int max_level, unsigned int layerNum, - osg::ref_ptr dataset) { + osg::ref_ptr dataset) { if(filename.empty()) return; if(osgDB::fileType(filename) == osgDB::REGULAR_FILE) { - - osgTerrain::DataSet::Source* source = new osgTerrain::DataSet::Source(type, filename); - if (source) - { - if (!currentCS.empty()) - { - std::cout<<"source->setCoordySystem "<setCoordinateSystemPolicy(osgTerrain::DataSet::Source::PREFER_CONFIG_SETTINGS); - source->setCoordinateSystem(currentCS); - } - - if (geoTransformSet) - { - std::cout<<"source->setGeoTransform "<setGeoTransformPolicy(geoTransformScale ? - osgTerrain::DataSet::Source::PREFER_CONFIG_SETTINGS_BUT_SCALE_BY_FILE_RESOLUTION : - osgTerrain::DataSet::Source::PREFER_CONFIG_SETTINGS); - source->setGeoTransform(geoTransform); - } + + osgTerrain::DataSet::Source* source = new osgTerrain::DataSet::Source(type, filename); + if (source) + { + if (!currentCS.empty()) + { + std::cout<<"source->setCoordySystem "<setCoordinateSystemPolicy(osgTerrain::DataSet::Source::PREFER_CONFIG_SETTINGS); + source->setCoordinateSystem(currentCS); + } + + if (geoTransformSet) + { + std::cout<<"source->setGeoTransform "<setGeoTransformPolicy(geoTransformScale ? + osgTerrain::DataSet::Source::PREFER_CONFIG_SETTINGS_BUT_SCALE_BY_FILE_RESOLUTION : + osgTerrain::DataSet::Source::PREFER_CONFIG_SETTINGS); + source->setGeoTransform(geoTransform); + } if (minmaxLevelSet) { source->setMinMaxLevel(min_level, max_level); @@ -124,26 +124,26 @@ void processFile(std::string filename, source->setLayer(layerNum); std::cout<<"Reading as layer = "<addSource(source); - } + + dataset->addSource(source); + } } else if (osgDB::fileType(filename) == osgDB::DIRECTORY) { - osgDB::DirectoryContents dirContents= osgDB::getDirectoryContents(filename); - - // loop through directory contents and call processFile - std::vector::iterator i; - std::string fullfilename; - for(i = dirContents.begin(); i != dirContents.end(); ++i) { - if((*i != ".") && (*i != "..")) { - fullfilename = filename + '/' + *i; - processFile(fullfilename, type, currentCS, + osgDB::DirectoryContents dirContents= osgDB::getDirectoryContents(filename); + + // loop through directory contents and call processFile + std::vector::iterator i; + std::string fullfilename; + for(i = dirContents.begin(); i != dirContents.end(); ++i) { + if((*i != ".") && (*i != "..")) { + fullfilename = filename + '/' + *i; + processFile(fullfilename, type, currentCS, geoTransform, geoTransformSet, geoTransformScale, minmaxLevelSet, min_level, max_level, layerNum, dataset); - } - } + } + } } } @@ -514,8 +514,8 @@ int main( int argc, char **argv ) else if (arguments.read(pos, "-d",filename)) { - std::cout<<"-d "<