VR-Forces 4.2 Class Documentation
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>
24 #include <features/pathFeature.h>
25 #include <features/pathFinder.h>
30 
32 class DtTerrainImplementationDescriptor;
35 class DtConsoleCommand;
36 class DtGenericTerrainRecord;
39 
64 {
65 public:
66  typedef std::map<std::string, std::string> TerrainSettings;
68 
70  struct OceanLayer
71  {
74  bool present;
75  double seaLevel;
76  double defaultSeaDepth;
77  };
78 
79 public:
82 
84  virtual ~DtTerrainInterface();
85 
89  virtual bool init();
90 
92  virtual void tick();
93 
95  virtual bool isSameTerrain(const DtFilename&) const;
96 
99  virtual void addTerrainImplementation(const DtString& implementationName,
101 
103  virtual bool loadTerrain(const DtString& filename, const TerrainSettings& settings = TerrainSettings());
104 
106  virtual bool loadTerrain(const DtString& filename,
107  MAKVRinTerra::DtFeatureLoader& featureLoader, const TerrainSettings& settings = TerrainSettings());
108 
109  virtual bool unloadTerrain();
110  virtual bool terrainIsLoaded();
113  virtual DtString loadedFilename() const;
114 
115  virtual const Coordinate_System* coordinateSystem() const;
116  virtual Coordinate_System* coordinateSystem();
117 
120  virtual std::auto_ptr<MAKVRinTerra::DtObstacleFeatureSet> obstacles(const std::string& type) const;
121 
124  virtual std::auto_ptr<MAKVRinTerra::DtObstacleFeatureSet> obstacles(
126 
127  virtual std::auto_ptr<MAKVRinTerra::DtPathFeatureSet> paths(const std::string& type) const;
128 
129  virtual std::auto_ptr<MAKVRinTerra::DtFeatureSet> allFeatures(
130  const std::string& type = std::string(), bool readDirectly = false) const;
131 
148  virtual double terrainHeightAboveSeaLevel(const DtPoint& databaseLocation,
149  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
150 
174  virtual bool terrainHeightAndIntersection(const DtVector& localLocation,
175  double& height, DtChordIntersectionRecord& record,
176  DtIntersectionRecord::DtIntersectionType irtFlag =
177  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
178  bool overrideBlockingAssert = false) const;
179 
181 
182 
183 
184 
185 
186 
187 
188 
189 
190 
191 
192 
193 
194 
195 
196 
197 
198 
199 
200 
201 
202 
203 
204 
205 
206 
207 
208 
209 
210 
211 
212 
213 
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  virtual bool terrainHeightUnderWater(const DtVector& databaseLocation,
265  double& groundHeight, DtSurface& groundSurface, DtVector& groundNormal,
266  double& waterHeight, DtSurface::DtMedium &topSurfaceMedium,
267  bool* dataAvailable = 0, bool overrideBlockingAssert = false) ;
268 
272  virtual bool terrainHeightUnderWaterDebug(const DtVector& databaseLocation,
273  double& groundHeight, DtSurface& groundSurface, DtVector& groundNormal,
274  double& waterHeight, DtSurface::DtMedium &topSurfaceMedium,
275  bool debug,
276  bool* dataAvailable =0, bool overrideBlockingAssert = false) ;
278 
320  virtual bool closestIntersection(const DtVector& localLocation,
321  DtPoint& intersectionPoint, bool* dataAvailable = 0,
322  bool overrideBlockingAssert = false) const;
323 
345  virtual bool closestIntersection(double lat, double lon,
346  DtPoint& intersectionPoint, bool* dataAvailable = 0,
347  bool overrideBlockingAssert = false) const;
348 
373  virtual bool closestIntersection(const DtVector& localLocation,
374  DtChordIntersectionRecord& record,
375  DtIntersectionRecord::DtIntersectionType irtFlag =
376  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
377  bool overrideBlockingAssert = false) const;
378 
403  virtual bool closestIntersection(double lat, double lon,
404  DtChordIntersectionRecord& record,
405  DtIntersectionRecord::DtIntersectionType irtFlag =
406  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
407  bool overrideBlockingAssert = false) const;
408 
436  virtual bool closestIntersection(const std::list<DtVector>& localLocationList,
437  DtChordIntersectRecordList& recordList, int& numIntersections,
438  DtIntersectionRecord::DtIntersectionType irtFlag =
439  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
440  bool overrideBlockingAssert = false) const;
441 
469  virtual bool intersect(const DtChord& chord, DtPoint& intersectionPoint,
470  double& intersectionTime, bool* dataAvailable = 0,
471  bool overrideBlockingAssert = false) const;
472 
499  virtual bool intersect(const DtChord& chord,
500  DtChordIntersectionRecord& record,
501  DtIntersectionRecord::DtIntersectionType irtFlag =
502  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
503  bool overrideBlockingAssert = false) const;
504 
528  virtual bool intersect(const DtSphere& sphere,
529  DtSphereIntersectionRecord& record,
530  DtIntersectionRecord::DtIntersectionType irtFlag =
531  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
532  bool overrideBlockingAssert = false) const;
533 
560  virtual bool allIntersectsAlongChord(const DtChord& chord,
561  DtChordIntersectRecordList& intList,
562  DtIntersectionRecord::DtIntersectionType irtFlag =
563  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
564  bool overrideBlockingAssert = false) const;
565 
569  virtual bool allIntersectsAlongChordDebug(const DtChord& chord,
570  DtChordIntersectRecordList& intList,
571  bool* dataAvailable = 0,
572  bool overrideBlockingAssert = false) const;
573 
605  virtual bool intersectList(const std::list<DtChord>& chordList,
606  DtChordIntersectRecordList& recordList, int& numTerrainIntersections,
607  DtIntersectionRecord::DtIntersectionType irtFlag =
608  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
609  bool overrideBlockingAssert = false) const;
610 
625  virtual void preloadTerrainAreas(
626  const DtTerrainPagingGeometryList& preloadGeometry);
627 
633  virtual const DtTerrainCapabilities* terrainCapabilities() const;
634 
638  virtual bool addTerrainPassThroughLayer(const DtString& layerType);
639 
649  virtual void setAssertOnBlockingTerrainCalls(bool assertBlock);
650  virtual bool assertOnBlockingTerrainCalls() const;
652 
657  virtual void setIntersectDataLoadExpireTime(const double& expireTime);
658  virtual void expireDataLoadRequestsBeforeTime(const double& currentTime);
659 
663  virtual void setDataPath(const std::string&);
664  virtual std::string dataPath() const;
665 
669  virtual void setUserDataPath(const std::string&);
670  virtual std::string userDataPath() const;
671 
679  virtual void trianglesInArea(DtTriangleCallbackFcn func,
680  DtTriangleCallbackFinalizeFcn finalize, DtTerrainProcessPolygonsBox& box, void* usr) const;
681 
682  static void setModelDefinitionFilePath(const DtString& fullFilePath);
683  static DtString modelDefinitionFilePath();
684 
688  virtual boost::shared_ptr<DtAsyncJobMapEntry> makePathAsync(const DtPoint& localStart,
689  const DtPoint& localDestination, const std::string& type,
690  const double& maxSearchRadius, const double& startProximityThreshold,
691  DtPathFinder::DtWeightFactorsListPtr weightFactors =
693 
696  virtual bool onPathFeature(
697  const DtPoint& location, const DtString& type, double buffer = 0.5);
698 
702  virtual boost::shared_ptr<DtAsyncJobMapEntry> addAsyncJob(DtAsyncJob* job);
703 
705  MAKVRinTerra::DtProj::CPtr localProj() const;
706 
707  MAKVRinTerra::DtFeaturesDebugger& debugger() const;
708 
709  MAKVRinTerra::DtQuery findQuery(const std::string& name) const;
710 
711  const double topoDistance(const DtPoint& start, const DtPoint& end,
712  const MAKVRinTerra::DtProj& localProj);
713 
723  MAKVRinTerra::DtClosestPathFeatureFinder closestFeatureOnNetwork(
724  const std::string& type, const DtPoint& startingLocation,
725  const double& searchRadius, bool* dataAvailable = NULL);
726 
727  void breakUpChord(const MAKVRinTerra::DtProj&, const DtChord& chord,
728  std::vector<DtChord>& chords) const;
729 
730  void breakUpChord(const DtChord& chord, std::vector<DtChord>& chords) const;
731 
732  virtual boost::shared_ptr<DtTerrainInterfaceConfig> config() const;
733 
734 protected:
735 
746  virtual bool nonPolygonalWaterHeight(const DtVector& localLocation,
747  double& height) const;
748 
752  virtual double defaultWaterDepth(const DtVector& localLocation) const;
753 
756  virtual double defaultSurfaceElevation(const DtVector& localLocation) const;
757 
773  virtual DtSurface::DtMedium mediumForUnspecPolygonsUnderWater() const;
774 
786  virtual double landAboveWaterMinimumSeparation() const;
787 
790  void insertNonPolyWaterIntoIntersectionList(
791  DtChordIntersectionRecord& waterInterx,
792  DtChordIntersectRecordList& intrxList) const;
793 
801  virtual DtChordIntersectionRecord blankSurfaceIntersectionRecord(
802  const DtVector& localLocation, const double height) const;
803 
808  virtual bool nonPolygonalWaterIntersect(const DtChord& chord,
809  DtChordIntersectionRecord& waterInterxRecord) const;
810 
823  virtual DtPathFinder::Path makePath(
824  const DtPoint& localStart, const DtPoint& localDestination,
825  const std::string& type, const double& maxSearchRadius,
826  const double& startProximityThreshold,
827  boost::function<bool ()> cancelCheck,
828  DtPathFinder::ReturnCode& result,
829  DtPathFinder::DtWeightFactorsListPtr weightFactors =
831 
832  virtual void loadConfigurationFile(const DtFilename& filename);
833 
834 protected:
835 
837 
841 
844  std::list<DtConsoleCommand*> myCommandList;
848 
851 
853 
856 
857  boost::scoped_ptr<MAKVRinTerra::DtFeatureContext> myFeatureContext;
858 
860 
863 
864  boost::shared_ptr<DtTerrainInterfaceConfig> myConfig;
865  DtFilename myConfigFilename;
867 };
868 
869 #define DtRegisterTerrainImplementationFunctionName "DtRegisterTerrainImplementation"
870 

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)