#include "ModificationVisitor.h" using namespace osgTerrain; ModificationVisitor::ModificationVisitor(std::string extensionToSet) : _extensionToSet(extensionToSet) { setTraversalMode( osg::NodeVisitor::TRAVERSE_ALL_CHILDREN ); } void ModificationVisitor::apply( osg::Node& node ) { //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: Node found: " << node.className() << std::endl; if(std::string(node.className())=="TerrainTile") { //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: Tile found" << std::endl; osgTerrain::TerrainTile* tile = dynamic_cast(&node); if(tile) modifyTile(tile); } traverse( node ); } void ModificationVisitor::apply( osg::PagedLOD& pNode ) { //OSG_NOTIFY( osg::ALWAYS ) << "ModVisitor: pagedLOD found: " << pNode.className() << std::endl; for( unsigned int i=0;i(tile->getElevationLayer()); osg::HeightField* h = hfl->getHeightField(); // ROI to flatten double dest_lat_min = 48.336808; double dest_lat_max = 48.370467; double dest_lon_min = 11.736750; double dest_lon_max = 11.835322; // Determine extend of the tile. int rows = h->getNumRows(); int cols = h->getNumColumns(); double lat_min = h->getOrigin()[1]; double lat_max = lat_min + rows * h->getYInterval(); double lon_min = h->getOrigin()[0]; double lon_max = lon_min + cols * h->getXInterval(); // Check if tile is fully or partially inside ROI: if(lat_max>dest_lat_min && lat_mindest_lon_min && lon_minsetHeight( 0,0, 600); } //OSG_NOTIFY( osg::ALWAYS ) << "Origin: " << h->getOrigin()[0] << " | " << h->getOrigin()[1] << std::endl; //OSG_NOTIFY( osg::ALWAYS ) << "X-Intervall: " << h->getXInterval() << std::endl; //OSG_NOTIFY( osg::ALWAYS ) << "Y-Intervall: " << h->getYInterval() << std::endl; //if(dest_lat_min<=lat_min && lat_max<=dest_lat_max && dest_lon_min<=lon_min && lon_max<=dest_lon_max) //{ // OSG_NOTIFY( osg::ALWAYS ) << "ModificationVisitor::modifyTile() :: affected Tile" << std::endl; // OSG_NOTIFY( osg::ALWAYS ) << "LAT: " << lat_min << " | " << lat_max << std::endl; // OSG_NOTIFY( osg::ALWAYS ) << "LON: " << lon_min << " | " << lon_max << std::endl; // h->setHeight( 0,0, 1000); //} //OpenThreads::Thread::microSleep( 50000 ); }