VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tileSpatialIndex.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
10 
14 
15 #include <osgEarth/ElevationLayer>
16 
17 #include <boost/ptr_container/ptr_vector.hpp>
18 
20 class DtChord;
21 class DtExtent;
22 class DtSphere;
23 class DtLocalVertexList;
24 class TileDataCallback;
25 class TileSpatialIndex;
26 class IndexInterface;
28 
29 typedef std::list<osgEarth::TileKey> DtTileKeyList;
30 
31 typedef boost::ptr_vector<TileSpatialIndex> TileRoots;
32 
34 {
35 public:
37  {
38  static boost::optional<ElevationRange> Merge(
39  const boost::optional<ElevationRange>& r1,
40  const boost::optional<ElevationRange>& r2);
41 
42  double min, max;
43 
45  ElevationRange(double min, double max);
46 
47  void merge(const ElevationRange&);
48  };
49 
51  const DtTerrainSourceTracker& tracker,
52  const osgEarth::TileKey& tilekey,
53  TileSpatialIndex* parent);
54 
55  void getExtent(DtVector& lower, DtVector& upper, bool useElevation = true) const;
56  void getSubTileExtent(unsigned i, DtVector& lower, DtVector& upper, bool useElevation = true) const;
57 
58  bool intersects(const DtTerrainPagingGeometry& geometry) const;
59  bool intersectsSubTile(const DtTerrainPagingGeometry& geometry, int i) const;
60 
61  bool chordIntersects(const DtChord& chord, bool useElevation = true) const;
62  bool extentIntersects(const DtExtent& extent) const;
63  bool sphereIntersects(const DtSphere& sphere) const;
64  bool shapeIntersects(const DtLocalVertexList& shape) const;
65  bool chordIntersectsSubTile(const DtChord& chord, int i, bool useElevation = true) const;
66  bool extentIntersectsSubTile(const DtExtent& shape, int i) const;
67  bool sphereIntersectsSubTile(const DtSphere& sphere, int i) const;
68  bool shapeIntersectsSubTile(const DtLocalVertexList& shape, int i) const;
69 
71  void findMissing(
72  const DtTerrainPagingGeometry& geometry,
73  DtTileKeyList& missing) const;
74 
77  bool findData(
78  const DtTerrainPagingGeometry* geometry,
79  std::vector< boost::shared_ptr<DtTileData> >& data,
80  TileDataCallback* callback = 0) const;
81 
84  boost::optional<double> getMaxAltForChord(const DtChord& chord, unsigned maxlod) const;
85 
87  boost::shared_ptr<DtTileData> findOldest() const;
88 
94  bool addTile(const osgEarth::TileKey& key, const boost::shared_ptr<DtTileData>& data);
95 
97  void removeTile(const osgEarth::TileKey& tilekey);
98 
100  void getTiles(std::vector<osgEarth::TileKey>& keys, unsigned lod);
101 
103  unsigned tileCount() const;
104 
106  unsigned cellCount() const;
107 
109  const osgEarth::TileKey tileKey() const { return myTileKey; }
110 
112  TileSpatialIndex* setAltitudeRange(
113  const osgEarth::TileKey& key,
114  const ElevationRange& range,
115  const ElevationRange& offsets,
116  unsigned layerNum,
117  bool coversTile);
118 
120  bool postProcessIndexLayer(unsigned layerNum);
121 
124  void writeIndex(
125  IndexInterface& iface,
126  IndexOutputInterface& output,
127  osgEarth::ElevationLayer* layer = 0) const;
128 
129 protected:
131  bool isTileEmpty() const;
132 
135  virtual void recomputePagedInData();
136 
139 
141  const osgEarth::TileKey myTileKey;
143  const osgEarth::GeoExtent myGeoExtent;
145  const bool myUseElevationFlag;
146 
148  boost::optional<ElevationRange> myElevationRange;
149 
154  {
157 
158  ValidElevationRange(const ElevationRange& range, bool coversTile)
159  : range(range), coversTile(coversTile) { }
160  };
161 
162  std::vector< boost::optional<ValidElevationRange> > myPreviousLayersElevationRange;
164 
166  bool myPinned;
167 
168  struct SubTileSlot
169  {
170  osgEarth::GeoExtent extent;
171  boost::scoped_ptr<TileSpatialIndex> subtile;
172  };
173 
175  SubTileSlot& getOrCreateSlot(unsigned i);
176 
178  void pageOutSlotIfUnused(unsigned i);
179 
181  SubTileSlot mySubTiles[4];
182 
184  boost::shared_ptr<DtTileData> myTileData;
185 
189 
192 
193 };
194 
bool myAllPagedInFlag
Will be set to true if all the data needed to satisify any request in this tile&#39;s extent is paged in...
Definition: tileSpatialIndex.h:188
NOTE: This entire class is deprecated, in favor of Dt3dChord.
Definition: chord.h:40
bool myPinned
Index cell not unloaded if true.
Definition: tileSpatialIndex.h:166
std::list< osgEarth::TileKey > DtTileKeyList
Definition: tileSpatialIndex.h:27
osgEarth::GeoExtent extent
Definition: tileSpatialIndex.h:170
Definition: tileSpatialIndex.h:33
const osgEarth::GeoExtent myGeoExtent
Extent of this index cell.
Definition: tileSpatialIndex.h:143
Definition: sphere.h:22
const bool myUseElevationFlag
Whether the min/max elevation should be used for this index cell.
Definition: tileSpatialIndex.h:145
const osgEarth::TileKey tileKey() const
Tilekey for this index cell.
Definition: tileSpatialIndex.h:109
const DtTerrainSourceTracker & myTracker
Definition: tileSpatialIndex.h:137
double min
Definition: tileSpatialIndex.h:42
Definition: tileSpatialIndex.h:168
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
boost::shared_ptr< DtTileData > myTileData
Elevation data for this tile.
Definition: tileSpatialIndex.h:184
ValidElevationRange(const ElevationRange &range, bool coversTile)
Definition: tileSpatialIndex.h:158
boost::optional< ElevationRange > myElevationRange
Elevation range for this tile, computed from highest resolution data (i.e. children) ...
Definition: tileSpatialIndex.h:148
ElevationRange range
Definition: tileSpatialIndex.h:155
Base class for Terrain Source trackers.
Definition: terrainSourceTracker.h:40
bool myMaxDataLevelFlag
True if we have determined that there is no higher resolution data in any subtiles.
Definition: tileSpatialIndex.h:191
bool coversTile
Definition: tileSpatialIndex.h:156
boost::scoped_ptr< TileSpatialIndex > subtile
Definition: tileSpatialIndex.h:171
std::vector< boost::optional< ValidElevationRange > > myPreviousLayersElevationRange
Definition: tileSpatialIndex.h:162
Definition: terrainSourceTracker.h:171
Definition: tileSpatialIndex.h:36
Generic interface for writing to index.
Definition: indexOutputInterface.h:16
Abstract base class for defining geometric areas for paging of terrain.
Definition: terrainPagingGeometry.h:22
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
const osgEarth::TileKey myTileKey
Tilekey for this index cell.
Definition: tileSpatialIndex.h:141
DT_DLL_vrfutil bool intersects(const DtVector &localPoint1, const DtVector &localPoint2, const DtLocalVertexList &localVertexList, const Coordinate_System &coordinateSystem)
Returns true if the line segment localPoint1-localPoint2 intersects.
Elevation range for previous layers.
Definition: tileSpatialIndex.h:153
class DtLocalVertexList:
Definition: localVertexList.h:20
Interface for allowing users to monitor/control the indexing process.
Definition: indexInterface.h:13
TileSpatialIndex * myParent
Definition: tileSpatialIndex.h:138
boost::ptr_vector< TileSpatialIndex > TileRoots
Definition: tileSpatialIndex.h:31

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)