source: experimental/TerrainTest/terrainModificationTechnique.h @ 269

Last change on this file since 269 was 269, checked in by Torben Dannhauer, 13 years ago
File size: 1.8 KB
Line 
1#pragma once
2#include <osg/Referenced>
3#include <osgTerrain/GeometryTechnique>
4#include <osgTerrain/TerrainTile>
5
6
7/**
8 * \brief This class defines the extends of a region. This region is a square and is defined by the latitude and longitude range
9 *
10 * @author Torben Dannhauer
11 * @date  Mrz 2011
12 */ 
13class region : public osg::Referenced
14{
15public:
16        region();
17        ~region(){};
18        region( double lat_min, double lat_max, double lon_min, double lon_max);
19        bool isInside(region& outsider);
20        bool isFullOrPartiallyInside(region& outsider);
21        double delta_lat(){return(_lat_max-_lat_max);}
22        double delta_lon(){return(_lon_max-_lon_max);}
23        double _lat_min;
24        double _lat_max;
25        double _lon_min;
26        double _lon_max;
27} ;
28
29/**
30 * \brief This class is the interface definition class for modifying terrain data. Must be subclassed to implement own terrain modification techniques.
31 *
32 * @author Torben Dannhauer
33 * @date  Feb 2011
34 */ 
35class terrainModificationTechnique : public osg::Referenced
36{
37public:
38        terrainModificationTechnique();
39        virtual ~terrainModificationTechnique();
40
41        /**
42         * \brief This function performs the terrain data modification. Must be subclassed.
43         *
44         * @param modificationROI This vector contains the extents of the region of interest which should be modified: lat_min, lat_max, long_min, long_max
45         * @param h : Heightfield of the tile which should be modified
46         * @param tileExtends : This vector contains the extents of the tile: lat_min, lat_max, long_min, long_max
47         */ 
48        virtual void modifyHeightfield(region& modificationROI, osg::HeightField* h, region tileExtends)=0;
49
50protected:
51        void clampValue(double& value, double min, double max){if(value<min)value=min;if(value>max)value=max;}
52        void clampValue(int& value, int min, int max){if(value<min)value=min;if(value>max)value=max;}
53};
Note: See TracBrowser for help on using the repository browser.