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 | */ |
---|
13 | class region : public osg::Referenced |
---|
14 | { |
---|
15 | public: |
---|
16 | //! Constructor: Plain constructor, you have to set the extend manually. |
---|
17 | region() : _lat_min(0.0), _lat_max(0.0), _lon_min(0.0), _lon_max(0.0) {}; |
---|
18 | |
---|
19 | //! Destructor: Empty |
---|
20 | ~region(){}; |
---|
21 | |
---|
22 | //! Constructor: Constructed with the specified extend |
---|
23 | region( double lat_min, double lat_max, double lon_min, double lon_max) : _lat_min(lat_min), _lat_max(lat_max), _lon_min(lon_min), _lon_max(lon_max) {}; |
---|
24 | region( osg::HeightField& h ); |
---|
25 | bool isInside(region& outsider); |
---|
26 | bool isFullOrPartiallyInside(region& outsider); |
---|
27 | double delta_lat(){return(_lat_max-_lat_min);} |
---|
28 | double delta_lon(){return(_lon_max-_lon_min);} |
---|
29 | double _lat_min; |
---|
30 | double _lat_max; |
---|
31 | double _lon_min; |
---|
32 | double _lon_max; |
---|
33 | } ; |
---|
34 | |
---|
35 | /** |
---|
36 | * \brief This class is the interface definition class for modifying terrain data. Must be subclassed to implement own terrain modification techniques. |
---|
37 | * |
---|
38 | * @author Torben Dannhauer |
---|
39 | * @date Feb 2011 |
---|
40 | */ |
---|
41 | class terrainModificationTechnique : public osg::Referenced |
---|
42 | { |
---|
43 | public: |
---|
44 | terrainModificationTechnique(); |
---|
45 | virtual ~terrainModificationTechnique(); |
---|
46 | |
---|
47 | /** |
---|
48 | * \brief This function performs the terrain data modification. Must be subclassed. |
---|
49 | * |
---|
50 | * @param modificationROI This vector contains the extents of the region of interest which should be modified: lat_min, lat_max, long_min, long_max |
---|
51 | * @param h : Heightfield of the tile which should be modified |
---|
52 | * @param tileExtends : This vector contains the extents of the tile: lat_min, lat_max, long_min, long_max |
---|
53 | */ |
---|
54 | virtual void modifyHeightfield(region& modificationROI, osg::HeightField* h, region tileExtends)=0; |
---|
55 | |
---|
56 | protected: |
---|
57 | void clampValue(double& value, double min, double max){if(value<min)value=min;if(value>max)value=max;} |
---|
58 | void clampValue(int& value, int min, int max){if(value<min)value=min;if(value>max)value=max;} |
---|
59 | }; |
---|