VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
simObject.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2021 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 #pragma once
7 
17 #include <vrfutil/rwEntityType.h>
18 #include <boost/signals2.hpp>
19 #include <matrix/vlVector.h>
20 #include <geometry/extent.h>
21 #include <vrfutil/rwUUID.h>
22 #include <vlpi/appearance.h>
23 #include <vlpi/disEnums.h>
24 #include <matrix/vlDcm.h>
25 #include <matrix/vlTaitBryan.h>
26 #include <map>
27 #include <list>
28 #include <tbb/spin_rw_mutex.h>
29 #include <vrfutil/vrf4XAPI.h>
30 
32 
33 namespace MAKVRinTerra
34 {
35  class DtFeatureGeometry;
36 }
37 
40 class DtRangeItems;
41 class DtLocalVertexList;
42 class DtVertexList;
44 class DtSymbolString;
45 class DtRwProperties;
46 class DtRwReal;
48 class DtOutputStream;
49 class DtObjectConsole;
50 class Coordinate_System;
51 class DtSimObject;
52 class DtChord;
53 class DtAttachedTerrain;
54 class DtPhysicalWorld;
55 class DtSimObjectManager;
58 class Dt3dBoundingVolume;
59 class DtEntityIdentifier;
62 
66 
70 
81 {
82 private:
84  DtSimObject();
85  DtSimObject(const DtSimObject&);
86 
87 public:
90  explicit DtSimObject(const DtSimulationServices* simManager, makVrf::DtStateData* sd);
91  explicit DtSimObject(const DtSimulationServices* simManager, const DtUUID& uuid);
92  explicit DtSimObject(const DtSimulationServices* simManager, const DtEntityIdentifier& id);
93  explicit DtSimObject(const DtSimulationServices* simManager, const makVrf::DtExternalCurrentFrameState*);
94 
96  virtual ~DtSimObject() override;
97 
99  virtual Dt3dBoundingVolume boundingVolume() const override;
100  DtVector localBoundingVolumeCenterPosition() const;
101  DtExtent extent() const;
102 
104  DtExtent roughExtent() const;
105  void expandExtent(DtExtent& extent) const;
106 
110  double distSquaredTo(const DtVector&) const;
111 
112  virtual void frameAdvanced() override;
113 
115  virtual bool isLocal() const;
116 
118  const DtPlatformSimObjectFacade& platformSimObjectFacade() const;
119 
121  const DtVrfSimulatedSimObjectFacade& vrfSimulatedSimObjectFacade() const;
122 
124  bool embarkedOnHighFidelityObject() const;
125 
127  DtSimObjectReference simObjectEmbarkedOn() const;
129 
130  bool isOnTopOf(const DtSimObject* o) const;
131 
133  bool isOnTopOf(const DtSimObject* o, double d) const;
134 
135  bool isOnTopOf(const DtSimObject* o, double d, const DtVector& position) const;
136 
138  virtual DtVrfLocalObjectCreateInformation vrfLocalObjectCreateInformation() const;
139 
141  virtual void makeInvalid() override;
142 
144  {
145  return mySimulationServices;
146  }
147 
150  {
151  return myParameters;
152  }
153 
157  DtVrfObjectParameters* duplicateParameters();
158 
160  double totalMass() const;
161 
162  const Coordinate_System* coordinateSystem() const;
163 
166  DtVector locationRelativeTo(const DtVector&, const DtSimObject* relativeTo) const;
167 
170  DtVector velocityRelativeTo(const DtVector&, const DtSimObject* relativeTo) const;
171 
174  DtVector accelerationRelativeTo(const DtVector&, const DtSimObject* relativeTo) const;
175 
178  DtTaitBryan orientationRelativeTo(const DtTaitBryan&, const DtSimObject* relativeTo) const;
179 
182  const DtRwProperties& parameterProperties() const;
183 
185  double distanceToLocalVector(const DtVector&) const;
186 
188  DtSimObjectReference simObjectReference() const;
189 
190  DtSimObjectReference superior() const;
191  virtual void superiorChanged() override;
192 
193  const DtSimObjectReferenceList& attachments() const;
194 
196  bool isTopLevel() const;
197 
199  MAKVRinTerra::DtFeatureGeometry featureGeometry() const;
200 
201  const DtAttachedTerrain* terrainAttachedTo() const;
202 
203 public:
207  virtual void clearDecorators();
208 
211  DtSimObjectDecorator* getOrCreateDecorator(const std::string& Decorator) const;
213 
214 protected:
215  void tickDecorators();
216  virtual void createNavigationDecorator();
217 
218  virtual void setupVrfObjectParameters();
219  virtual void setUUID(const DtUUID&) override;
221 
222  void attachmentsChanged();
223  virtual void completeSetup() override;
224 
225  virtual void hostChanged(const DtUUID& oldHost, const DtUUID& newHost);
226 
228  virtual void usingParameterSource(const DtString&);
229  virtual void stateDataAdded(makVrf::DtStateData* sd) override;
230 
231 private:
232  friend class DtSimObjectManager;
235  void resetUUID(const DtUUID&);
236 
237 protected:
239 
242  typedef std::map<std::string, DtSimObjectDecorator*> SimObjectDecorators;
244  mutable tbb::spin_rw_mutex mySimObjectDecoratorMutex;
246 
249  {
250  ExtentInformation() : lastSimTime(-1.), physicalFootprint(nullptr) {};
251  double lastSimTime;
254  DtVector lastPosition;
255  tbb::spin_rw_mutex mutex;
256  };
257 
259  DtNavigationSimObjectDecorator* myNavigationSimDecorator = nullptr;
260 
264 
267  boost::signals2::scoped_connection myAttachmentsChangedConnection;
268  boost::signals2::scoped_connection myHostChangedConnection;
269 
272 
275  mutable tbb::spin_rw_mutex mySimObjectReferenceMutex;
276 
278 
282 
283 public:
288  VRF4API_METHOD const DtSimObject* vrfState();
289  VRF4API_METHOD const DtSimObject* vrfState() const;
290  VRF4API_METHOD const DtSimObject* simState();
291  VRF4API_METHOD const DtSimObject* simState() const;
292  VRF4API_METHOD bool operator==(const DtSimObject* rhs) const { if (!rhs) return false; else return (uuid() == rhs->uuid()); };
293  VRF4API_METHOD const DtSimulationServices* simManager() const;
294  VRF4API_METHOD DtSimulationServices* simManager();
295  VRF4API_METHOD makVrf::DtVrfObjectGeometry vrfObjectGeometry() const;
296  VRF4API_METHOD const DtPhysicalWorld* physicalWorld() const;
297  VRF4API_METHOD DtSimObjectReference sharedReference() const { return simObjectReference(); };
298  VRF4API_METHOD const DtVrfObjectParameters* parameterEntry() const;
299  VRF4API_METHOD const DtSimObjectManager* simObjectManager() const;
300  VRF4API_METHOD DtSimObjectReference vrfObject() const;
301  VRF4API_METHOD DtSimObjectReference parent() const;
302  VRF4API_METHOD double currentHeading() const;
303  VRF4API_METHOD double currentPitch() const;
304  VRF4API_METHOD double currentRoll() const;
305  VRF4API_METHOD const DtString& markingText() const;
306 
307  VRF4API_METHOD bool isSpatiallyFrozen() const;
308  VRF4API_METHOD bool isFrozen() const;
309 
311  VRF4API_METHOD double speed() const;
312 
317  VRF4API_METHOD double forwardSpeed() const;
318  VRF4API_METHOD DtVector worldVelocity() const;
319  VRF4API_METHOD DtVector localVelocity() const;
320  VRF4API_METHOD DtVector bodyVelocity() const;
321  VRF4API_METHOD DtVector relativeVelocity() const;
322  VRF4API_METHOD DtVector parentVelocity() const;
323  VRF4API_METHOD DtVector rotationalVelocity() const;
324 
326  VRF4API_METHOD DtVector worldAcceleration() const;
327  VRF4API_METHOD DtVector localAcceleration() const;
328  VRF4API_METHOD DtVector relativeAcceleration() const;
329 
331 };
332 
333 #include "simObject.inl"
UUID is a unique ID wrapper class.
Definition: uuid.h:59
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:64
Extent information as to what it is and when it was last calculated.
Definition: simObject.h:248
NOTE: This entire class is deprecated, in favor of Dt3dChord.
Definition: chord.h:40
bool checkAndConnectForVrfStateComponent()
This class is used to interface with the terrain a particular entity is &quot;attached&quot; to...
Definition: attachedTerrain.h:57
Objects may contain a collection of other objects, such as overlays or pseudo-aggregate entities...
Definition: subordinateManager.h:43
std::map< std::string, DtSimObjectDecorator * > SimObjectDecorators
Decorator members.
Definition: simObject.h:242
DtSimObjectReference mySuperior
Superior.
Definition: simObject.h:271
double distSquaredTo(const DtVector &) const
Overall kinematic state.
This class allows one to collect and compare strings using an index number instead of having to do st...
Definition: symbolString.h:27
const DtUUID & uuid() const
@ Convenience accessors for various pieces of state Data
const DtSimulationServices * mySimulationServices
Definition: simObject.h:238
DtVrfSimulatedSimObjectFacade * myVrfSimulatedSimObjectFacade
Definition: simObject.h:281
virtual Dt3dBoundingVolume boundingVolume() const
If you use a list of object names to archive which objects are part of a controller (or any object) u...
Definition: simObjectReferenceList.h:120
DtSimObjectReference mySimObjectReference
Back pointer to this objects reference.
Definition: simObject.h:274
tbb::spin_rw_mutex mySimObjectReferenceMutex
Definition: simObject.h:275
VRF4API_METHOD bool operator==(const DtSimObject *rhs) const
This is the deprecated API that can be used as a reference to migrate 4.X code to 5...
Definition: simObject.h:292
virtual void makeInvalid()
Make this invalid by clearing the myExternalCurrentFrameState. This will also set the myIsDeleted fla...
Contains the DtUUID class declaration.
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
Definition: navigationDecorator.h:18
tbb::spin_rw_mutex mutex
Definition: simObject.h:255
The DtLocalObjectCreateInformation class is a subset of the information used in the DtIfCreateVrfObje...
Definition: vrfLocalObjectCreateInformation.h:26
Description: This repository is an internal repository accessible only by local objects. It holds all information that is common to all the forms of all entity/aggregate/control objects within VR-Forces.
Definition: vrfObjectStateRepository.h:91
ExtentInformation myExtentInformation
Definition: simObject.h:258
const DtSimulationServices * simulationServices() const
Definition: simObject.h:143
DtAggregateSimObjectFacade * myAggregateSimObjectFacade
Definition: simObject.h:279
DtExtent extent
Definition: simObject.h:253
const DtVrfObjectParameters * parameters() const
VR-Forces parameters.
Definition: simObject.h:149
This class represents the console for an individual object. It owns a set of streams for various noti...
Definition: objectConsole.h:49
The DtPhysicalWorld is the primary interface to and manager of all of the &quot;physical&quot; aspects of the s...
Definition: physicalWorld.h:112
Definition: coordSystem.h:54
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:398
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
virtual void setUUID(const DtUUID &)
DtVrfObjectParameters * myDuplicateParameters
Definition: simObject.h:263
class DtVertexList:
Definition: vertexList.h:22
const DtVrfObjectParameters * myParameters
Referenced from the simulation services object database based on entity type.
Definition: simObject.h:262
virtual void superiorChanged()
Definition: stateData.h:301
Definition: rangeItem.h:206
This class maintains a rectangular bounding volume and an ordered list of vertices describing the phy...
Definition: vrfObjectGeometry.h:39
virtual void frameAdvanced()
Overall kinematic state.
SimObjectDecorators mySimObjectDecorators
Decorator members.
Definition: simObject.h:243
Description: Readable, Writable DtReal (double)
Definition: rwReal.h:27
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: stateDataWrapper.h:49
This is a convenience list that will add DtSimObjectReference objects and modify the list as objects ...
Definition: simObjectReferenceList.h:25
const DtRwReal * physicalFootprint
Definition: simObject.h:252
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:96
This class is the central access point for all current-frame state of all objects in the simulation i...
Definition: simObjectManager.h:32
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:80
bool isTopLevel() const
Convenience method to see if this is a top level object. It is if it is local and the entity type is ...
Contains the declaration of the DtExtent class.
DtSimObjectReferenceList * myAttachments
Attachments.
Definition: simObject.h:266
virtual void stateDataAdded(DtStateData *)
Definition: decoratorBase.h:30
DtPlatformSimObjectFacade * myPlatformSimObjectFacade
Definition: simObject.h:280
boost::signals2::scoped_connection myAttachmentsChangedConnection
Definition: simObject.h:267
Contains the DtSimObjectReference class declaration.
tbb::spin_rw_mutex mySimObjectDecoratorMutex
Decorator members.
Definition: simObject.h:244
A list of properties. A DtPropertyInterface object that is a specialized version of DtRwVariableBindi...
Definition: rwProperties.h:122
VRF4API_METHOD DtSimObjectReference sharedReference() const
This is the deprecated API that can be used as a reference to migrate 4.X code to 5...
Definition: simObject.h:297
DtVector lastPosition
Definition: simObject.h:254
class DtLocalVertexList:
Definition: localVertexList.h:20
#define VRF4API_METHOD
Include this header file to allow for the definition/usage of the ability to mark something as deprec...
Definition: vrf4XAPI.h:23
This DtPlatformSimObjectFacadeInterface class will provide API functionality for platform objects...
Definition: platformSimObjectFacade.h:24
boost::signals2::scoped_connection myHostChangedConnection
Definition: simObject.h:268
virtual void completeSetup()
Represents a feature geometry.
Definition: featureGeometry.h:40
DtAttachedTerrain * myTerrainAttachedTo
Definition: simObject.h:277
This DtVrfSimulatedSimObjectFacadeInterface class will provide accessors for data that is available t...
Definition: vrfSimulatedSimObjectFacade.h:27
This DtAggregateSimObjectFacadeInterface class will provide API functionality for aggregate level cal...
Definition: aggregateSimObjectFacade.h:25

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)