OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ElevationSlice.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 
14 #ifndef OSGSIM_ELEVATIONSLICE
15 #define OSGSIM_ELEVATIONSLICE 1
16 
17 #include <osgUtil/IntersectionVisitor>
18 
19 // include so we can get access to the DatabaseCacheReadCallback
20 #include <osgSim/LineOfSight>
21 
22 namespace osgSim {
23 
33 {
34  public :
35 
36 
38 
40  void setStartPoint(const osg::Vec3d& startPoint) { _startPoint = startPoint; }
41 
43  const osg::Vec3d& getStartPoint() const { return _startPoint; }
44 
46  void setEndPoint(const osg::Vec3d& endPoint) { _endPoint = endPoint; }
47 
49  const osg::Vec3d& getEndPoint() const { return _endPoint; }
50 
51 
52  typedef std::vector<osg::Vec3d> Vec3dList;
53 
55  const Vec3dList& getIntersections() const { return _intersections; }
56 
57  typedef std::pair<double,double> DistanceHeight;
58  typedef std::vector<DistanceHeight> DistanceHeightList;
59 
61  const DistanceHeightList& getDistanceHeightIntersections() const { return _distanceHeightIntersections; }
62 
63 
68  void computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask=0xffffffff);
69 
71  static Vec3dList computeElevationSlice(osg::Node* scene, const osg::Vec3d& startPoint, const osg::Vec3d& endPoint, osg::Node::NodeMask traversalMask=0xffffffff);
72 
73 
75  void clearDatabaseCache() { if (_dcrc.valid()) _dcrc->clearDatabaseCache(); }
76 
80  void setDatabaseCacheReadCallback(DatabaseCacheReadCallback* dcrc);
81 
84 
85  protected :
86 
87 
90  Vec3dList _intersections;
91  DistanceHeightList _distanceHeightIntersections;
92 
95 
96 
97 };
98 
99 }
100 
101 #endif
const osg::Vec3d & getEndPoint() const
#define OSGSIM_EXPORT
Definition: Export.h:38
const Vec3dList & getIntersections() const
DistanceHeightList _distanceHeightIntersections
DatabaseCacheReadCallback * getDatabaseCacheReadCallback()
std::vector< DistanceHeight > DistanceHeightList
osg::ref_ptr< DatabaseCacheReadCallback > _dcrc
std::pair< double, double > DistanceHeight
const osg::Vec3d & getStartPoint() const
Definition: Node.h:71
void setStartPoint(const osg::Vec3d &startPoint)
void setEndPoint(const osg::Vec3d &endPoint)
unsigned int NodeMask
Definition: Node.h:352
const DistanceHeightList & getDistanceHeightIntersections() const
std::vector< osg::Vec3d > Vec3dList
osgUtil::IntersectionVisitor _intersectionVisitor