VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
terrainInterface.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 
10 
11 #pragma once
12 
16 
17 #include "vrfutil/asyncJobServer.h"
19 
20 #include <boost/scoped_ptr.hpp>
21 
22 #include <features/feature.h>
23 #include <features/pathFeature.h>
24 #include <features/aStarGraph.h>
25 #include <features/areaFeature.h>
29 
30 #include <fstream>
31 
32 #include <boost/ptr_container/ptr_list.hpp>
33 
35 class DtTerrainImplementationDescriptor;
38 class DtConsoleCommand;
39 class DtGenericTerrainRecord;
41 class DtCallbackQueue;
43 
66 {
67 public:
69 
71  struct OceanLayer
72  {
75  bool present;
76  double seaLevel;
77  double defaultSeaDepth;
78  };
79 
80 public:
83 
85  virtual ~DtTerrainInterface();
86 
90  virtual bool init();
91 
93  virtual void setConfigFile(const std::string&, bool reload=true);
94 
96  virtual const DtTerrainInterfaceConfig& configOptions() const;
97 
99  virtual void tick();
100 
102  virtual bool isSameTerrain(const DtFilename&) const;
103 
106  virtual void addTerrainImplementation(const DtString& implementationName,
108 
110  virtual void addFeatureLayer(MAKVRinTerra::DtFeatureSet*);
111 
113  virtual bool loadTerrain(const DtString& filename);
114 
116  virtual bool unloadTerrain(bool block = true);
117 
118  virtual bool terrainIsLoaded();
121  virtual DtString loadedFilename() const;
122 
123  virtual const Coordinate_System* coordinateSystem() const;
124  virtual Coordinate_System* coordinateSystem();
125 
128  virtual std::auto_ptr<MAKVRinTerra::DtAreaFeatureSet> areas(
129  const std::string& type,
130  const boost::shared_ptr<DtCallbackQueue>& = boost::shared_ptr<DtCallbackQueue>()) const;
131 
134  virtual std::auto_ptr<MAKVRinTerra::DtAreaFeatureSet> areas(
136  const boost::shared_ptr<DtCallbackQueue>& = boost::shared_ptr<DtCallbackQueue>()) const;
137 
139  virtual std::auto_ptr<MAKVRinTerra::DtAreaFeatureSet> LOSfeatures() const;
140 
141  virtual std::auto_ptr<MAKVRinTerra::DtPathFeatureSet> paths(const std::string& type) const;
142 
145  virtual std::auto_ptr<MAKVRinTerra::DtFeatureSet> features(
146  const std::string& queryName) const;
147 
149  virtual std::auto_ptr<MAKVRinTerra::DtFeatureSet> allFeatures() const;
150 
153  virtual std::auto_ptr<MAKVRinTerra::DtFeatureSet> featuresRaw(
154  const std::string& queryName) const;
155 
157  virtual std::auto_ptr<MAKVRinTerra::DtFeatureSet> allFeaturesRaw() const;
158 
174  virtual double terrainHeightAboveSeaLevel(const DtPoint& databaseLocation,
175  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
176 
199  virtual bool terrainHeightAndIntersection(const DtVector& localLocation,
200  double& height, DtChordIntersectionRecord& record,
201  DtIntersectionRecord::DtIntersectionType irtFlag =
202  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
203  bool overrideBlockingAssert = false) const;
204 
207  virtual bool terrainHeightAndIntersectionBelow(const DtVector& localLocation,
208  double& height, DtChordIntersectionRecord& record,
209  DtIntersectionRecord::DtIntersectionType irtFlag =
210  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
211  bool overrideBlockingAssert = false) const;
212 
214 
215 
216 
217 
218 
219 
220 
221 
222 
223 
224 
225 
226 
227 
228 
229 
230 
231 
232 
233 
234 
235 
236 
237 
238 
239 
240 
241 
242 
243 
244 
245 
246 
247 
248 
249 
250 
251 
252 
253 
254 
255 
256 
257 
258 
259 
260 
261 
262 
263 
264 
265 
266 
267 
268 
269 
270 
271 
272 
273 
274 
275 
276 
277 
278 
279 
280 
281 
282 
283 
284 
285 
286 
287 
288 
289 
290 
291 
292 
293 
294 
295 
296 
297 
298 
299 
300 
301 
302 
303 
304 
305 
306 
307 
308 
309 
310 
311 
312 
313 
314 
315 
316 
317 
318 
319 
320 
321 
322 
323 
324 
325 
326 
327 
328 
329 
330 
331 
332 
333 
334 
335 
336 
337 
338 
339 
340  virtual bool terrainHeightUnderWater(const DtVector& databaseLocation,
341  double& groundHeight, DtSurface& groundSurface, DtVector& groundNormal,
342  double& waterHeight, DtSurface::DtMedium &topSurfaceMedium,
343  bool* dataAvailable = 0, bool overrideBlockingAssert = false) ;
344 
348  virtual bool terrainHeightUnderWaterDebug(const DtVector& databaseLocation,
349  double& groundHeight, DtSurface& groundSurface, DtVector& groundNormal,
350  double& waterHeight, DtSurface::DtMedium &topSurfaceMedium,
351  bool debug,
352  bool* dataAvailable =0, bool overrideBlockingAssert = false) ;
354 
395  virtual bool closestIntersection(const DtVector& localLocation,
396  DtPoint& intersectionPoint, bool* dataAvailable = 0,
397  bool overrideBlockingAssert = false) const;
398 
419  virtual bool closestIntersection(double lat, double lon,
420  DtPoint& intersectionPoint, bool* dataAvailable = 0,
421  bool overrideBlockingAssert = false) const;
422 
446  virtual bool closestIntersection(const DtVector& localLocation,
447  DtChordIntersectionRecord& record,
448  DtIntersectionRecord::DtIntersectionType irtFlag =
449  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
450  bool overrideBlockingAssert = false) const;
451 
475  virtual bool closestIntersection(double lat, double lon,
476  DtChordIntersectionRecord& record,
477  DtIntersectionRecord::DtIntersectionType irtFlag =
478  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
479  bool overrideBlockingAssert = false) const;
480 
507  virtual bool closestIntersection(const std::list<DtVector>& localLocationList,
508  DtChordIntersectRecordList& recordList, int& numIntersections,
509  DtIntersectionRecord::DtIntersectionType irtFlag =
510  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
511  bool overrideBlockingAssert = false) const;
512 
539  virtual bool intersect(const DtChord& chord, DtPoint& intersectionPoint,
540  double& intersectionTime, bool* dataAvailable = 0,
541  bool overrideBlockingAssert = false) const;
542 
568  virtual bool intersect(const DtChord& chord,
569  DtChordIntersectionRecord& record,
570  DtIntersectionRecord::DtIntersectionType irtFlag =
571  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
572  bool overrideBlockingAssert = false) const;
573 
599  virtual bool allIntersectsAlongChord(const DtChord& chord,
600  DtChordIntersectRecordList& intList,
601  DtIntersectionRecord::DtIntersectionType irtFlag =
602  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
603  bool overrideBlockingAssert = false) const;
604 
608  virtual bool allIntersectsAlongChordDebug(const DtChord& chord,
609  DtChordIntersectRecordList& intList,
610  bool* dataAvailable = 0,
611  bool overrideBlockingAssert = false) const;
612 
643  virtual bool intersectList(const std::list<DtChord>& chordList,
644  DtChordIntersectRecordList& recordList, int& numTerrainIntersections,
645  DtIntersectionRecord::DtIntersectionType irtFlag =
646  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
647  bool overrideBlockingAssert = false) const;
648 
663  virtual void preloadTerrainAreas(
664  const DtTerrainPagingGeometryList& preloadGeometry);
665 
671  virtual void forceLoadTerrainAreas(
672  const DtTerrainPagingGeometryList& forceLoadGeometry);
673 
679  virtual const DtTerrainCapabilities* terrainCapabilities() const;
680 
684  virtual bool addTerrainPassThroughLayer(const DtString& layerType);
685 
695  virtual void setAssertOnBlockingTerrainCalls(bool assertBlock);
696  virtual bool assertOnBlockingTerrainCalls() const;
698 
703  virtual void setIntersectDataLoadExpireTime(const double& expireTime);
704  virtual void expireDataLoadRequestsBeforeTime(const double& currentTime);
705 
713  virtual void trianglesInArea(DtTriangleCallbackFcn func,
714  DtTriangleCallbackFinalizeFcn finalize, DtTerrainProcessPolygonsBox& box, void* usr) const;
715 
719  virtual boost::shared_ptr<DtAsyncJobMapEntry> makePathAsync(
720  const DtPoint& localStart,
721  const DtPoint& localDestination,
722  const std::string& type,
723  const double& maxSearchRadius,
724  const double& startProximityThreshold,
725  const DtAStarGraph::DtWeightFactorsList& weightFactors
727 
741  virtual DtAStarGraph::Path makePath(
742  const DtPoint& localStart,
743  const DtPoint& localDestination,
744  const std::string& type,
745  const double& maxSearchRadius,
746  const double& startProximityThreshold,
747  boost::function<bool ()> cancelCheck,
748  const DtAStarGraph::DtWeightFactorsList& weightFactors
750 
753  virtual bool onPathFeature(
754  const DtPoint& location, const DtString& type, double buffer = 0.5);
755 
757  virtual DtAStarGraph::Ptr pathFinder(const std::string&) const;
758 
762  virtual boost::shared_ptr<DtAsyncJobMapEntry> addAsyncJob(DtAsyncJob* job);
763 
765  MAKVRinTerra::DtProj::CPtr localProj() const;
766 
767  MAKVRinTerra::DtFeaturesDebugger& debugger() const;
768 
769  MAKVRinTerra::DtQuery findQuery(const std::string& name) const;
770 
771  const double topoDistance(const DtPoint& start, const DtPoint& end,
772  const MAKVRinTerra::DtProj& localProj);
773 
783  MAKVRinTerra::DtClosestPathFeatureFinder closestFeatureOnNetwork(
784  const std::string& type, const DtPoint& startingLocation,
785  const double& searchRadius, bool* dataAvailable = NULL);
786 
787  void breakUpChord(const MAKVRinTerra::DtProj&, const DtChord& chord,
788  std::vector<DtChord>& chords) const;
789 
790  void breakUpChord(const DtChord& chord, std::vector<DtChord>& chords) const;
791 
792 protected:
793 
804  virtual bool nonPolygonalWaterHeight(const DtVector& localLocation,
805  double& height) const;
806 
810  virtual double defaultWaterDepth(const DtVector& localLocation) const;
811 
814  virtual double defaultSurfaceElevation(const DtVector& localLocation) const;
815 
831  virtual DtSurface::DtMedium mediumForUnspecPolygonsUnderWater() const;
832 
844  virtual double landAboveWaterMinimumSeparation() const;
845 
848  void insertNonPolyWaterIntoIntersectionList(
849  DtChordIntersectionRecord& waterInterx,
850  DtChordIntersectRecordList& intrxList) const;
851 
859  virtual DtChordIntersectionRecord blankSurfaceIntersectionRecord(
860  const DtVector& localLocation, const double height) const;
861 
866  virtual bool nonPolygonalWaterIntersect(const DtChord& chord,
867  DtChordIntersectionRecord& waterInterxRecord) const;
868 
869 protected:
876 
877  typedef boost::ptr_list<MAKVRinTerra::DtFeatureSet> FeatureSetList;
879 
881 
885 
891 
893 
896 
898 
900 
903 
905 
906  std::ofstream myDebugOutputFile;
907  tbb::tick_count myLastDebugOutputTick;
908 };
909 
910 #define DtRegisterTerrainImplementationFunctionName "DtRegisterTerrainImplementation"
911 
915 
916 
917 #define DtDeregisterTerrainImplementationFunctionName "DtDeregisterTerrainImplementation"
918 

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)