|
VR-Engage
2.2
|
DtEntityResolver provides a central service for mapping between different representations of entities in the simulation. It maintains mappings between display names (marking text), object IDs, element IDs, and scene objects. This enables the application to find and work with entities regardless of which identifier system is used to reference them.
The resolver also emits signals when entities are added or removed, allowing other components to react to entity lifecycle events.
#include <entityResolver.h>
Public Types | |
| using | StringToElementIdMap = std::map<std::string, makVrv::DtElementID> |
| using | ElementIdToStringMap = std::map<makVrv::DtElementID, std::string> |
| using | SceneObjectMap = std::map<makVrv::DtElementID, makVrv::DtSceneObject*> |
Public Member Functions | |
| DtEntityResolver (makVrv::DtDe &de) | |
| virtual | ~DtEntityResolver () |
| makVrv::DtSceneObject * | sceneObjectFromElementId (makVrv::DtElementID elementId, makVrv::DtModelSetId modelSet) |
| const StringToElementIdMap & | displayNames () const |
| const DtEntityResolver::SceneObjectMap & | sceneObjects () const |
| makVrv::DtElementID | findElementID (const std::string &displayName) const |
| makVrv::DtElementID | findElementIdByObjectId (const std::string &objectId) const |
| makVrv::DtElementID | findElementIdByEntityId (const DtEntityIdentifier &entityId) const |
| DtUUID | findUUID (makVrv::DtElementID elementID) const |
| DtUUID | findUUID (const DtEntityIdentifier &entityId) const |
| std::string | findDisplayName (makVrv::DtElementID elementID) const |
| std::string | findDisplayName (const DtEntityIdentifier &entityId) const |
| std::string | findObjectId (makVrv::DtElementID elementID) const |
| DtEntityIdentifier | findEntityId (makVrv::DtElementID elementID) const |
| DtEntityIdentifier | findEntityId (const std::string &displayName) const |
| std::string | findObjectType (makVrv::DtElementID elementID) const |
| std::string | findObjectType (const DtEntityIdentifier &entityId) const |
| makVre::DtVreMessageResult | handleEntityDiscovered (makVre::DtVreMessage *msg) |
| makVre::DtVreMessageResult | handleEntityRemoved (makVre::DtVreMessage *msg) |
| void | onElementIdRealized (makVrv::DtElementID id) |
| makVrv::DtSceneObject * | findSceneObject (makVrv::DtElementID elementId) const |
| makVrv::DtSceneObject * | findSceneObject (const std::string &displayName) const |
| makVrv::DtSceneObject * | findSceneObjectByObjectId (const std::string &objectId) const |
| makVrv::DtSceneObject * | findSceneObjectByEntityId (const DtEntityIdentifier &entityId) const |
Public Attributes | |
| boost::signalslib::signal< void(makVrv::DtElementID entity)> | signal_entityAdded |
| boost::signalslib::signal< void(makVrv::DtElementID entity)> | signal_entityRemoved |
Protected Member Functions | |
| void | slot_elementsReadyToProcess (const makVrv::DtElementData::ElementIdList &elements) |
| void | slot_elementsRemoved (const makVrv::DtElementData::ElementIdList &elements) |
| void | slot_elementsChanged (const makVrv::DtElementAttributeManager::EntryAttributesList &attrs) |
Protected Attributes | |
| makVrv::DtDe & | myDe |
| StringToElementIdMap | myDisplayNameToElementIdMap |
| ElementIdToStringMap | myElementIdToDisplayNameMap |
| StringToElementIdMap | myObjectIdToElementIdMap |
| ElementIdToStringMap | myElementIdToObjectIdMap |
| SceneObjectMap | mySceneObjectMap |
| std::vector< std::shared_ptr< EntityDiscoveredMessage > > | myPendingRealization |
| using makVre::DtEntityResolver::StringToElementIdMap = std::map<std::string, makVrv::DtElementID> |
Type definition for mapping from strings to element IDs.
| using makVre::DtEntityResolver::ElementIdToStringMap = std::map<makVrv::DtElementID, std::string> |
Type definition for mapping from element IDs to strings.
| using makVre::DtEntityResolver::SceneObjectMap = std::map<makVrv::DtElementID, makVrv::DtSceneObject*> |
Type definition for mapping from element IDs to scene objects.
| makVre::DtEntityResolver::DtEntityResolver | ( | makVrv::DtDe & | de | ) |
Constructor.
| de | Reference to the display engine |
Creates a new entity resolver associated with the given display engine. The display engine provides access to the visual representation of entities.
References de().
|
virtual |
Virtual destructor.
Cleans up resources used by the entity resolver.
| makVrv::DtSceneObject * makVre::DtEntityResolver::sceneObjectFromElementId | ( | makVrv::DtElementID | elementId, |
| makVrv::DtModelSetId | modelSet ) |
Retrieves a scene object from an element ID.
| elementId | Element ID to look up |
| modelSet | Model set to search in |
Utility function to find a scene object associated with an element ID in the specified model set. This is useful for accessing the visual representation of an entity when only its element ID is known.
| const StringToElementIdMap & makVre::DtEntityResolver::displayNames | ( | ) | const |
Gets the map of all display names to element IDs.
Provides access to the complete mapping of display names to element IDs. When iterating through this map, iterator->first provides the display name, and iterator->second provides the corresponding element ID.
| const DtEntityResolver::SceneObjectMap & makVre::DtEntityResolver::sceneObjects | ( | ) | const |
Gets the map of all scene objects.
Provides access to the complete mapping of element IDs to scene objects. When iterating through this map, iterator->first provides the element ID, and iterator->second provides the corresponding scene object pointer.
| makVrv::DtElementID makVre::DtEntityResolver::findElementID | ( | const std::string & | displayName | ) | const |
Element ID lookup methods.
Finds the element ID for an entity by its display name
| displayName | Display name (marking text) of the entity |
Looks up the element ID associated with a particular display name. This is typically used to find an entity by its visible name or marking text.
Referenced by findEntityId().
| makVrv::DtElementID makVre::DtEntityResolver::findElementIdByObjectId | ( | const std::string & | objectId | ) | const |
Finds the element ID for an entity by its object ID.
| objectId | Object ID of the entity |
Looks up the element ID associated with a particular object ID. The object ID is typically a unique identifier from the network protocol.
Referenced by findElementIdByEntityId().
|
inline |
Finds the element ID for an entity by its entity identifier.
| entityId | Entity identifier of the entity |
Looks up the element ID associated with a particular entity identifier. In DIS and RPR HLA, the VRL Connection Object ID is a string representation of a DtEntityIdentifier, so this delegates to findElementIdByObjectId.
References findElementIdByObjectId().
Referenced by findDisplayName(), findObjectType(), and findUUID().
| DtUUID makVre::DtEntityResolver::findUUID | ( | makVrv::DtElementID | elementID | ) | const |
UUID lookup methods.
Finds the UUID for an entity by its element ID
| elementID | Element ID of the entity |
Retrieves the UUID associated with a particular element ID. Currently this performs the lookup by marking text, which may be ambiguous if multiple elements have the same marking text.
|
inline |
Finds the UUID for an entity by its entity identifier.
| entityId | Entity identifier of the entity |
Convenience method that combines findElementIdByEntityId and findUUID to retrieve the UUID associated with a particular entity identifier.
References findElementIdByEntityId(), and findUUID().
Referenced by findUUID().
| std::string makVre::DtEntityResolver::findDisplayName | ( | makVrv::DtElementID | elementID | ) | const |
Display name lookup methods.
Finds the display name for an entity by its element ID
| elementID | Element ID of the entity |
Retrieves the display name (marking text) associated with a particular element ID. This is typically the human-readable name of the entity as shown in the UI.
Referenced by findDisplayName().
|
inline |
Finds the display name for an entity by its entity identifier.
| entityId | Entity identifier of the entity |
Convenience method that combines findElementIdByEntityId and findDisplayName to retrieve the display name associated with a particular entity identifier.
References findDisplayName(), and findElementIdByEntityId().
| std::string makVre::DtEntityResolver::findObjectId | ( | makVrv::DtElementID | elementID | ) | const |
Object ID lookup methods.
Finds the object ID for an entity by its element ID
| elementID | Element ID of the entity |
Retrieves the object ID associated with a particular element ID. The object ID is typically a unique identifier from the network protocol.
Referenced by findEntityId().
|
inline |
Entity identifier lookup methods.
Finds the entity identifier for an entity by its element ID
| elementID | Element ID of the entity |
Retrieves the entity identifier associated with a particular element ID. In DIS and RPR HLA, the VRL Connection Object ID is a string representation of a DtEntityIdentifier, so this converts the object ID to an entity identifier.
References findObjectId().
Referenced by findEntityId().
|
inline |
Finds the entity identifier for an entity by its display name.
| displayName | Display name (marking text) of the entity |
Convenience method that combines findElementID and findEntityId to retrieve the entity identifier associated with a particular display name.
References findElementID(), and findEntityId().
| std::string makVre::DtEntityResolver::findObjectType | ( | makVrv::DtElementID | elementID | ) | const |
Object type lookup methods.
Finds the object type for an entity by its element ID
| elementID | Element ID of the entity |
Retrieves the object type associated with a particular element ID. The object type describes the kind of entity (e.g., "Tank", "Aircraft").
Referenced by findObjectType().
|
inline |
Finds the object type for an entity by its entity identifier.
| entityId | Entity identifier of the entity |
Convenience method that combines findElementIdByEntityId and findObjectType to retrieve the object type associated with a particular entity identifier.
References findElementIdByEntityId(), and findObjectType().
| makVre::DtVreMessageResult makVre::DtEntityResolver::handleEntityDiscovered | ( | makVre::DtVreMessage * | msg | ) |
Message handlers.
Handles entity discovered messages
| msg | Pointer to the entity discovered message |
Processes notifications about newly discovered entities, adding them to the resolver's tracking system and pending realization list.
| makVre::DtVreMessageResult makVre::DtEntityResolver::handleEntityRemoved | ( | makVre::DtVreMessage * | msg | ) |
Handles entity removed messages.
| msg | Pointer to the entity removed message |
Processes notifications about entities being removed from the simulation, removing them from the resolver's tracking system.
| void makVre::DtEntityResolver::onElementIdRealized | ( | makVrv::DtElementID | id | ) |
Handles element ID realization.
| id | Element ID that has been realized |
Called when an element ID has been fully realized in the simulation. This triggers the sending of EntityRealizedMessages for pending entities.
| makVrv::DtSceneObject * makVre::DtEntityResolver::findSceneObject | ( | makVrv::DtElementID | elementId | ) | const |
Scene object lookup methods.
Finds the scene object for an entity by its element ID
| elementId | Element ID of the entity |
Retrieves the scene object associated with a particular element ID. Note that DtSceneObject has an elementID method, so given a DtSceneObject, you can also look up the display name (which, when using DIS or HLA/RPR is the marking text).
| makVrv::DtSceneObject * makVre::DtEntityResolver::findSceneObject | ( | const std::string & | displayName | ) | const |
Finds the scene object for an entity by its display name.
| displayName | Display name (marking text) of the entity |
Retrieves the scene object associated with a particular display name.
| makVrv::DtSceneObject * makVre::DtEntityResolver::findSceneObjectByObjectId | ( | const std::string & | objectId | ) | const |
Finds the scene object for an entity by its object ID.
| objectId | Object ID of the entity |
Retrieves the scene object associated with a particular object ID.
Referenced by findSceneObjectByEntityId().
|
inline |
Finds the scene object for an entity by its entity identifier.
| entityId | Entity identifier of the entity |
Convenience method that retrieves the scene object associated with a particular entity identifier. In DIS and RPR HLA, the VRL Connection Object ID is a string representation of a DtEntityIdentifier.
References findSceneObjectByObjectId().
|
protected |
Element processing slots.
Slot called when elements are ready to process
| elements | List of element IDs that are ready |
Internal handler that processes element ready notifications, updating the resolver's tracking system with the new elements.
|
protected |
Slot called when elements are removed.
| elements | List of element IDs that were removed |
Internal handler that processes element removal notifications, removing the elements from the resolver's tracking system and emitting the signal_entityRemoved signal.
|
protected |
Slot called when element attributes are changed.
| attrs | List of element attributes that were changed |
Internal handler that processes element attribute change notifications, updating the resolver's tracking system with the modified attributes.
| boost::signalslib::signal<void(makVrv::DtElementID entity)> makVre::DtEntityResolver::signal_entityAdded |
Signal emitted when an entity is added.
This signal is emitted whenever a new entity is added to the simulation. Handlers can connect to this signal to perform initialization or other operations when new entities are added.
| boost::signalslib::signal<void(makVrv::DtElementID entity)> makVre::DtEntityResolver::signal_entityRemoved |
Signal emitted when an entity is removed.
This signal is emitted whenever an entity is removed from the simulation. Handlers can connect to this signal to perform cleanup or other operations when entities are removed.
|
protected |
Reference to the display engine.
Provides access to the 3D visualization and scene management system.
|
protected |
Mapping from display names to element IDs.
|
protected |
Mapping from element IDs to display names.
|
protected |
Mapping from object IDs to element IDs.
|
protected |
Mapping from element IDs to object IDs.
|
protected |
Mapping from element IDs to scene objects.
|
protected |
List of discovered entities awaiting realization.
When an entity is discovered but not yet fully realized in the system, it is added to this list. Once realized, an EntityRealizedMessage is sent.