VR-Forces 4.1 Class Documentation
DtOsgTerrainPatchObject.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 #include <vrvOsg/vrvOsg.h>
14 #include <vrvOsg/DtFastGroup.h>
15 #include <osg/ref_ptr>
16 
17 namespace osgEarth
18 {
19  class MapNode;
20 }
21 
22 namespace osgEarth
23 {
24  namespace Util
25  {
26  class ElevationManager;
27  }
28 }
29 
30 namespace makVrv
31 {
32 
33  class DtDe;
34  class DtTerrainPatchGroup;
35 
41  {
42  public:
43 
46 
48  virtual ~DtOsgTerrainPatchObject();
49 
51  //
52 
54  virtual void setTerrainDefinition(const std::string& modelDefinitionName);
55 
57  virtual void enableOverlay(int type, const std::string& definition);
58 
60  virtual void disableOverlay(int type);
61 
63  virtual void disableAllOverlays();
64 
66  virtual void setOverlayScale(int type, double x, double y);
67 
69  virtual void setWrapMode(int type, int);
70 
72  virtual void setBlendMode(int type, int);
73 
75  virtual void setOverlayOffset(int type, double x, double y);
76 
78  virtual void setLayerEnabled(const std::string& rule, bool status);
79 
81  virtual void setRasterLayerPosition(int type, int pos);
82 
83  //
85 
86  virtual std::string overlayDefinition(int type);
87 
88  virtual std::vector<double> overlayScale(int type);
89  virtual std::vector<double> overlayOffset(int type);
90  virtual DtTerrainOverlayOperation defaultOverlay(int type);
91  virtual DtTerrainOverlayOperation currentOverlay(int type);
92 
94  virtual void getBoundingBoxMinMax(DtVector& min, DtVector& max) const;
95 
97  virtual void getTerrainExtents(DtVector& nw, DtVector& ne, DtVector& sw, DtVector& se) const;
98 
100  virtual DtVector getDatabaseOrigin() const;
101 
103  virtual void getBoundingBoxCenter(float& x, float& y, float& z) const;
104 
105  //Get the terrain group node.
106  osg::Group* terrainGroupNode();
107 
109  virtual void extractNodes(const std::string& ruleset, bool isRegEx);
110 
113  virtual int countNodes(const std::string& rule) const;
114 
117  virtual bool getExtractedNodePosition(const std::string& rule,
118  unsigned int index, double& x, double& y, double& z) const;
119 
122  virtual bool getExtractedNodeOrientation( const std::string& rule,
123  unsigned int index, double& x, double& y, double& z, double& w) const;
124 
127  virtual void moveNode(DtSceneObject* object,
128  DtModel* model,const std::string& rule, unsigned int index);
129 
131  virtual osg::Node* findNode(const std::string& rule, unsigned int index);
132 
134  virtual bool isGlobalScaleTerrain() const;
135 
137  virtual bool getTerrainIntersection(double x, double y, double z,
138  double vx, double vy, double vz, double& retX, double& retY, double& retZ );
139 
143  virtual void clearElevationCache();
144 
145  bool isOsgEarth() const
146  {
147  return myMapNode != 0;
148  }
149 
150  private:
154 
155  protected:
156 
158  void removeChildNodesAndCache();
159 
160  static void graphBoundingBox(const osg::Node* node, osg::BoundingBox &bbox);
161 
162  //Remove the node from it's parent, and if the parent has no other
163  //Children remove it from it's parent too recursively.
164  void removeEmptyParent(osg::Node* node);
165  void updateBounds();
166 
168  virtual bool getElevation(double lonRadians, double latRadians,
169  double& retElevation );
170 
171  protected:
172 
174  {
175  osg::Vec3 location;
176  osg::Vec3 scale;
177  osg::Quat orientation;
178  osg::Quat orientationScale;
179  osg::ref_ptr<osg::Node> node;
180  osg::Node::ParentList parents;
181  };
182 
183 
185  osg::ref_ptr<DtTerrainPatchGroup> myRoot;
186 
188  osg::ref_ptr<DtFastGroup> myTerrainGroup;
189 
190  osgEarth::Util::ElevationManager* myElevationManager;
191  osgEarth::MapNode* myMapNode;
192 
193  typedef std::vector<ExtractedNode> NodeList;
194  typedef std::map<std::string, NodeList > ExtractedNodeListMap;
196 
198 
200  };
201 }

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)