Builds an index of element ID's to (DIS/RPR FOM) marking text.
The DtDataBank contains simulation-specific and element-specific data elements. However there is substantial overlap - VR-Link driver's Marking Text is an element (that comes from that driver) Display Name. Element Data is, for the most part, static, and created when the Element itself is created. Simulation Data, on the other hand, contains both static and dynamic data.
The element data is easier to work with and faster/cheaper to retrieve. In addition to the the already existing Display Name attribute, there is now a Connection ID attribute and a Connection Entity Type attribute. These are whatever a particular connection uses for an ID and entity type, in string form. For example, an element from a DIS connection might have a connection ID of "3001:1:1" and a connection entity type of "1:225:1:1:1:0:0". An element created by a CIGI connection, on the other hand, might have an connection ID of "5" and a connection Entity Type of "17".
It is common for users who are used to working in a DIS or HLA environment to want to look up elements by a connection ID or Marking Text, for example. Connection objects makes that much easier to do.
The exampleElementAttributesPlugin example shows the signal that is raised with all the elements whose attribute data has been received that frame; elements can be added to indices or sets based on attribute data at that time. It builds an index of element IDs to Marking Text (Display Name) and vice versa. The example can easily be extended to build similar indices using connection ID attributes.
This example is a plug-in. You can run it by running ./bin64/exampleElementAttributesPlugin_stealth.bat (on Windows) or ./bin64/exampleElementAttributesPlugin_stealth.sh (on Linux). Load the Ala Moana terrain, once Vantage is started, connect with DIS. Open MAK DIS Logger and load "HawaiiTour-2019-DIS.lgr". Hit Play and you will see the connection information printed in the console. For more information about running examples, please see Running Applications and Examples.
static vrvSignalsLib::connection postInitializeConnection;
{
postInitializeConnection.disconnect();
if (obsFrame)
{
}
}
{
{
}
}
{
return true;
}
Contains makVrv::DtDe class.
#define DT_DE_INIT_ONCE(de)
This macro is called by modules in their init() function. This macro ensures that the module is only ...
Definition DtDe.h:30
Contains makVrv:DtMasterScene class.
Contains the DtElementAttributesMonitor class declaration.
Contains makVrv::DtKeyMapManager class.
virtual bool isInMasterMode() const
Returns true if the DtDe is in master mode.
virtual void registerInstance(const std::string &instanceName, DtVirtualBaseClass *instance)
Register an instance with a given name for later retrieval. Once registered, the DtDe takes ownership...
virtual DtDriverManager & driverManager()
The DtMasterScene accessor. The function will throw before the initialize function is called.
boost::signalslib::signal< void()> signal_postInitialize
Definition DtDe.h:535
DtInputDriver & inputDriver()
Return the DtInputDriver associated with the master scene.
Definition DtElementAttributesMonitor.h:28
virtual void dumpElements()
Dump all the named Elements to the console. This method dumps all of the entries in the element ID to...
a Key Map contains a map of keys to FunctionMapEntrys, as well as a list of functions to execute when...
Definition DtKeyMap.h:313
The manager for owning key maps.
Definition DtKeyMapManager.h:32
@ Miscellaneous
Definition DtKeyMapManager.h:45
static DtKeyMapManager & instance(DtDe &de)
Get an instance of the key map.
virtual void addKeyFunction(const std::string &functionName, const KeyFunction &function, FunctionCategory functionCategory, bool categorize=true)
bind a function to string name that can be used in a key map (or binary function set)
virtual DtKeyMap * findKeyMap(const std::string &mapName)
look up a key map
@ KEY_X
Definition DtKeyState.h:79
Contains declarations for plugin initialization functions.
DT_DE_PLUGIN_EXPORT_MACRO bool initDeModule(makVrv::DtDe *de)
#include <iostream>
{
enum class CustomElementAttributeIds : unsigned short
{
};
typedef DtUniqueElementAttribute<std::string, (
unsigned short)CustomElementAttributeIds::EntityLabel> DtElementAttributeEntityLabel;
, myDe(de)
{
mySignalConnections += elements.
attributeManager().signal_attributesChanged.connect(std::bind(
}
{
}
{
const DtElementEntry* entry = myDe.dataBank().elementData().findElement(entity);
if (!entry)
{
std::string displayName = "Unnamed";
std::cout << "Invalid Element ID received: " << std::hex << entity << " - "
<< " not found" << std::endl;
return;
}
std::cout << "Added ";
std::string displayName;
{
std::cout << displayName;
}
else
{
std::cout << "Unnamed (" << std::hex << entity << ")";
}
std::string driverType;
{
std::cout << " from " << driverType << std::endl;
}
else
{
std::cout << std::endl;
}
std::string elementTypeStr = elementTypeToString(elementType);
std::cout << " Element Type " << elementTypeStr << std::endl;
std::string objectId;
{
std::cout << " Connection ID " << objectId << std::endl;
}
std::string objectType;
{
std::cout << " Connection Type " << objectType << std::endl;
}
{
std::string subtypeStr = elementSubTypeToString(subtype);
std::cout << " Subtype " << subtypeStr << std::endl;
}
{
std::string elementDefStr;
elementDefName.
toAscii(elementDefStr);
std::cout << " Element Definition " << elementDefStr << std::endl;
}
}
{
std::cout << "Removed " << std::hex << entity << " - ";
std::string displayName;
{
std::cout << displayName << std::endl;
}
else
{
std::string elementTypeStr = elementTypeToString(elementType);
std::cout << "Unnamed " << elementTypeStr << " (" << entity << ")" << std::endl;
}
}
{
DtElementData::ElementIdList::const_iterator curIter = elements.begin();
DtElementData::ElementIdList::const_iterator endIter = elements.end();
for (; curIter != endIter; ++curIter)
{
processElementInitialized(*curIter);
}
}
{
DtElementData::ElementIdList::const_iterator curIter = elements.begin();
DtElementData::ElementIdList::const_iterator endIter = elements.end();
for (; curIter != endIter; ++curIter)
{
processElementRemoved(*curIter);
}
}
{
{
const DtElementID entryElementId = entryAttributes.first->elementID();
{
if (attribute->
attributeId() == (
unsigned short)CustomElementAttributeIds::EntityLabel)
{
std::cout << "Modified ";
std::string displayName;
{
std::cout << displayName << std::endl;
}
else
{
std::string elementTypeStr = elementTypeToString(elementType);
std::cout << "Unnamed " << elementTypeStr << " (" << entryElementId << ")" << std::endl;
}
const DtElementAttributeEntityLabel* entityLabelIdAttr =
dynamic_cast<const DtElementAttributeEntityLabel*>(entryAttributes.first->findAttribute((unsigned short)CustomElementAttributeIds::EntityLabel));
if (entityLabelIdAttr != nullptr)
{
std::cout << " Element Label " << entityLabelIdAttr->value() << std::endl;
}
}
}
}
}
{
std::string elementName;
{
std::cout << "ID: " << std::hex << elementId << " NAME: " << elementName << std::endl;
}
}
{
std::string elementTypeStr;
switch (elementType)
{
default:
elementTypeStr = "Unknown";
break;
elementTypeStr = "Entity";
break;
elementTypeStr = "Prop";
break;
elementTypeStr = "Terrain Patch";
break;
elementTypeStr = "Aggregate";
break;
elementTypeStr = "Observer";
break;
elementTypeStr = "Environmental";
break;
elementTypeStr = "Graphic Point";
break;
elementTypeStr = "Graphic Shape";
break;
elementTypeStr = "Graphic Vertex";
break;
elementTypeStr = "Remote Graphic";
break;
elementTypeStr = "Tactical Graphic";
break;
elementTypeStr = "Intervisibility";
break;
elementTypeStr = "Feature";
break;
elementTypeStr = "Tactical Smoke";
break;
elementTypeStr = "Bouy Or Beacon";
break;
elementTypeStr = "Dynamic Terrain";
break;
}
return elementTypeStr;
}
{
std::string subtypeStr;
switch (subType)
{
subtypeStr = "Munitions";
break;
subtypeStr = "Friendly";
break;
subtypeStr = "Opposing";
break;
subtypeStr = "Other";
break;
subtypeStr = "Neutral";
break;
default:
subtypeStr = "Unrecognized!";
break;
}
return subtypeStr;
}
}
Contains makVrv::DtElementAttributes class.
Contains makVrv::DtUniqueID type.
DtElementAttribute is a common base class used for all element attributes, such as those found in a D...
Definition DtElementAttribute.h:21
unsigned short attributeId() const
Definition DtElementAttribute.h:34
The element attribute manager is used to provide access to element attribute data....
Definition DtElementAttributeManager.h:37
virtual bool getNextElementIdAndDisplayName(DtElementID &id, std::string &displayName) const
virtual bool getElementObjectType(const DtElementEntry &entry, std::string &value) const
Get the 'object type' from an element entry. Returns false if no connection object type attribute is ...
std::vector< EntryAttributes > EntryAttributesList
Definition DtElementAttributeManager.h:44
virtual bool getElementDriverType(const DtElementEntry &entry, std::string &value) const
Get the Driver type from an element entry. Returns false if no Driver type attribute is found for the...
virtual DtElementEntry::ElementType elementType(DtElementID elementId) const
Get the element type from given an element id or element entry.
virtual bool getElementElementDefinitionName(const DtElementEntry &entry, DtUnicode &value) const
Get the Element Definition name from an element entry. Returns false if no Element Definition name at...
virtual bool getElementObjectId(const DtElementEntry &entry, std::string &value) const
Get the 'object id' from an element entry. Returns false if no connection object id attribute is foun...
virtual bool getElementSubtype(const DtElementEntry &entry, DtElementAttributes::ElementSubtypes &value) const
Get the 'element subtype' from an element entry Returns false if no subtype attribute is found for th...
virtual bool getElementDisplayName(DtElementID elementId, std::string &value) const
Optional Attributes.
virtual void startNamedElementIteration() const
Iterate through element ID / displayName pairs These methods provide a mechanism to inspect all of th...
std::pair< DtElementEntry *, AttributeList > EntryAttributes
Definition DtElementAttributeManager.h:43
virtual void slot_elementsRemoved(const DtElementData::ElementIdList &elements)
Slot connected to DtElementData's signal_elementsToBeRemoved signal.
virtual ~DtElementAttributesMonitor()
Virtual DTOR.
static std::string elementSubTypeToString(DtElementAttributes::ElementSubtypes subType)
GEt a readable form of an ElementSubtypes enumeration value.
static std::string elementTypeToString(DtElementEntry::ElementType elementType)
Get a readable form of an elementType enumeration value.
virtual void processElementRemoved(makVrv::DtElementID entity)
Print the element id and name (if it exists) for an element. This method is called by.
virtual void processElementInitialized(makVrv::DtElementID entity)
Print the attribute information for an initialized element entry. This method is called by.
virtual void slot_elementsInitialized(const DtElementData::ElementIdList &elements)
Slot connected to DtElementData's signal_signal_elementsInitialized signal.
virtual void slot_attributesChanged(const DtElementAttributeManager::EntryAttributesList &entryAttributeList)
Slot connected to DtElementAttributeManager's signal_attributesChanged signal.
DtElementAttributesMonitor(DtDe &de)
CTOR.
The element data is all the information about all elements in the scene.
Definition DtElementData.h:31
std::vector< DtElementID > ElementIdList
Definition DtElementData.h:54
boost::signalslib::signal< void(const ElementIdList &) > signal_elementsToBeRemoved
Signal elements to be removed.
Definition DtElementData.h:154
boost::signalslib::signal< void(const ElementIdList &) > signal_elementsInitialized
Definition DtElementData.h:151
virtual const DtElementAttributeManager & attributeManager() const
Get a const reference to the.
DtElementEntry holds the non-simulation-specific data about an element, including its element type an...
Definition DtElementEntry.h:23
ElementType
Definition DtElementEntry.h:27
@ GraphicShape
Definition DtElementEntry.h:36
@ TerrainPatch
Definition DtElementEntry.h:31
@ Unknown
Definition DtElementEntry.h:28
@ Aggregate
Definition DtElementEntry.h:32
@ Environmental
Definition DtElementEntry.h:34
@ TacticalSmoke
Definition DtElementEntry.h:42
@ TacticalGraphic
Definition DtElementEntry.h:39
@ Observer
Definition DtElementEntry.h:33
@ RemoteGraphic
Definition DtElementEntry.h:38
@ BuoyOrBeacon
Definition DtElementEntry.h:43
@ Intervisibility
Definition DtElementEntry.h:40
@ GraphicVertex
Definition DtElementEntry.h:37
@ Feature
Definition DtElementEntry.h:41
@ Prop
Definition DtElementEntry.h:30
@ GraphicPoint
Definition DtElementEntry.h:35
@ DynamicTerrain
Definition DtElementEntry.h:44
@ Entity
Definition DtElementEntry.h:29
Definition DtUnicode.h:34
void toAscii(std::string &str) const
Decode via specifying encoding.
Definition DtUnicode.inl:364
Definition DtUniqueElementAttribute.h:82
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators,...
Definition DtVirtualBaseClass.h:20
ElementSubtypes
Definition DtElementAttributes.h:60
@ Friendly
Definition DtElementAttributes.h:62
@ Opposing
Definition DtElementAttributes.h:63
@ FriendlyMunitions
Definition DtElementAttributes.h:66
@ Neutral
Definition DtElementAttributes.h:65
@ OpposingMunitions
Definition DtElementAttributes.h:67
@ NeutralMunitions
Definition DtElementAttributes.h:69
@ Other
Definition DtElementAttributes.h:64
@ OtherMunitions
Definition DtElementAttributes.h:68
@ AttributeIdUserStart
Definition DtElementAttributes.h:53