OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | List of all members
osgSim::HeightAboveTerrain Class Reference

#include <HeightAboveTerrain.h>

Collaboration diagram for osgSim::HeightAboveTerrain:
Collaboration graph
[legend]

Classes

struct  HAT
 

Public Member Functions

 HeightAboveTerrain ()
 
void clear ()
 
unsigned int addPoint (const osg::Vec3d &point)
 
unsigned int getNumPoints () const
 
void setPoint (unsigned int i, const osg::Vec3d &point)
 
const osg::Vec3dgetPoint (unsigned int i) const
 
double getHeightAboveTerrain (unsigned int i) const
 
void setLowestHeight (double lowestHeight)
 
double getLowestHeight () const
 
void computeIntersections (osg::Node *scene, osg::Node::NodeMask traversalMask=0xffffffff)
 
void clearDatabaseCache ()
 
void setDatabaseCacheReadCallback (DatabaseCacheReadCallback *dcrc)
 
DatabaseCacheReadCallbackgetDatabaseCacheReadCallback ()
 

Static Public Member Functions

static double computeHeightAboveTerrain (osg::Node *scene, const osg::Vec3d &point, osg::Node::NodeMask traversalMask=0xffffffff)
 

Protected Types

typedef std::vector< HATHATList
 

Protected Attributes

double _lowestHeight
 
HATList _HATList
 
osg::ref_ptr
< DatabaseCacheReadCallback
_dcrc
 
osgUtil::IntersectionVisitor _intersectionVisitor
 

Detailed Description

Helper class for setting up and acquiring height above terrain intersections with terrain. By default assigns a osgSim::DatabaseCacheReadCallback that enables automatic loading of external PagedLOD tiles to ensure that the highest level of detail is used in intersections. This automatic loading of tiles is done by the intersection traversal that is done within the computeIntersections(..) method, so can result in long intersection times when external tiles have to be loaded. The external loading of tiles can be disabled by removing the read callback, this is done by calling the setDatabaseCacheReadCallback(DatabaseCacheReadCallback*) method with a value of 0.

Definition at line 32 of file HeightAboveTerrain.h.

Member Typedef Documentation

typedef std::vector<HAT> osgSim::HeightAboveTerrain::HATList
protected

Definition at line 101 of file HeightAboveTerrain.h.

Constructor & Destructor Documentation

osgSim::HeightAboveTerrain::HeightAboveTerrain ( )

Member Function Documentation

unsigned int osgSim::HeightAboveTerrain::addPoint ( const osg::Vec3d point)

Add a height above terrain test point in the CoordinateFrame.

void osgSim::HeightAboveTerrain::clear ( )

Clear the internal HAT List so it contains no height above terrain tests.

void osgSim::HeightAboveTerrain::clearDatabaseCache ( )
inline

Clear the database cache.

Definition at line 79 of file HeightAboveTerrain.h.

static double osgSim::HeightAboveTerrain::computeHeightAboveTerrain ( osg::Node scene,
const osg::Vec3d point,
osg::Node::NodeMask  traversalMask = 0xffffffff 
)
static

Compute the vertical distance between the specified scene graph and a single HAT point.

void osgSim::HeightAboveTerrain::computeIntersections ( osg::Node scene,
osg::Node::NodeMask  traversalMask = 0xffffffff 
)

Compute the HAT intersections with the specified scene graph. The results are all stored in the form of a single height above terrain value per HAT test. Note, if the topmost node is a CoordinateSystemNode then the input points are assumed to be geocentric, with the up vector defined by the EllipsoidModel attached to the CoordinateSystemNode. If the topmost node is not a CoordinateSystemNode then a local coordinates frame is assumed, with a local up vector.

DatabaseCacheReadCallback* osgSim::HeightAboveTerrain::getDatabaseCacheReadCallback ( )
inline

Get the ReadCallback that does the reading of external PagedLOD models, and caching of loaded subgraphs.

Definition at line 87 of file HeightAboveTerrain.h.

double osgSim::HeightAboveTerrain::getHeightAboveTerrain ( unsigned int  i) const
inline

Get the intersection height for a single height above terrain test. Note, you must call computeIntersections(..) before you can query the HeightAboveTerrain. If no intersections are found then height returned will be the height above mean sea level.

Definition at line 58 of file HeightAboveTerrain.h.

double osgSim::HeightAboveTerrain::getLowestHeight ( ) const
inline

Get the lowest height that the should be tested for.

Definition at line 65 of file HeightAboveTerrain.h.

unsigned int osgSim::HeightAboveTerrain::getNumPoints ( ) const
inline

Get the number of height above terrain tests.

Definition at line 47 of file HeightAboveTerrain.h.

const osg::Vec3d& osgSim::HeightAboveTerrain::getPoint ( unsigned int  i) const
inline

Get the source point of single height above terrain test.

Definition at line 53 of file HeightAboveTerrain.h.

void osgSim::HeightAboveTerrain::setDatabaseCacheReadCallback ( DatabaseCacheReadCallback dcrc)

Set the ReadCallback that does the reading of external PagedLOD models, and caching of loaded subgraphs. Note, if you have multiple LineOfSight or HeightAboveTerrain objects in use at one time then you should share a single DatabaseCacheReadCallback between all of them.

void osgSim::HeightAboveTerrain::setLowestHeight ( double  lowestHeight)
inline

Set the lowest height that the should be tested for. Defaults to -1000, i.e. 1000m below mean sea level.

Definition at line 62 of file HeightAboveTerrain.h.

void osgSim::HeightAboveTerrain::setPoint ( unsigned int  i,
const osg::Vec3d point 
)
inline

Set the source point of single height above terrain test.

Definition at line 50 of file HeightAboveTerrain.h.

Member Data Documentation

osg::ref_ptr<DatabaseCacheReadCallback> osgSim::HeightAboveTerrain::_dcrc
protected

Definition at line 108 of file HeightAboveTerrain.h.

HATList osgSim::HeightAboveTerrain::_HATList
protected

Definition at line 105 of file HeightAboveTerrain.h.

osgUtil::IntersectionVisitor osgSim::HeightAboveTerrain::_intersectionVisitor
protected

Definition at line 109 of file HeightAboveTerrain.h.

double osgSim::HeightAboveTerrain::_lowestHeight
protected

Definition at line 104 of file HeightAboveTerrain.h.


The documentation for this class was generated from the following file: