/* -*-c++-*- osgVisual - Copyright (C) 2009-2011 Torben Dannhauer * * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * osgVisual requires for some proprietary modules a license from the correspondig manufacturer. * You have to aquire licenses for all used proprietary modules. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include "ModificationVisitor.h" using namespace osgTerrain; ModificationVisitor::ModificationVisitor(std::string extensionToSet) : _extensionToSet(extensionToSet) { setTraversalMode( osg::NodeVisitor::TRAVERSE_ALL_CHILDREN ); _technique = new rampedEllipsoidTechnique(); // Set ROI to flatten and estimated height after correction _technique->setModifiedHeight(600); // 450 ModificationManager::getInstance()->addTerrainToManage( new osgTerrain::Terrain() ); } 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(); // Determine extend of the tile. region tileExtends( *h ); // ROI to flatten //region modificationROI = region( 48.336808, 48.370467, 11.736750, 11.835322 ); // roi_lat_min, roi_lat_max, roi_lon_min, roi_lon_max // MUC region modificationROI = region( 48.331808, 48.375467, 11.731750, 11.840322 ); // roi_lat_min, roi_lat_max, roi_lon_min, roi_lon_max // MUC in größer wegen Rampe. //region modificationROI = region( 30.0, 50.0, 9.0, 15.0 ); // roi_lat_min, roi_lat_max, roi_lon_min, roi_lon_max // Large ROI für Bluemarble. // Check if tile is fully or partially inside ROI: if( tileExtends.isFullOrPartiallyInside(modificationROI) ) _technique->modifyHeightfield( modificationROI, h, tileExtends ); }