VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
attachedTerrain.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
15 
18 #include "vrfobjcore/simObject.h"
19 #include <readerWriter/rwInt.h>
20 #include <readerWriter/rwString.h>
21 #include <readerWriter/rwBoolean.h>
23 #include <matrix/vlDcm.h>
25 #include <geometry/point.h>
26 #include <geometry/chord.h>
27 #include <matrix/topoCoord.h>
28 #include <matrix/geodeticCoord.h>
29 #include <matrix/coordTransform.h>
30 #include <matrix/3dBoundingVolume.h>
31 #include <tbb/spin_rw_mutex.h>
32 
33 #include <boost/shared_ptr.hpp>
34 #include <boost/optional.hpp>
35 
36 class DtTerrainInterface;
37 class DtPhysicalWorld;
40 class DtSurface;
41 class Coordinate_System;
42 class DtSimObject;
44 
46 {
47 private:
49 
50 public:
51 
53  DtAttachedTerrain(const DtSimulationServices*, const DtString& name,
54  DtReaderWriterRegistry* const parentRegistry = 0, const DtSimObject* owner = 0);
55 
57  DtReaderWriterRegistry* const parentRegistry = 0, const DtSimObject* owner = 0);
58 
60  DtAttachedTerrain(const DtString& name, const DtAttachedTerrain& orig,
61  DtReaderWriterRegistry* const parentRegistry = 0);
62 
64  from, DtReaderWriterRegistry* const parentRegistry = 0);
65 
67  virtual ~DtAttachedTerrain();
68 
71 
75  virtual const char* readerWriterType() const;
76 
77 
78 public:
79  virtual const Coordinate_System* coordinateSystem() const;
80 
81  const DtSimObject* vrfObject() const;
82 
85  virtual void tick();
86 
88  virtual bool isHighFidelityTerrain() const;
89 
90  virtual bool skipThisObject() const;
91 
93  virtual void setStayAttachedEvenIfOff(bool);
94  virtual bool stayAttachedEvenIfOff() const;
95 
96  void setFallThroughToPhysicalWorld(bool val);
97  bool fallThroughToPhysicalWorld() const;
98 
99  virtual double terrainHeight(const DtVector& localLocation,
100  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
101  virtual bool terrainHeight(const DtVector& localLocation,
102  double& terrainHeight, bool* dataAvailable = 0,
103  bool overrideBlockingAssert = false) const;
104 
105  virtual bool terrainHeightAndSurface(double lat, double lon,
106  double& terrainHeight, DtSurface& surface, bool* dataAvailable = 0,
107  bool overrideBlockingAssert = false) const;
108 
109  virtual bool terrainHeightAndSurface(const DtVector& localLocation,
110  double& terrainHeight, DtSurface& surface, bool* dataAvailable = 0,
111  bool overrideBlockingAssert = false) const;
112 
113 
114  virtual bool closestIntersection(const DtVector& localLocation,
115  DtPoint& intersectionPoint,
116  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
117 
118  virtual bool closestIntersection(const DtVector& localLocation,
119  DtVector& intersectionPoint,
120  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
121 
122  virtual bool closestIntersection(const DtVector& localLocation,
126  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
127 
128  virtual bool intersect(const DtChord& chord, DtPoint& intersectionPoint,
129  double& intersectionTime,
130  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
131 
132  virtual bool intersect(const DtChord& chord,
136  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
137 
144  virtual bool closestIntersection(const DtVector& curPosition,
145  DtVector& intersection, bool ignoreWater, bool* dataAvailable = 0,
146  bool overrideBlockingAssert = false) const;
147 
173  virtual bool allIntersectsAlongChord(const DtChord& chord,
176  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
177  bool overrideBlockingAssert = false) const;
178 
180  virtual void embedInTerrainIfNeeded();
181 
182 protected:
184  virtual void updateCoordTransforms();
185 
187  virtual void updateBoundingVolume();
188 
190  virtual DtVector convertLocalPointToModelPoint(const DtVector& source) const;
191 
194  virtual DtChord convertLocalChordToModelChord(const DtChord& source) const;
195 
197  virtual DtVector convertModelPointToDatabasePoint(const DtPoint&) const;
198 
201  virtual void convertModelPointToDatabasePoint(DtVrfChordIntersectionRecord&) const;
202  virtual void processObjectAboutToBeRemovedCallback(const DtSimObject*);
203 
204  virtual unsigned intersectChordWithBoundingVolume(const DtChord& chord,
205  DtVrfChordIntersectionRecord* isect1 = 0,
206  DtVrfChordIntersectionRecord* isect2 = 0) const;
207 
208  virtual unsigned intersectChordWithBoundingVolume(const DtChord& chord, bool calculateNormal,
209  DtVrfChordIntersectionRecord* isect1 = 0,
210  DtVrfChordIntersectionRecord* isect2 = 0) const;
211 
212  virtual bool boundingVolumeAltitude(const DtVector& p, double& alt) const;
213 
214  virtual void closestPointToBoundingVolume(const DtPoint& p, DtVrfChordIntersectionRecord& out) const;
215 
216  virtual void postGetSelf();
217 
218 public:
219  virtual bool entityIsValidAndAttached() const;
220 
221  virtual int appearanceFlags() const;
222 
223  void setObjectGeometricModel(boost::shared_ptr<DtTerrainInterface> newObjGeomModel);
224  boost::shared_ptr<DtTerrainInterface> objectGeometricModel() const;
225 
226  void setEntity(DtSimObjectReference);
227  DtSimObjectReference entity() const;
228 
229  void setPhysicalWorld(const DtPhysicalWorld* newPhysicalWorld);
230  const DtPhysicalWorld* physicalWorld() const;
231 
232  void clear();
233 
234  virtual DtAttachedTerrain* clone(const DtString& name, DtReaderWriterRegistry* const parentRegistry = 0) const;
235 
236 protected:
237  friend class DtLocalObject;
239  virtual void setEmbarkedOn(const DtUUID&);
240 
241 protected:
245  boost::shared_ptr<DtTerrainInterface> myObjectGeometricModel;
246 
250 
253  DtCoordTransform myGeocentricToTopographic;
254  DtCoordTransform myTopographicToGeocentric;
255  DtCoordTransform myModelNormalToLocalNormal;
260  boost::optional<Dt3dBoundingVolume> myLastLocalBoundingVolume;
261 
264 
273 
275 
276  boost::signals2::scoped_connection mySimObjectDeletedConnection;
277 
278  mutable tbb::spin_rw_mutex myStayAttachedEvenIfOffMutex;
279 
282 };
283 
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
DtVector myLastWorldPosition
Definition: attachedTerrain.h:258
NOTE: This entire class is deprecated, in favor of Dt3dChord.
Definition: chord.h:40
boost::shared_ptr< DtTerrainInterface > myObjectGeometricModel
For now, this is the model that we get.
Definition: attachedTerrain.h:245
virtual const char * readerWriterType() const
Used to supply a string type that this reader writer type is. This can be used in place of dynamic-ca...
Definition: attachedTerrain.h:45
DtVrfChordIntersectionRecord represents a list of DtChordIntersectRecords. This is useful for followi...
Definition: vrfChordIntersectRecordList.h:31
DtDcm myLastWorldOrientationMatrix
Definition: attachedTerrain.h:256
DtRwSimObjectReference myEntity
Definition: attachedTerrain.h:242
Definition: symbolString.h:20
DtCoordTransform myModelNormalToLocalNormal
Definition: attachedTerrain.h:255
int myAttachedEntityAppearance
Definition: attachedTerrain.h:266
virtual void postGetSelf()
Called after either version of getSelf (mtl or environment). Default is no-op.
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
Definition: readerWriter.h:85
boost::optional< Dt3dBoundingVolume > myLastLocalBoundingVolume
Definition: attachedTerrain.h:260
Definition: readerWriterRegistry.h:39
Definition: surface.h:179
DtVector myLastLocalPosition
Definition: attachedTerrain.h:259
bool myIsMoveable
Definition: attachedTerrain.h:281
const DtSimulationServices * mySimulationServices
Definition: attachedTerrain.h:274
Specialized reader/writer version of the shared object reference that will encapsulate the actual sha...
Definition: simObjectReference.h:74
bool myAttachedEntityIsMobile
Definition: attachedTerrain.h:267
The DtPhysicalWorld is the primary interface to and manager of all of the &quot;physical&quot; aspects of the s...
Definition: physicalWorld.h:102
Definition: coordSystem.h:54
DtDcm myLastLocalOrientationMatrix
Definition: attachedTerrain.h:257
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
tbb::spin_rw_mutex myStayAttachedEvenIfOffMutex
Definition: attachedTerrain.h:278
bool myInitialPlacement
Definition: attachedTerrain.h:271
boost::signals2::scoped_connection mySimObjectDeletedConnection
Definition: attachedTerrain.h:276
DtRwBoolean myStayAttachedEvenIfOff
Definition: attachedTerrain.h:263
DtTerrainInterface allows access to common terrain calls without having to know the terrain implement...
Definition: terrainInterface.h:99
DtPlatformSimObjectFacade myPlatformSimObjectFacade
Definition: attachedTerrain.h:243
const DtSimObject * mySimObject
Definition: attachedTerrain.h:262
const char * source
Definition: lz4.h:442
bool myFallThroughToPhysicalWorld
Definition: attachedTerrain.h:265
bool myCheckMovingToNonMoving
Definition: attachedTerrain.h:269
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:90
Definition: vrfChordIntersectionRecord.h:19
DT_DLL_vrfutil bool intersection(const DtRailSegment *currentSegment, const DtRailSegment *nextSegment)
Given two segments, determine if where they meet is an intersection or just a bend in the road...
bool myScenarioIsRunning
Definition: attachedTerrain.h:268
Definition: intersectionRecord.h:60
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: simObject.h:79
Description: Readable, Writable bool.
Definition: rwBoolean.h:26
DtUUID myEmbarkedOn
Definition: attachedTerrain.h:280
A DtChord is a finite line segment in 3-space, represented by two points. Data derived from the two e...
DtCoordTransform myGeocentricToTopographic
Last local orientation of the referenced entity. If different, then recalculates orientation matrix w...
Definition: attachedTerrain.h:253
const DtPhysicalWorld * myPhysicalWorld
For now,just use the global terrain database to return the coordinate system and perform the intersec...
Definition: attachedTerrain.h:249
const DtReaderWriter & operator=(const DtReaderWriter &orig)
assignment operator
bool myBVChanged
Definition: attachedTerrain.h:270
DtCoordTransform myTopographicToGeocentric
Definition: attachedTerrain.h:254
Definition: point.h:34
bool myMadeInitialPlacement
Definition: attachedTerrain.h:272
DtIntersectionType
Definition: intersectionRecord.h:41
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)