VR-Forces Development_Version 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"
20 
21 #include <features/feature.h>
22 #include <features/pathFeature.h>
23 #include <features/aStarGraph.h>
24 #include <features/areaFeature.h>
28 
29 #include <fstream>
30 
31 #include <boost/scoped_ptr.hpp>
32 #include <boost/ptr_container/ptr_list.hpp>
33 
35 class DtTerrainImplementationDescriptor;
39 class DtCallbackQueue;
41 class Dt3dBoundingVolume;
42 
43 namespace makArchives
44 {
45  class DtTerrainRecord;
46  class DtGenericTerrainRecord;
47 }
48 
50  makArchives::DtGenericTerrainRecord* record, void* userData);
51 
53 
76 {
77 public:
79  {
80  VrfSimulationBackEnd = 1,
81  NavGenerationTool = 2
82  };
83 
85 
87  struct OceanLayer
88  {
91  bool present;
92  double seaLevel;
93  double defaultSeaDepth;
94  };
95 
96 public:
99 
101  virtual ~DtTerrainInterface();
102 
106  virtual bool init(bool createConsoleManager = true);
107 
109  virtual void setConfigFile(const std::string&, bool reload=true);
110 
112  virtual const DtTerrainInterfaceConfig& configOptions() const;
113 
115  virtual void tick();
116 
118  virtual bool isSameTerrain(const DtFilename&) const;
119 
121  virtual bool isHighFidelityTerrain() const;
122 
124  DtTerrainImplementation* terrainImplementation() const
125  {
126  return myTerrainImpl;
127  }
128 
131  virtual void addTerrainImplementation(const DtString& implementationName,
133 
135  virtual void addFeatureLayer(MAKVRinTerra::DtFeatureSet*);
136  virtual void addFeatureLayer(boost::shared_ptr<MAKVRinTerra::DtFeatureSet>);
137 
138  virtual void addGenericTerrainRecordCallback(
139  const DtString& recordType,
141  void* user);
142 
143  virtual void removeGenericTerrainRecordCallback(
144  const DtString& recordType,
146  void* user);
147 
148  virtual void invokeGenericTerrainRecordCallbacks(
150 
152  virtual bool loadTerrain(const DtString& filename, LoadContext context = VrfSimulationBackEnd);
153 
155  virtual bool unloadTerrain(bool block = true);
156 
160  virtual bool loadModel(const DtFilename& f, const DtEntityType& t = DtEntityType());
161 
164  virtual double modelHeightDifferencesFromAppearances(int oldApp, int newApp) const;
165 
167  virtual bool createFromExtent(const Dt3dBoundingVolume&);
168 
170  virtual bool terrainIsLoaded();
173  virtual DtString loadedFilename() const;
174 
175  virtual const Coordinate_System* coordinateSystem() const;
176  virtual Coordinate_System* coordinateSystem();
177 
180  virtual std::auto_ptr<MAKVRinTerra::DtAreaFeatureSet> areas(
181  const std::string& type,
182  const boost::shared_ptr<DtCallbackQueue>& = boost::shared_ptr<DtCallbackQueue>()) const;
183 
186  virtual std::auto_ptr<MAKVRinTerra::DtAreaFeatureSet> areas(
188  const boost::shared_ptr<DtCallbackQueue>& = boost::shared_ptr<DtCallbackQueue>()) const;
189 
191  virtual std::auto_ptr<MAKVRinTerra::DtAreaFeatureSet> LOSfeatures() const;
192 
193  virtual std::auto_ptr<MAKVRinTerra::DtPathFeatureSet> paths(const std::string& type) const;
194 
197  virtual std::auto_ptr<MAKVRinTerra::DtFeatureSet> features(
198  const std::string& queryName) const;
199 
201  virtual std::auto_ptr<MAKVRinTerra::DtFeatureSet> allFeatures() const;
202 
205  virtual std::auto_ptr<MAKVRinTerra::DtFeatureSet> featuresRaw(
206  const std::string& queryName) const;
207 
209  virtual std::auto_ptr<MAKVRinTerra::DtFeatureSet> allFeaturesRaw() const;
210 
227  virtual double terrainHeightAboveSeaLevel(const DtPoint& databaseLocation,
228  bool* dataAvailable = 0, bool overrideBlockingAssert = false, int flags = 0) const;
229 
253  virtual bool terrainHeightAndIntersection(const DtVector& localLocation,
254  double& height, DtChordIntersectionRecord& record,
256  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
257  bool overrideBlockingAssert = false, int flags = 0) const;
258 
261  virtual bool terrainHeightAndIntersectionBelow(const DtVector& localLocation,
262  double& height, DtChordIntersectionRecord& record,
264  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
265  bool overrideBlockingAssert = false, int flags = 0) const;
266 
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 
341 
342 
343 
344 
345 
346 
347 
348 
349 
350 
351 
352 
353 
354 
355 
356 
357 
358 
359 
360 
361 
362 
363 
364 
365 
366 
367 
368 
369 
370 
371 
372 
373 
374 
375 
376 
377 
378 
379 
380 
381 
382 
383 
384 
385 
386 
387 
388 
389 
390 
391 
392 
393 
394 
395  virtual bool terrainHeightUnderWater(const DtVector& databaseLocation,
396  double& groundHeight, DtSurface& groundSurface, DtVector& groundNormal,
397  double& waterHeight, DtSurface::DtMedium &topSurfaceMedium,
398  bool* dataAvailable = 0, bool overrideBlockingAssert = false, int flags = 0) ;
399 
403  virtual bool terrainHeightUnderWaterDebug(const DtVector& databaseLocation,
404  double& groundHeight, DtSurface& groundSurface, DtVector& groundNormal,
405  double& waterHeight, DtSurface::DtMedium &topSurfaceMedium,
406  bool debug,
407  bool* dataAvailable =0, bool overrideBlockingAssert = false, int flags = 0) ;
409 
453  virtual bool closestIntersection(const DtVector& localLocation,
454  DtPoint& intersectionPoint, bool* dataAvailable = 0,
455  bool overrideBlockingAssert = false, bool doNotAddDefaultRecord = false, int flags = 0) const;
456 
477  virtual bool closestIntersection(double lat, double lon,
478  DtPoint& intersectionPoint, bool* dataAvailable = 0,
479  bool overrideBlockingAssert = false, bool doNotAddDefaultRecord = false, int flags = 0) const;
480 
507  virtual bool closestIntersection(const DtVector& localLocation,
510  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
511  bool overrideBlockingAssert = false, bool doNotAddDefaultRecord = false, int flags = 0) const;
512 
539  virtual bool closestIntersection(double lat, double lon,
542  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
543  bool overrideBlockingAssert = false, bool doNotAddDefaultRecord = false, int flags = 0) const;
544 
574  virtual bool closestIntersection(const std::list<DtVector>& localLocationList,
575  DtChordIntersectRecordList& recordList, int& numIntersections,
577  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
578  bool overrideBlockingAssert = false, bool doNotAddDefaultRecord = false, int flags = 0) const;
579 
607  virtual bool intersect(const DtChord& chord, DtPoint& intersectionPoint,
608  double& intersectionTime, bool* dataAvailable = 0,
609  bool overrideBlockingAssert = false, int flags = 0) const;
610 
642  virtual bool intersect(const DtChord& chord,
645  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
646  bool overrideBlockingAssert = false, int flags = 0) const;
647 
674  virtual bool allIntersectsAlongChord(const DtChord& chord,
677  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
678  bool overrideBlockingAssert = false, int flags = 0) const;
679 
683  virtual bool allIntersectsAlongChordDebug(const DtChord& chord,
685  bool* dataAvailable = 0,
686  bool overrideBlockingAssert = false, int flags = 0) const;
687 
719  virtual bool intersectList(const std::list<DtChord>& chordList,
720  DtChordIntersectRecordList& recordList, int& numTerrainIntersections,
722  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
723  bool overrideBlockingAssert = false, int flags = 0) const;
724 
739  virtual void preloadTerrainAreas(
740  const DtTerrainPagingGeometryList& preloadGeometry);
741 
747  virtual void forceLoadTerrainAreas(
748  const DtTerrainPagingGeometryList& forceLoadGeometry);
749 
755  virtual const DtTerrainCapabilities* terrainCapabilities() const;
756 
760  virtual bool addTerrainPassThroughLayer(const DtString& layerType);
761 
771  virtual void setAssertOnBlockingTerrainCalls(bool assertBlock);
772  virtual bool assertOnBlockingTerrainCalls() const;
774 
777  virtual void setWarnOnBlockingTerrainCalls(bool warnBlock);
778  virtual bool warnOnBlockingTerrainCalls() const;
780 
785  virtual void setIntersectDataLoadExpireTime(const double& expireTime);
786  virtual void expireDataLoadRequestsBeforeTime(const double& currentTime);
787 
798  virtual void trianglesInArea(DtTriangleCallbackFcn func,
799  DtTriangleCallbackFinalizeFcn finalize, DtTerrainProcessPolygonsBox& box, void* usr) const;
800 
804  virtual boost::shared_ptr<DtAsyncJobMapEntry> makePathAsync(
805  const DtPoint& localStart,
806  const DtPoint& localDestination,
807  const std::string& type,
808  const double& maxSearchRadius,
809  const double& startProximityThreshold,
810  const DtAStarGraph::DtWeightFactorsList& weightFactors
811  = DtAStarGraph::DtWeightFactorsList());
812 
826  virtual DtAStarGraph::Path makePath(
827  const DtPoint& localStart,
828  const DtPoint& localDestination,
829  const std::string& type,
830  const double& maxSearchRadius,
831  const double& startProximityThreshold,
832  boost::function<bool ()> cancelCheck,
833  const DtAStarGraph::DtWeightFactorsList& weightFactors
834  = DtAStarGraph::DtWeightFactorsList()) const;
835 
838  virtual bool onPathFeature(
839  const DtPoint& location, const DtString& type, double buffer = 0.5);
840 
842  virtual DtAStarGraph::Ptr pathFinder(const std::string&) const;
843 
847  virtual boost::shared_ptr<DtAsyncJobMapEntry> addAsyncJob(DtAsyncJob* job);
848 
850  MAKVRinTerra::DtProj::CPtr localProj() const;
851 
852  MAKVRinTerra::DtFeaturesDebugger& debugger() const;
853 
854  MAKVRinTerra::DtQuery findQuery(const std::string& name) const;
855 
856  const double topoDistance(const DtPoint& start, const DtPoint& end,
857  const MAKVRinTerra::DtProj& localProj);
858 
868  MAKVRinTerra::DtClosestPathFeatureFinder closestFeatureOnNetwork(
869  const std::string& type, const DtPoint& startingLocation,
870  const double& searchRadius, bool* dataAvailable = NULL);
871 
872  void breakUpChord(const MAKVRinTerra::DtProj&, const DtChord& chord,
873  std::vector<DtChord>& chords) const;
874 
875  void breakUpChord(const DtChord& chord, std::vector<DtChord>& chords) const;
876 
877 protected:
878 
889  virtual bool nonPolygonalWaterHeight(const DtVector& localLocation,
890  double& height) const;
891 
895  virtual double defaultWaterDepth(const DtVector& localLocation) const;
896 
899  virtual double defaultSurfaceElevation(const DtVector& localLocation) const;
900 
916  virtual DtSurface::DtMedium mediumForUnspecPolygonsUnderWater() const;
917 
929  virtual double landAboveWaterMinimumSeparation() const;
930 
933  void insertNonPolyWaterIntoIntersectionList(
934  DtChordIntersectionRecord& waterInterx,
935  DtChordIntersectRecordList& intrxList) const;
936 
944  virtual DtChordIntersectionRecord blankSurfaceIntersectionRecord(
945  const DtVector& localLocation, const double height) const;
946 
951  virtual bool nonPolygonalWaterIntersect(const DtChord& chord,
952  DtChordIntersectionRecord& waterInterxRecord) const;
953 
954 protected:
961 
962  typedef boost::ptr_list<MAKVRinTerra::DtFeatureSet> FeatureSetList;
964 
966 
970 
976 
978 
981 
983 
985 
988 
990 
991  std::ofstream myDebugOutputFile;
992  tbb::tick_count myLastDebugOutputTick;
993 
995 
997 
998  typedef std::map<DtString, DtGenericTerrainRecordCallbackList>
1001 };
1002 
1003 #define DtRegisterTerrainImplementationFunctionName "DtRegisterTerrainImplementation"
1004 
1008 
1009 
1010 #define DtDeregisterTerrainImplementationFunctionName "DtDeregisterTerrainImplementation"
1011 

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)