28 #include <osgTerrain/TerrainTile>
29 #include <osgEarth/Profile>
30 #include <osgEarth/TileKey>
31 #include <osgEarth/MapNode>
32 #include <osgEarth/TerrainTileModel>
38 #include <boost/ptr_container/ptr_vector.hpp>
40 #include <tbb/spin_rw_mutex.h>
46 class DtGeodeticCoord;
72 explicit Extent(
const osgEarth::TileKey&);
81 typedef std::vector<IndexExtent>
Vector;
85 unsigned minx,
miny, maxx, maxy;
91 const osgEarth::TileKey& key);
116 virtual bool insideValidArea(
const DtPoint& p)
const;
124 virtual bool extentInsideValidArea(
unsigned x1,
unsigned y1,
unsigned x2,
unsigned y2)
const;
131 virtual bool extentOutsideValidArea(
unsigned x1,
unsigned y1,
unsigned x2,
unsigned y2)
const;
138 virtual bool addActiveTileKey(
const osgEarth::TileKey& key) = 0;
145 virtual void recomputeActiveTileKeyAreas() = 0;
155 virtual std::string description()
const = 0;
158 virtual unsigned numberOfVertices()
const = 0;
163 virtual unsigned numberOfTrianglesForVertices()
const;
166 virtual void getTriangleVertices(
unsigned xindex,
unsigned yindex,
double& x,
double& y)
const = 0;
169 virtual void getTriangleIndices(
double x,
double y,
unsigned& xindex,
unsigned& yindex)
const = 0;
173 virtual void heightfieldIndexForTriangleIndex(
174 unsigned triangleXIndex,
unsigned triangleYIndex,
175 unsigned& heightFieldXUsed,
unsigned& heightFieldYUsed)
const = 0;
178 virtual double interpolateHeight(
179 unsigned triangleXIndex,
unsigned triangleYIndex,
180 unsigned* heightFieldXUsed = 0,
unsigned* heightFieldYUsed = 0)
const = 0;
202 virtual bool findIntersections(
204 unsigned x1,
unsigned y1,
unsigned x2,
unsigned y2,
206 bool singleCell =
false,
207 bool insideValidAreaChecked =
false)
const;
211 virtual bool findIntersections(
221 virtual void findTriangles(
223 unsigned x1,
unsigned y1,
unsigned x2,
unsigned y2,
225 bool singleCell =
false,
226 bool insideValidAreaChecked =
false)
const;
230 virtual void findTriangles(
250 osgEarth::MapNode* mapNode);
255 virtual bool useRawElevation()
const;
259 virtual unsigned getMaxLOD()
const;
260 virtual void setMaxLOD(
unsigned);
269 virtual double triangleOutputMergeTolerance()
const;
270 virtual void setTriangleOutputMergeTolerance(
double tol);
271 virtual double intersetionTriangleMergeTolerance()
const;
272 virtual void setIntersectionTriangleMergeTolerance(
double tol);
276 virtual unsigned tileCount()
const;
279 virtual unsigned cellCount()
const;
284 virtual void addPagedInTile(
285 const osgEarth::TileKey& tilekey,
286 const boost::shared_ptr<DtTileData>& tileData);
289 virtual void removePagedInTile(
const osgEarth::TileKey tileKey);
300 virtual bool findHeightFieldIntersections(
303 bool* dataAvailable = 0)
const;
305 virtual void processTriangles(
334 virtual void drawElevation();
341 virtual osgEarth::TileKey getBestTileKey(
const osgEarth::TileKey&)
const;
366 bool chordIntersects(
const DtChord& chord)
const;
367 bool extentIntersects(
const DtExtent& extent)
const;
368 bool sphereIntersects(
const DtSphere& sphere)
const;
370 bool chordIntersectsSubTile(
const DtChord& chord,
int i)
const;
371 bool extentIntersectsSubTile(
const DtExtent& shape,
int i)
const;
372 bool sphereIntersectsSubTile(
const DtSphere& sphere,
int i)
const;
381 std::vector< boost::shared_ptr<DtTileData> >& data)
const;
383 boost::shared_ptr<DtTileData> findOldest()
const;
385 bool addTile(
const osgEarth::TileKey& key,
const boost::shared_ptr<DtTileData>& data);
386 void removeTile(
const osgEarth::TileKey& tilekey);
387 unsigned tileCount()
const;
388 unsigned cellCount()
const;
390 const osgEarth::TileKey
tileKey()
const {
return myTileKey; }
394 void getSubTileExtent(
unsigned i,
DtVector& lower,
DtVector& upper,
bool useElevation =
true)
const;
397 bool isTileEmpty()
const;
401 virtual void recomputePagedInData();
429 virtual void convertGeometry(
431 std::vector<DtTerrainPagingGeometryPtr>& output)
const;
433 virtual bool convertGeometry(
435 std::vector<DtTerrainPagingGeometryPtr>& output)
const;
437 virtual bool convertGeometry(
439 std::vector<DtTerrainPagingGeometryPtr>& output)
const;
441 virtual bool convertGeometry(
443 std::vector<DtTerrainPagingGeometryPtr>& output)
const;
445 virtual bool nearCenterOfEarth(
const DtChord& chord)
const;
447 virtual bool findData(
449 std::vector< boost::shared_ptr<DtTileData> >& data,
452 virtual void findMissing(
456 virtual boost::shared_ptr<DtTileData> findOldest()
const;
457 virtual boost::shared_ptr<DtTileData> findOldestUnlocked()
const;