![]() |
VR-Forces 4.2 Class Documentation
|
Functor class used to allow entity identifiers to be used as a key to a std::map. More...
Public Member Functions | |
| DtAggregateSpatialModel (DtVrfObjectManager &objectManager, const DtExerciseClock &exerciseClock) | |
| default constructor | |
| virtual | ~DtAggregateSpatialModel () |
| destructor | |
| virtual void | init () |
| Registers for org view callbacks. | |
| virtual void | timedTick () |
| This version of tick checks to see if the time to tick has arrived (myNextTickTime <= exerciseClock()->approximateElapsedRealTime()). | |
| virtual void | setTickPeriodUsesRealTime (bool value) |
| indicate whether tick period is to be computed using real time or simulation time. | |
| virtual bool | tickPeriodUsesRealTime () const |
| virtual void | setMinTickPeriod (double minTickPeriod) |
| specifies a minimum tick period (which can also be thought of as | |
| virtual double | minTickPeriod () const |
| access the minimum tick period | |
| virtual void | setMinTickPeriodVariance (double minTickPeriodVariance) |
| set the variance in the minimum tick time. Default is 0. | |
| virtual double | minTickPeriodVariance () const |
| access the variance in the minimum tick period | |
| virtual void | setNextTickTime (double nextTickTime) |
| The next tick time is normally calculated internally. | |
| virtual double | nextTickTime () const |
| access the next tick time | |
| virtual void | setTickAsFastAsPossibleWhenPaused (bool yesNo) |
| Sets flag indicating whether or not to override tick behavior when paused and tick as fast as possible (regardless of running tick rate). | |
| virtual bool | tickAsFastAsPossibleWhenPaused () const |
| virtual DtAggregateSpatialDataConstPtr | lookup (const DtEntityIdentifier &id) const |
| Lookup the state data for a given entity. | |
| virtual void | printHierarchy () const |
| Prints contents of nodes for entire aggregate hierarchy. For debugging. | |
Static Public Member Functions | |
| static void | nodeAddedCallback (DtEntityIdentifier eid, void *userData) |
| Callback invoked when node is added to organization hierarchy. | |
| static void | nodeRemovedCallback (DtEntityIdentifier eid, void *userData) |
| Callback invoked when child is about to be removed from organization hierarchy. | |
| static void | childAddedCallback (DtEntityIdentifier eid, void *userData) |
| Callback invoked when child is added to aggregate's list of child nodes. | |
| static void | childRemovedCallback (DtEntityIdentifier eid, void *userData) |
| Callback invoked when child is about to be removed from aggregate's list of child nodes. | |
Protected Types | |
| typedef std::map < DtEntityIdentifier, DtAggregateNodePtr > | DtAggregateNodeMap |
Protected Member Functions | |
| virtual double | calculateNextTickTime () const |
| The next tick time is equal to mySimManager->exerciseClock()-> approximateElapsedRealTime() + myMinTickPeriod + a random # between -myMinTickPeriodVariance/2. | |
| virtual void | tick () |
| Checks to see if organization has changed since last tick. | |
| virtual void | destroyTreesAndMap () |
| Clears tree of aggregate state nodes and associated map for quick lookup. | |
| virtual void | buildTreesAndMap () |
| Builds tree of aggregate state nodes and associated map for quick lookup. | |
| virtual void | traverseTreesAndUpdateNodes () |
| Iterates over tree in depth-first manner. | |
| virtual DtAggregateNodePtr | createNode (const DtOrganizationManagerNode &orgViewNode) |
| Creates new node (recursively) from corresponding node in DtOrganizationManager. | |
| virtual void | updateNode (DtAggregateNodePtr node) |
| Iterates over children, calling updateNode() on each. | |
| virtual bool | updateNodeData (DtAggregateNodePtr node, const DtAggregateSpatialData &newData) |
| Updates node with new state data. | |
| virtual bool | computeState (DtAggregateNodeConstPtr node, DtAggregateSpatialData &state) |
| Computes new state data for given node. | |
| virtual bool | computeOrientation (DtAggregateNodeConstPtr node, DtAggregateNodeList subordinates, DtDcm &geocentricOrientation, double &heading) |
| Computes geocentric orientation for given node, based on given list of subordinates. | |
| virtual bool | computeLocationAndBoundingGeometry (DtAggregateNodeConstPtr node, DtAggregateNodeList subordinates, const DtDcm &geocentricOrientation, DtVector &geocentricLocation, DtSimBoundingGeometry &boundingGeometry) |
| Computes geocentric location and bounding geometry for given node, based on given list of subordinates. | |
| virtual bool | computeVelocity (DtAggregateNodeConstPtr node, DtAggregateNodeList subordinates, DtVector &geocentricVelocity) |
| Computes geocentric location and bounding geometry for given node, based on given list of subordinates. | |
| virtual void | subordinatesToIncludeInComputingState (DtAggregateNodeConstPtr node, DtAggregateNodeList &list) |
| Returns a list of subordinates to include when computing state. | |
| virtual DtOrgViewManagedObjectListConstPtr | subordinatesToIncludeInComputingState (DtAggregateNodeConstPtr node) const |
| Returns list of subordinate to include in computation of aggregate extent. | |
| virtual void | processNodeAdded (DtEntityIdentifier eid) |
| Marks organization as having changed, so we recompute the trees and map next tick. | |
| virtual void | processNodeRemoved (DtEntityIdentifier eid) |
| Marks organization as having changed, so we recompute the trees and map next tick. | |
| virtual void | processChildAdded (DtEntityIdentifier eid) |
| Calls setOrganizationHasChanged(true). | |
| virtual void | processChildRemoved (DtEntityIdentifier eid) |
| Calls setOrganizationHasChanged(true). | |
| virtual void | printNode (DtAggregateNodePtr node, int indentLevel=0) const |
| Human-readable representation of individual node, for debugging. | |
| virtual void | registerOrgViewCallbacks () |
| Register/unregister node added/removed callback function with organization manager. | |
| void | unregisterOrgViewCallbacks () |
| Register/unregister node added/removed callback function with organization manager. | |
| virtual void | registerAggregateNodeCallbacks (DtOrganizationManagerNode &aggregateNode) |
| Register/unregister aggregate node callback function with given node. | |
| void | unregisterAggregateNodeCallbacks (DtOrganizationManagerNode &aggregateNode) |
| Register/unregister aggregate node callback function with given node. | |
| virtual bool | organizationHasChanged () const |
| Flag indicating whether organization hierarchy has changed since the last tick. | |
| virtual void | setOrganizationHasChanged (bool yesNo) |
| Flag indicating whether organization hierarchy has changed since the last tick. | |
Protected Attributes | |
| DtAggregateNodeMap | myNodeMap |
| Map of DtAggregateNodePtr's, keyed on the DtEntityIdentifier of the corresponding entity/aggregate. | |
| DtAggregateNodeList | myRootNodeList |
| List of root nodes (force level nodes) | |
| const DtExerciseClock & | myExerciseClock |
| DtVrfObjectManager & | myObjectManager |
| Used by this class to build the trees of DtAggregateNodes. | |
| bool | myOrganizationHasChanged |
| Flag indicating whether organization hierarchy has changed since the last tick. | |
| bool | myTickPeriodUsesRealTime |
| For variable tick rate support. | |
| double | myMinTickPeriod |
| double | myMinTickPeriodVariance |
| double | myNextTickTime |
| double | myLastTickSimTime |
| bool | myTickAsFastAsPossibleWhenPaused |
Private Member Functions | |
| DtAggregateSpatialModel (const DtAggregateSpatialModel &orig) | |
| Copy Constructor not implemented – Copy Not Allowed. | |
| DtAggregateSpatialModel & | operator= (const DtAggregateSpatialModel &orig) |
| Assignment Operator Not implemented - Assignment Not Allowed. | |
Functor class used to allow entity identifiers to be used as a key to a std::map.
When VR-Link implements a < operator for DtEntityIdentifier this class will no longer be needed.
DtAggregateSpatialModel computes aggregate location state (location, extent, velocity, and orientation) for every aggregate in the organization hierarchy each tick.
|
protected |
| DtAggregateSpatialModel::DtAggregateSpatialModel | ( | DtVrfObjectManager & | objectManager, |
| const DtExerciseClock & | exerciseClock | ||
| ) |
default constructor
|
virtual |
destructor
|
private |
Copy Constructor not implemented – Copy Not Allowed.
|
virtual |
Registers for org view callbacks.
Builds initial tree of nodes containing state data for each individual/aggregate in the the simulation.
|
virtual |
This version of tick checks to see if the time to tick has arrived (myNextTickTime <= exerciseClock()->approximateElapsedRealTime()).
If it has, it will then call tick(), and recalculate the next tick time.
|
virtual |
indicate whether tick period is to be computed using real time or simulation time.
If real time is used, then aggregates will update even while paused. Default is true.
|
virtual |
|
virtual |
specifies a minimum tick period (which can also be thought of as
|
virtual |
access the minimum tick period
|
virtual |
set the variance in the minimum tick time. Default is 0.
|
virtual |
access the variance in the minimum tick period
|
virtual |
The next tick time is normally calculated internally.
setNextTickTime can be used to force a tick (set nextTickTime to exerciseClock()-> approximateElapsedRealTime())
|
virtual |
access the next tick time
|
virtual |
Sets flag indicating whether or not to override tick behavior when paused and tick as fast as possible (regardless of running tick rate).
|
virtual |
|
virtual |
Lookup the state data for a given entity.
Contains the latest state information for a given individual/aggregate in the hierarchy.
| id | Site/host/object Id of entity Data record containing entity spatial data, i.e. position, orientation, velocity (returns emtpy pointer if not found). |
|
virtual |
Prints contents of nodes for entire aggregate hierarchy. For debugging.
|
protectedvirtual |
The next tick time is equal to mySimManager->exerciseClock()-> approximateElapsedRealTime() + myMinTickPeriod + a random # between -myMinTickPeriodVariance/2.
and +myMinTickPeriodVariance/2. If the exercise clock is paused, the variance is always set to zero to insure that the extra calls to DtFRand() don't prevent repeatability.
|
protectedvirtual |
Checks to see if organization has changed since last tick.
If it has, destroys and rebuilds the tree of nodes containing aggregate state information. Traverses the tree depth first and updates each node with new state data. For nodes representing individual entities, this is the same as the data maintained in the corresponding entity's state repository. For aggregate entities, it is computed from the state information of its subordinates (child nodes).
|
protectedvirtual |
Clears tree of aggregate state nodes and associated map for quick lookup.
|
protectedvirtual |
Builds tree of aggregate state nodes and associated map for quick lookup.
Traverses the DtOrganizationManager to construct it.
|
protectedvirtual |
Iterates over tree in depth-first manner.
At each node, calls updateNode().
|
protectedvirtual |
Creates new node (recursively) from corresponding node in DtOrganizationManager.
|
protectedvirtual |
Iterates over children, calling updateNode() on each.
Then calls computeState() to calculate new state values for the entity represented by the given node. Then calls updateNodeData() with new state information. This effectively iterates over tree and applies the state computation in a depth-first manner.
|
protectedvirtual |
Updates node with new state data.
|
protectedvirtual |
Computes new state data for given node.
Calls subordinatesToIncludeInComputingState() first to get the subordinates eligible for inclusion in calculations. Then calls computeOrienation() computeLocationAndBoundingGeometry() computeVelocity().
|
protectedvirtual |
Computes geocentric orientation for given node, based on given list of subordinates.
If list of subordinates is empty, returns the current orienation and heading of the corresponding DtVrfObject (individual or aggregate with no children). If subordinate list is not empty, computes orientation based on average heading.
|
protectedvirtual |
Computes geocentric location and bounding geometry for given node, based on given list of subordinates.
If list of subordinates is empty, returns the current orienation and heading of the corresponding DtVrfObject (individual or aggregate with no children). If subordinate list is not empty, computes orientation based on average heading. Algorithm for computing location and bounding extent:
|
protectedvirtual |
Computes geocentric location and bounding geometry for given node, based on given list of subordinates.
If list of subordinates is empty, returns the current velocity of the corresponding DtVrfObject (individual or aggregate with no children). If subordinate list is not empty, computes velocity based on average velocity.
|
protectedvirtual |
Returns a list of subordinates to include when computing state.
Calls version that takes a DtVrfObject& to actually determine membership in this list.
|
protectedvirtual |
Returns list of subordinate to include in computation of aggregate extent.
List of which subordinates to include are determined with the following priority: 1 - taskable subordinates 2 - movement-cabaple subordinates (regardless of independently-tasked status) 3 - all subordinates
|
protectedvirtual |
Marks organization as having changed, so we recompute the trees and map next tick.
|
protectedvirtual |
Marks organization as having changed, so we recompute the trees and map next tick.
|
protectedvirtual |
Calls setOrganizationHasChanged(true).
|
protectedvirtual |
Calls setOrganizationHasChanged(true).
|
protectedvirtual |
Register/unregister node added/removed callback function with organization manager.
|
protected |
Register/unregister node added/removed callback function with organization manager.
|
protectedvirtual |
Register/unregister aggregate node callback function with given node.
|
protected |
Register/unregister aggregate node callback function with given node.
|
protectedvirtual |
Flag indicating whether organization hierarchy has changed since the last tick.
|
protectedvirtual |
Flag indicating whether organization hierarchy has changed since the last tick.
|
protectedvirtual |
Human-readable representation of individual node, for debugging.
|
static |
Callback invoked when node is added to organization hierarchy.
Calls processNodeAdded().
|
static |
Callback invoked when child is about to be removed from organization hierarchy.
Calls processNodeRemoved().
|
static |
Callback invoked when child is added to aggregate's list of child nodes.
Calls processChildAdded().
|
static |
Callback invoked when child is about to be removed from aggregate's list of child nodes.
Calls processChildRemoved().
|
private |
Assignment Operator Not implemented - Assignment Not Allowed.
|
protected |
Map of DtAggregateNodePtr's, keyed on the DtEntityIdentifier of the corresponding entity/aggregate.
|
protected |
List of root nodes (force level nodes)
|
protected |
|
protected |
Used by this class to build the trees of DtAggregateNodes.
Trees created by this class will have the same structure as those maintained by the DtOrganizationView.
|
protected |
Flag indicating whether organization hierarchy has changed since the last tick.
|
protected |
For variable tick rate support.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |