ElevationSlice
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is 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.
*
* 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.
*/
#ifndef OSGSIM_ELEVATIONSLICE
#define OSGSIM_ELEVATIONSLICE 1
#include <osgUtil/IntersectionVisitor>
// include so we can get access to the DatabaseCacheReadCallback
#include <osgSim/LineOfSight>
namespace osgSim {
class OSGSIM_EXPORT ElevationSlice
{
public :
ElevationSlice();
void setStartPoint(const osg::Vec3d& startPoint) { _startPoint = startPoint; }
const osg::Vec3d& getStartPoint() const { return _startPoint; }
void setEndPoint(const osg::Vec3d& endPoint) { _endPoint = endPoint; }
const osg::Vec3d& getEndPoint() const { return _endPoint; }
typedef std::vector<osg::Vec3d> Vec3dList;
const Vec3dList& getIntersections() const { return _intersections; }
typedef std::pair<double,double> DistanceHeight;
typedef std::vector<DistanceHeight> DistanceHeightList;
const DistanceHeightList& getDistanceHeightIntersections() const { return _distanceHeightIntersections; }
void computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask=0xffffffff);
static Vec3dList computeElevationSlice(osg::Node* scene, const osg::Vec3d& startPoint, const osg::Vec3d& endPoint, osg::Node::NodeMask traversalMask=0xffffffff);
void clearDatabaseCache() { if (_dcrc.valid()) _dcrc->clearDatabaseCache(); }
void setDatabaseCacheReadCallback(DatabaseCacheReadCallback* dcrc);
DatabaseCacheReadCallback* getDatabaseCacheReadCallback() { return _dcrc.get(); }
protected :
osg::Vec3d _startPoint;
osg::Vec3d _endPoint;
Vec3dList _intersections;
DistanceHeightList _distanceHeightIntersections;
osg::ref_ptr<DatabaseCacheReadCallback> _dcrc;
osgUtil::IntersectionVisitor _intersectionVisitor;
};
}
#endif
IntersectionVisitor
LineOfSight
osgSim::DatabaseCacheReadCallback
Definition LineOfSight:24
osgSim::ElevationSlice::_distanceHeightIntersections
DistanceHeightList _distanceHeightIntersections
Definition ElevationSlice:91
osgSim::ElevationSlice::_dcrc
osg::ref_ptr< DatabaseCacheReadCallback > _dcrc
Definition ElevationSlice:93
osgSim::ElevationSlice::setDatabaseCacheReadCallback
void setDatabaseCacheReadCallback(DatabaseCacheReadCallback *dcrc)
osgSim::ElevationSlice::setStartPoint
void setStartPoint(const osg::Vec3d &startPoint)
Definition ElevationSlice:40
osgSim::ElevationSlice::Vec3dList
std::vector< osg::Vec3d > Vec3dList
Definition ElevationSlice:52
osgSim::ElevationSlice::DistanceHeight
std::pair< double, double > DistanceHeight
Definition ElevationSlice:57
osgSim::ElevationSlice::setEndPoint
void setEndPoint(const osg::Vec3d &endPoint)
Definition ElevationSlice:46
osgSim::ElevationSlice::getDatabaseCacheReadCallback
DatabaseCacheReadCallback * getDatabaseCacheReadCallback()
Definition ElevationSlice:83
osgSim::ElevationSlice::_startPoint
osg::Vec3d _startPoint
Definition ElevationSlice:88
osgSim::ElevationSlice::getIntersections
const Vec3dList & getIntersections() const
Definition ElevationSlice:55
osgSim::ElevationSlice::clearDatabaseCache
void clearDatabaseCache()
Definition ElevationSlice:75
osgSim::ElevationSlice::getDistanceHeightIntersections
const DistanceHeightList & getDistanceHeightIntersections() const
Definition ElevationSlice:61
osgSim::ElevationSlice::_intersections
Vec3dList _intersections
Definition ElevationSlice:90
osgSim::ElevationSlice::getStartPoint
const osg::Vec3d & getStartPoint() const
Definition ElevationSlice:43
osgSim::ElevationSlice::ElevationSlice
ElevationSlice()
osgSim::ElevationSlice::getEndPoint
const osg::Vec3d & getEndPoint() const
Definition ElevationSlice:49
osgSim::ElevationSlice::computeElevationSlice
static Vec3dList computeElevationSlice(osg::Node *scene, const osg::Vec3d &startPoint, const osg::Vec3d &endPoint, osg::Node::NodeMask traversalMask=0xffffffff)
osgSim::ElevationSlice::_endPoint
osg::Vec3d _endPoint
Definition ElevationSlice:89
osgSim::ElevationSlice::_intersectionVisitor
osgUtil::IntersectionVisitor _intersectionVisitor
Definition ElevationSlice:94
osgSim::ElevationSlice::computeIntersections
void computeIntersections(osg::Node *scene, osg::Node::NodeMask traversalMask=0xffffffff)
osgSim::ElevationSlice::DistanceHeightList
std::vector< DistanceHeight > DistanceHeightList
Definition ElevationSlice:58
osgUtil::IntersectionVisitor
Definition IntersectionVisitor:152
osg::Node
Definition Node:72
osg::Node::NodeMask
unsigned int NodeMask
Definition Node:363
osg::Vec3d
Definition Vec3d:30
osg::ref_ptr
Definition ref_ptr:32
osgSim
Definition BlinkSequence:27
OSGSIM_EXPORT
#define OSGSIM_EXPORT
Definition osgSim/Export:38