source: experimental/TerrainTest/ellipsoidTechnique.cpp @ 260

Last change on this file since 260 was 260, checked in by Torben Dannhauer, 13 years ago
  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1#include "ellipsoidTechnique.h"
2#include <osgTerrain/TerrainTile>
3
4
5ellipsoidTechnique::ellipsoidTechnique()
6{
7}
8
9ellipsoidTechnique::~ellipsoidTechnique()
10{
11}
12
13void ellipsoidTechnique::modifyHeightfield(osg::HeightField* h, double lat_min, double lat_max, double lon_min, double lon_max)
14{
15        OSG_NOTIFY( osg::ALWAYS ) << "ellipsoidTechnique::modifyHeightfield()" << std::endl;
16        OSG_NOTIFY( osg::ALWAYS ) << "LAT: " << lat_min << " | " << lat_max << std::endl;
17        OSG_NOTIFY( osg::ALWAYS ) << "LON: " << lon_min << " | " << lon_max << std::endl;
18
19        int rows = h->getNumRows();
20        int cols = h->getNumColumns();
21
22        // calculate colum start/end and row start/end of affected vertices
23        int startX=0,startY=0,endX=cols,endY=rows;
24
25        double roi_lat_min = 48.336808;
26        double roi_lat_max = 48.370467;
27        double roi_lon_min = 11.736750;
28        double roi_lon_max = 11.835322;
29
30        // dertermining loop variables
31        if(lat_min<roi_lat_min)
32                startY = (roi_lat_min - lat_min) / h->getYInterval();
33        if(lat_max>roi_lat_max)
34                endY = (roi_lat_max - lat_min) / h->getYInterval();
35
36        if(lon_min<roi_lon_min)
37                startX = (roi_lon_min - lon_min) / h->getXInterval();
38        if(lon_max>roi_lon_max)
39                endX = (roi_lon_max - lon_min) / h->getXInterval();
40
41
42        // modify height value of affected vertices
43        for(int x=startX;x<endX;x++)
44        {
45                for(int y=startY;y<endY;y++)
46                {
47                        h->setHeight( x, y, 550);
48                }
49        }
50       
51
52
53        //OSG_NOTIFY( osg::ALWAYS ) << "Origin: " << h->getOrigin()[0] << " | " << h->getOrigin()[1] << std::endl;
54        //OSG_NOTIFY( osg::ALWAYS ) << "X-Intervall: " << h->getXInterval() << std::endl;
55        //OSG_NOTIFY( osg::ALWAYS ) << "Y-Intervall: " << h->getYInterval() << std::endl;
56        //if(dest_lat_min<=lat_min && lat_max<=dest_lat_max && dest_lon_min<=lon_min && lon_max<=dest_lon_max)
57        //{
58        //      OSG_NOTIFY( osg::ALWAYS ) << "ModificationVisitor::modifyTile() :: affected Tile" << std::endl;
59        //      OSG_NOTIFY( osg::ALWAYS ) << "LAT: " << lat_min << " | " << lat_max << std::endl;
60        //      OSG_NOTIFY( osg::ALWAYS ) << "LON: " << lon_min << " | " << lon_max << std::endl;
61
62        //      h->setHeight( 0,0, 1000);
63        //}
64        //OpenThreads::Thread::microSleep( 50000 );
65}
66
Note: See TracBrowser for help on using the repository browser.