VR-Forces 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>
33 
34 #include <boost/shared_ptr.hpp>
35 #include <boost/optional.hpp>
36 
37 class DtTerrainInterface;
38 class DtPhysicalWorld;
41 class DtSurface;
42 class Coordinate_System;
43 class DtSimObject;
45 
47 {
48 private:
50 
51 public:
52 
54  DtAttachedTerrain(const DtSimulationServices*, const DtString& name,
55  DtReaderWriterRegistry* const parentRegistry = 0, const DtSimObject* owner = 0);
56 
58  DtReaderWriterRegistry* const parentRegistry = 0, const DtSimObject* owner = 0);
59 
61  DtAttachedTerrain(const DtString& name, const DtAttachedTerrain& orig,
62  DtReaderWriterRegistry* const parentRegistry = 0);
63 
65  from, DtReaderWriterRegistry* const parentRegistry = 0);
66 
68  virtual ~DtAttachedTerrain();
69 
72 
76  virtual const char* readerWriterType() const;
77 
78 
79 public:
80  virtual const Coordinate_System* coordinateSystem() const;
81 
82  const DtSimObject* vrfObject() const;
83 
86  virtual void tick();
87 
89  virtual bool isHighFidelityTerrain() const;
90 
91  virtual bool skipThisObject() const;
92 
94  virtual void setStayAttachedEvenIfOff(bool);
95  virtual bool stayAttachedEvenIfOff() const;
96 
102 
103  void setIntersectsFallThroughToParent(bool val);
104  bool intersectsFallThroughToParent() const;
106 
107  virtual double terrainHeight(const DtVector& localLocation,
108  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
109  virtual bool terrainHeight(const DtVector& localLocation,
110  double& terrainHeight, bool* dataAvailable = 0,
111  bool overrideBlockingAssert = false) const;
112 
113  virtual bool terrainHeightAndSurface(double lat, double lon,
114  double& terrainHeight, DtSurface& surface, bool* dataAvailable = 0,
115  bool overrideBlockingAssert = false) const;
116 
117  virtual bool terrainHeightAndSurface(const DtVector& localLocation,
118  double& terrainHeight, DtSurface& surface, bool* dataAvailable = 0,
119  bool overrideBlockingAssert = false) const;
120 
121 
122  virtual bool closestIntersection(const DtVector& localLocation,
123  DtPoint& intersectionPoint,
124  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
125 
126  virtual bool closestIntersection(const DtVector& localLocation,
127  DtVector& intersectionPoint,
128  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
129 
130  virtual bool closestIntersection(const DtVector& localLocation,
134  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
135 
136  virtual bool intersect(const DtChord& chord, DtPoint& intersectionPoint,
137  double& intersectionTime,
138  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
139 
140  virtual bool intersect(const DtChord& chord,
144  bool* dataAvailable = 0, bool overrideBlockingAssert = false) const;
145 
152  virtual bool closestIntersection(const DtVector& curPosition,
153  DtVector& intersection, bool ignoreWater, bool* dataAvailable = 0,
154  bool overrideBlockingAssert = false) const;
155 
181  virtual bool allIntersectsAlongChord(const DtChord& chord,
184  DtIntersectionRecord::INT_ALL_DATA, bool* dataAvailable = 0,
185  bool overrideBlockingAssert = false) const;
186 
188  virtual void embedInTerrainIfNeeded();
189 
190 protected:
191  virtual bool attachedEntityIsMobile() const;
192 
194  virtual void updateCoordTransforms();
195 
197  virtual void updateBoundingVolume();
198 
200  virtual DtVector convertLocalPointToModelPoint(const DtVector& source) const;
201 
204  virtual DtChord convertLocalChordToModelChord(const DtChord& source) const;
205 
207  virtual DtVector convertModelPointToDatabasePoint(const DtPoint&) const;
208 
211  virtual void convertModelPointToDatabasePoint(DtVrfChordIntersectionRecord&) const;
212  virtual void processObjectAboutToBeRemovedCallback(const DtSimObject*);
213 
214  virtual unsigned intersectChordWithBoundingVolume(const DtChord& chord,
215  DtVrfChordIntersectionRecord* isect1 = 0,
216  DtVrfChordIntersectionRecord* isect2 = 0) const;
217 
218  virtual unsigned intersectChordWithBoundingVolume(const DtChord& chord, bool calculateNormal,
219  DtVrfChordIntersectionRecord* isect1 = 0,
220  DtVrfChordIntersectionRecord* isect2 = 0) const;
221 
222  virtual bool boundingVolumeAltitude(const DtVector& p, double& alt) const;
223 
224  virtual void closestPointToBoundingVolume(const DtPoint& p, DtVrfChordIntersectionRecord& out) const;
225 
226  virtual void postGetSelf();
227 
228 public:
229  virtual bool entityIsValidAndAttached() const;
230 
231  virtual int appearanceFlags() const;
232 
233  void setObjectGeometricModel(boost::shared_ptr<DtTerrainInterface> newObjGeomModel);
234  boost::shared_ptr<DtTerrainInterface> objectGeometricModel() const;
235 
236  void setEntity(DtSimObjectReference);
237  DtSimObjectReference entity() const;
238 
239  void setPhysicalWorld(const DtPhysicalWorld* newPhysicalWorld);
240  const DtPhysicalWorld* physicalWorld() const;
241 
242  void clear();
243 
244  virtual DtAttachedTerrain* clone(const DtString& name, DtReaderWriterRegistry* const parentRegistry = 0) const;
245 
246 protected:
247  friend class DtLocalObject;
249  virtual void setEmbarkedOn(const DtUUID&);
250 
251 protected:
255  boost::shared_ptr<DtTerrainInterface> myObjectGeometricModel;
256 
260 
263  DtCoordTransform myGeocentricToTopographic;
264  DtCoordTransform myTopographicToGeocentric;
265  DtCoordTransform myModelNormalToLocalNormal;
270  boost::optional<Dt3dBoundingVolume> myLastLocalBoundingVolume;
271 
274 
283 
285 
286  boost::signals2::scoped_connection mySimObjectDeletedConnection;
287 
288  mutable tbb::spin_rw_mutex myStayAttachedEvenIfOffMutex;
289 
292 };
293 
UUID is a unique ID wrapper class.
Definition: uuid.h:59
DtVector myLastWorldPosition
Definition: attachedTerrain.h:268
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:255
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:46
bool myIntersectsFallThroughToParent
Definition: attachedTerrain.h:275
DtVrfChordIntersectionRecord represents a list of DtChordIntersectRecords. This is useful for followi...
Definition: vrfChordIntersectRecordList.h:31
DtDcm myLastWorldOrientationMatrix
Definition: attachedTerrain.h:266
DtRwSimObjectReference myEntity
Definition: attachedTerrain.h:252
This class allows one to collect and compare strings using an index number instead of having to do st...
Definition: symbolString.h:27
DtCoordTransform myModelNormalToLocalNormal
Definition: attachedTerrain.h:265
int myAttachedEntityAppearance
Definition: attachedTerrain.h:276
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:270
Definition: readerWriterRegistry.h:39
Definition: surface.h:181
DtVector myLastLocalPosition
Definition: attachedTerrain.h:269
bool myIsMoveable
Definition: attachedTerrain.h:291
const DtSimulationServices * mySimulationServices
Definition: attachedTerrain.h:284
Specialized reader/writer version of the shared object reference that will encapsulate the actual sha...
Definition: rwSimObjectReference.h:21
bool myAttachedEntityIsMobile
Definition: attachedTerrain.h:277
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:267
#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:288
bool myInitialPlacement
Definition: attachedTerrain.h:281
boost::signals2::scoped_connection mySimObjectDeletedConnection
Definition: attachedTerrain.h:286
DtRwBoolean myStayAttachedEvenIfOff
Definition: attachedTerrain.h:273
DtTerrainInterface allows access to common terrain calls without having to know the terrain implement...
Definition: terrainInterface.h:100
DtPlatformSimObjectFacade myPlatformSimObjectFacade
Definition: attachedTerrain.h:253
const DtSimObject * mySimObject
Definition: attachedTerrain.h:272
const char * source
Definition: lz4.h:442
bool myCheckMovingToNonMoving
Definition: attachedTerrain.h:279
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:95
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:278
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:88
Description: Readable, Writable bool.
Definition: rwBoolean.h:26
DtUUID myEmbarkedOn
Definition: attachedTerrain.h:290
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:263
const DtPhysicalWorld * myPhysicalWorld
For now,just use the global terrain database to return the coordinate system and perform the intersec...
Definition: attachedTerrain.h:259
const DtReaderWriter & operator=(const DtReaderWriter &orig)
assignment operator
bool myBVChanged
Definition: attachedTerrain.h:280
DtCoordTransform myTopographicToGeocentric
Definition: attachedTerrain.h:264
Definition: point.h:34
bool myMadeInitialPlacement
Definition: attachedTerrain.h:282
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 Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)