VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tileData.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
11 
14 
15 #include <osgEarth/Feature>
16 #include <osgEarth/TerrainTileModel>
17 #include <osgEarth/TileKey>
18 
20 
21 #include <terrainCS/coordSystem.h>
22 
23 #include <geometry/surface.h>
24 #include <geometry/chord.h>
25 
26 #include <boost/shared_ptr.hpp>
27 
28 #include <tbb/atomic.h>
29 #include <tbb/spin_rw_mutex.h>
30 
31 #include <vector>
32 #include <string>
33 #include <map>
34 
35 
37 
40 {
41  enum TileType
42  {
44  Empty
45  };
46 
49  {
50  typedef std::vector<Extent> Vector;
51 
53  static Vector Simplify(const Vector& extents);
54 
55  explicit Extent(const osgEarth::TileKey&);
56  explicit Extent(const DtVector& min, const DtVector& max);
57  bool operator==(const Extent & rhs) const;
58 
59  DtVector min, max;
60  };
61 
64  {
65  typedef std::vector<IndexExtent> Vector;
66 
67  explicit IndexExtent(const DtTileData& tile, const Extent& extent);
68 
69  unsigned minx, miny, maxx, maxy;
70  };
71 
73  explicit DtTileData(
74  const DtTerrainSourceTracker& tracker,
75  const osgEarth::TileKey& key);
76 
78  virtual ~DtTileData();
79 
82 
85 
88 
90  const osgEarth::TileKey tileKey;
91 
94 
99 
102  bool setSoilType(const DtPoint & geodeticPt, DtSurface & surface, bool blockIfUnavailable, bool& landDataAvailable) const;
103 
105  DtSurface setSoilType(const DtTerrainTriangleStruct & tri, bool blockIfUnavailable) const;
106 
108  virtual void addMaskExtents(const Extent::Vector& extents);
109 
111  virtual void addMaskExtent(const Extent& extent);
112 
114  virtual void removeMaskExtent(const Extent& extent);
115 
117  virtual void getMaskExtents(Extent::Vector& extents);
118 
124  virtual bool insideValidArea(const DtPoint& p) const;
125 
132  virtual bool extentInsideValidArea(unsigned x1, unsigned y1, unsigned x2, unsigned y2) const;
133 
139  virtual bool extentOutsideValidArea(unsigned x1, unsigned y1, unsigned x2, unsigned y2) const;
140 
146  virtual bool addActiveTileKey(const osgEarth::TileKey& key) = 0;
147 
153  virtual void recomputeActiveTileKeyAreas() = 0;
154 
157 
160  std::vector< osg::ref_ptr<osg::Node> > geometries;
161 
164  std::vector< osg::ref_ptr<osg::Node> > features;
165 
169  std::vector < osgEarth::TileKey > featuresTileKey;
170  std::vector < std::string > featuresLayerName;
171 
173  virtual std::string description() const = 0;
174 
176  virtual unsigned numberOfVertices() const = 0;
177 
181  virtual unsigned numberOfTrianglesForVertices() const;
182 
184  virtual void getTriangleVertices(unsigned xindex, unsigned yindex, double& x, double& y) const = 0;
185 
187  virtual DtVector getTriangleVertices(unsigned xindex, unsigned yindex) const;
188 
190  virtual void getTriangleIndices(double x, double y, unsigned& xindex, unsigned& yindex) const = 0;
191 
192  virtual double getTriangleIdxVsHeightFieldIdxRatio() const;
193 
196  virtual void heightfieldIndexForTriangleIndex(
197  unsigned triangleXIndex, unsigned triangleYIndex,
198  unsigned& heightFieldXUsed, unsigned& heightFieldYUsed) const = 0;
199 
201  virtual double interpolateHeight(
202  unsigned triangleXIndex, unsigned triangleYIndex,
203  unsigned* heightFieldXUsed = 0, unsigned* heightFieldYUsed = 0) const = 0;
204 
206  virtual bool getLandCoverName(const DtPoint & pt, std::string & landCoverName, bool &dataAvailable, bool blockOnUnavailable) const = 0;
207 
209  virtual int getLandCoverValue(const DtPoint & pt, bool & dataAvailable, bool blockOnUnavailable) const = 0;
210 
213  tbb::atomic<unsigned int> numTriangles;
214 
218 
220  virtual DtTerrainIntersectIDType getLastUsed() const = 0;
221 
223  virtual bool updateLastUsed(DtTerrainIntersectIDType value) = 0;
224 
231  virtual bool findIntersections(
232  const DtChord& chord,
233  unsigned x1, unsigned y1, unsigned x2, unsigned y2,
235  const DtTerrainIntersectOptions& options,
237  bool singleCell = false,
238  bool insideValidAreaChecked = false) const;
239 
242  virtual bool findIntersections(
243  const DtChord& chord,
245  const DtTerrainIntersectOptions& options) const = 0;
246 
253  virtual void findTriangles(
254  const DtTerrainProcessPolygonsBox& box,
255  unsigned x1, unsigned y1, unsigned x2, unsigned y2,
257  bool singleCell = false,
258  bool insideValidAreaChecked = false) const;
259 
262  virtual void findTriangles(
263  const DtTerrainProcessPolygonsBox& box,
264  DtTriangleOutputInterface&) const = 0;
265 
267  virtual osgEarth::FeatureList& groundFeatureList();
268 
269  virtual void forceLoadAllData(bool isBlocking = true) { }
270 protected:
271 
272  mutable tbb::spin_rw_mutex maskExtentsMutex;
273 
274 
278 
280 
283 
285  osgEarth::FeatureList myGroundFeatureList;
286 };
287 
288 class TileData : public DtTileData
289 {
290 public:
292  const osgEarth::TileKey& key);
293 
295 
297 
302  bool addActiveTileKey(const osgEarth::TileKey& key);
303 
305 
306  bool insideValidArea(const DtPoint& p) const;
307 
308  bool extentInsideValidArea(unsigned x1, unsigned y1, unsigned x2, unsigned y2) const;
309 
310  bool extentOutsideValidArea(unsigned x1, unsigned y1, unsigned x2, unsigned y2) const;
311 
312  bool getLandCoverName(const DtPoint & pt, std::string & landCoverName, bool & dataAvailable, bool blockOnUnavailable) const;
313 
314  int getLandCoverValue(const DtPoint & pt, bool & dataAvailable, bool blockOnUnavailable) const;
315 
316 protected:
317  tbb::atomic<DtTerrainIntersectIDType> myLastUsed;
318 
319  typedef std::set<osgEarth::TileKey> TileKeySet;
320 
323 
324  mutable tbb::spin_rw_mutex myInactiveAreasMutex;
327 };
328 
329 typedef std::map< osgEarth::TileKey, boost::shared_ptr<DtTileData> > DtTerrainTileMap;
330 
DtTileData is tracked by the DtOsgEarthTerrainSourceTracker for paging out tiles. ...
Definition: tileData.h:39
NOTE: This entire class is deprecated, in favor of Dt3dChord.
Definition: chord.h:40
void recomputeActiveTileKeyAreas()
Should be called to enable a tilekey subarea once everything else needed for it is setup...
DtVrfChordIntersectionRecord represents a list of DtChordIntersectRecords.
Definition: vrfChordIntersectRecordList.h:31
unsigned miny
Definition: tileData.h:69
bool getLandCoverName(const DtPoint &pt, std::string &landCoverName, bool &dataAvailable, bool blockOnUnavailable) const
bool pendingRemoval
Whether this tile has had a page out command issued for it and should be ignored when calculating the...
Definition: tileData.h:217
TileData(const DtTerrainSourceTracker &tracker, const osgEarth::TileKey &key)
virtual void forceLoadAllData(bool isBlocking=true)
Definition: tileData.h:269
int getLandCoverValue(const DtPoint &pt, bool &dataAvailable, bool blockOnUnavailable) const
Definition: tileData.h:43
CS_Type cstype
tracker coord system
Definition: tileData.h:87
DT_DLL_terrainCS bool operator==(const DtDegMinSec &lhs, const DtDegMinSec &rhs)
unsigned long long DtTerrainIntersectIDType
Definition: terrainInterfaceDefines.h:28
const DtTerrainSourceTracker & tracker
Tracker that owns this tile.
Definition: tileData.h:81
std::set< GroundFeatureProcess > groundFeatureList
Definition: GroundFeatureProcess.h:43
bool updateLastUsed(DtTerrainIntersectIDType value)
Update last intersect id.
Extent::Vector unSimplifiedMaskExtents
Definition: tileData.h:279
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
Axis aligned extents in osgearth coordinate system.
Definition: tileData.h:48
osgEarth::FeatureList myGroundFeatureList
Ground Feature List (procedural trees from osgEarth)
Definition: tileData.h:285
tbb::spin_rw_mutex myInactiveAreasMutex
Definition: tileData.h:324
Definition: surface.h:179
Extent::Vector myInactiveAreas
Definition: tileData.h:325
Axis aligned extent whose coordinates are in triangle vertex indices.
Definition: tileData.h:63
std::set< osgEarth::TileKey > TileKeySet
Definition: tileData.h:319
DtTerrainIntersectOptions Passed to terrain intersect functions to modify how intersect acts...
Definition: terrainIntersectOptions.h:15
bool insideValidArea(const DtPoint &p) const
Returns true if the point is inside a valid area.
tbb::atomic< DtTerrainIntersectIDType > myLastUsed
Definition: tileData.h:317
std::vector< osg::ref_ptr< osg::Node > > geometries
Geometries associated with this tile.
Definition: tileData.h:160
Definition: terrainProcessPolygonsBox.h:25
DtExtent dtExtent
DtExtent of the tile.
Definition: tileData.h:98
TileKeySet myActiveTileKeys
Definition: tileData.h:322
bool extentOutsideValidArea(unsigned x1, unsigned y1, unsigned x2, unsigned y2) const
Returns true if the extent is entirely outside the valid area.
std::map< osgEarth::TileKey, boost::shared_ptr< DtTileData > > DtTerrainTileMap
Definition: tileData.h:329
std::vector< Extent > Vector
Definition: tileData.h:50
TileType type
Abstract notion of type so we can annotate tiles.
Definition: tileData.h:156
std::vector< std::string > featuresLayerName
Definition: tileData.h:170
Base class for Terrain Source trackers.
Definition: terrainSourceTracker.h:75
TileKeySet myInactiveTileKeys
Definition: tileData.h:321
IndexExtent::Vector maskIndexExtents
Same masks as maskExtents but in triangle index coordinates.
Definition: tileData.h:282
Extent
Definition: DtAxisAlignedBoundingBox.h:16
std::vector< osgEarth::TileKey > featuresTileKey
List of ground features key generated associated with the current tileKey (groundcover is often not a...
Definition: tileData.h:169
Extent::Vector maskExtents
Masks computed from masked out areas in osgearth.
Definition: tileData.h:277
DtTerrainIntersectIDType getLastUsed() const
Return the last intersect id which touch this tile.
const osgEarth::TileKey tileKey
TileKey for this tile.
Definition: tileData.h:90
tbb::spin_rw_mutex maskExtentsMutex
Definition: tileData.h:272
CS_Type
Definition: coordSystem.h:35
std::vector< IndexExtent > Vector
Definition: tileData.h:65
IndexExtent::Vector myInactiveIndexAreas
Definition: tileData.h:326
bool addActiveTileKey(const osgEarth::TileKey &key)
Activate this tile (i.e a subregion) of this tile.
A DtChord is a finite line segment in 3-space, represented by two points.
bool extentInsideValidArea(unsigned x1, unsigned y1, unsigned x2, unsigned y2) const
Returns true if the extent is entirely inside a valid area (doesn&#39;t intersect any invalid areas)...
TileType
Definition: tileData.h:41
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
double elevationTolerance
Tracker elevation tolerance.
Definition: tileData.h:84
Interface for getting terrain triangle data out of DtTerrainInterface::trianglesInArea.
Definition: terrainProcessPolygonsBox.h:113
Definition: tileData.h:288
osg::ref_ptr< osgEarth::TerrainTileModel > tileModel
osgearth tile model if using elevation.
Definition: tileData.h:93
std::vector< osg::ref_ptr< osg::Node > > features
list of geometries box created from the features like sim trees
Definition: tileData.h:164
Extent extent
Extent of tile.
Definition: tileData.h:96
DtVector min
Definition: tileData.h:59
tbb::atomic< unsigned int > numTriangles
The number of triangles this tile, and therefore its collision object, contain.
Definition: tileData.h:213
Definition: point.h:34
DtIntersectionType
Definition: intersectionRecord.h:41
Represents an area query which can be used to extract triangles from DtTerrainInterface.
Definition: terrainProcessPolygonsBox.h:39

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)