VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtElementAttributeManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
14 #include <vrvCore/DtElementEntry.h>
15 
17 
18 #include <unordered_set>
19 #include <unordered_map>
20 #include <vrvUtil/signalslib.h>
21 
22 namespace makVrv
23 {
24  class DtDe;
25  class DtElementAttribute;
26  class DtElementChanges;
27  class DtElementEntry;
28 
37  {
38  public:
39 
41  typedef std::vector<DtElementAttribute*> AttributeList;
43  typedef std::pair<DtElementEntry*, AttributeList> EntryAttributes;
44  typedef std::vector<EntryAttributes> EntryAttributesList;
46 
49 
52  friend class DtElementData;
53 
54  protected:
55 
59 
60  public:
62  virtual ~DtElementAttributeManager();
63 
65  virtual DtElementEntry::ElementType elementType(DtElementID elementId) const;
67  virtual DtElementEntry::ElementType elementType(const DtElementEntry& entry) const;
69 
71 
78  virtual bool getElementDisplayName(DtElementID elementId, std::string& value) const;
79 
86  virtual bool getElementDisplayName(const DtElementEntry& entry, std::string& value) const;
87 
93  virtual bool getElementObjectId(const DtElementEntry& entry, std::string& value) const;
94 
98  virtual bool getElementObjectId(DtElementID elementId, std::string& value) const;
99 
105  virtual bool getElementObjectType(const DtElementEntry& entry, std::string& value) const;
106 
110  virtual bool getElementObjectType(DtElementID elementId, std::string& value) const;
111 
120  virtual bool getElementSubtype(const DtElementEntry& entry, DtElementAttributes::ElementSubtypes& value) const;
121 
125  virtual bool getElementSubtype(DtElementID elementId, DtElementAttributes::ElementSubtypes& value) const;
126 
130  virtual bool getElementElementDefinitionName(const DtElementEntry& entry, DtUnicode& value) const;
131 
135  virtual bool getElementElementDefinitionName(DtElementID elementId, DtUnicode& value) const;
136 
141  virtual bool getElementDriverType(const DtElementEntry& entry, std::string& value) const;
142 
146  virtual bool getElementDriverType(DtElementID elementId, std::string& value) const;
147 
150  virtual bool getElementObjectVisibility(const DtElementEntry& entry, bool& value) const;
151 
155  virtual bool getElementObjectVisibility(DtElementID elementId, bool& value) const;
156 
159  virtual bool getElementIndicatorVisibility(const DtElementEntry& entry, bool& value) const;
160 
164  virtual bool getElementIndicatorVisibility(DtElementID elementId, bool& value) const;
165 
168  virtual bool getElementHeightAboveTerrainLinesEnabled(const DtElementEntry& entry, bool& value) const;
169 
173  virtual bool getElementHeightAboveTerrainLinesEnabled(DtElementID elementId, bool& value) const;
174 
178  virtual bool getElementIndicatorsOnSelect(const DtElementEntry& entry, bool& value) const;
179 
183  virtual bool getElementIndicatorsOnSelect(DtElementID elementId, bool& value) const;
184 
188  virtual bool getElementOverlayName(const DtElementEntry& entry, std::string& value) const;
189 
193  virtual bool getElementOverlayName(DtElementID elementId, std::string& value) const;
194 
200  virtual bool getElementKindAndCategory(const DtElementEntry& entry, std::pair<int, int>& value) const;
201 
205  virtual bool getElementKindAndCategory(DtElementID elementId, std::pair<int, int>& value) const;
206 
210  virtual bool getElementLocalScaleEnabled(const DtElementEntry& entry, bool& value) const;
211 
215  virtual bool getElementLocalScaleEnabled(DtElementID elementId, bool& value) const;
216 
220  virtual bool getElementLocalScaleAmount(const DtElementEntry& entry, float& value) const;
221 
225  virtual bool getElementLocalScaleAmount(DtElementID elementId, float& value) const;
226 
232  virtual bool getElementDamageState(const DtElementEntry& entry, EntityStateListener::DamageState& value) const;
233 
237  virtual bool getElementDamageState(DtElementID elementId, EntityStateListener::DamageState& value) const;
238 
243  virtual bool getElementDisplayUnitCollectionName(const DtElementEntry& entry, std::string& value) const;
244 
248  virtual bool getElementDisplayUnitCollectionName(DtElementID elementId, std::string& value) const;
249 
252  virtual bool getElementLightPointGroupCollectionName(const DtElementEntry& entry, std::string& value) const;
253 
257  virtual bool getElementLightPointGroupCollectionName(DtElementID elementId, std::string& value) const;
259 
261 
269  virtual void startNamedElementIteration() const;
270 
273  virtual bool getNextElementIdAndDisplayName(DtElementID& id, std::string& displayName) const;
274 
277  virtual bool getElementIdFromDisplayName(const std::string& displayName, DtElementID& elementId) const;
279 
282  boost::signalslib::signal< void(const EntryAttributesList&) > signal_attributesChanged;
283 
284  private:
286  DtElementAttributeManager() = delete;
287 
290 
292  DtElementAttributeManager& operator=(const DtElementAttributeManager& rhs) = delete;
293 
294  protected:
295 
297  virtual void applyElementAttributeChanges(const DtElementChanges::ElementAttributeMap& attributeChanges);
298 
300  virtual void applyElementRemovals(const DtElementChanges::UniqueIdList& elementsRemoved);
301 
304  virtual void addToElementIdDisplayNameMaps(DtElementID elementId, const std::string& displayName);
305 
307  virtual void removeFromElementIdDisplayNameMaps(DtElementID elementId);
308 
311  virtual void reportElementEntryNotFound(DtElementID elementId) const;
312 
313  protected:
314 
316 
318  // Unordered map from display name attribute to element ID
319  typedef std::unordered_map< std::string, DtElementID > DisplayNameToElementIdMap;
322 
324  // Unordered map from element ID to display name attribute
325  typedef std::unordered_map< DtElementID, std::string > ElementIdToDisplayNameMap;
328 
330  mutable ElementIdToDisplayNameMap::const_iterator myMutatableDisplayNameIterator;
331 
332  };
333 
336  {
337  public:
340 
343 
345  static DtElementAttributeManagerCreator& instance(DtDe& de);
346 
348  virtual DtElementAttributeManager* create(DtDe& de) const;
349  };
350 }
ElementIdToDisplayNameMap::const_iterator myMutatableDisplayNameIterator
Mutable iterator used on by startNamedElementIteration / getNextElementIdAndDisplayName.
Definition: DtElementAttributeManager.h:330
boost::signalslib::signal< void(const EntryAttributesList &) > signal_attributesChanged
Signal raised when attributes are changed. The EntryAttributesList contains all the attribute additio...
Definition: DtElementAttributeManager.h:282
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
A unicode string. DtUnicode stores a UTF-16 encoded unicode string. Code Point, a Unicode character...
Definition: DtUnicode.h:33
std::unordered_map< std::string, DtElementID > DisplayNameToElementIdMap
Definition: DtElementAttributeManager.h:319
DamageState
Definition: DtEntityStateListener.h:64
DisplayNameToElementIdMap myDisplayNameToElementIdMap
Definition: DtElementAttributeManager.h:320
Creator class for the Network IO.
Definition: DtElementAttributeManager.h:335
std::pair< DtElementEntry *, AttributeList > EntryAttributes
Define the type used to signal changes to one or more attributes for one or more elements.
Definition: DtElementAttributeManager.h:43
The element data is all the information about all elements in the scene.
Definition: DtElementData.h:30
std::vector< DtUniqueID > UniqueIdList
Definition: DtElementChanges.h:34
DtElementEntry holds the non-simulation-specific data about an element, including its element type an...
Definition: DtElementEntry.h:22
DtUniqueID DtElementID
The ElementID is a specific type of unique ID used to represent VR-Vantage uniquely defined elements...
Definition: DtUniqueID.h:23
ElementSubtypes
Definition: DtElementAttributes.h:57
Contains makVrv::DtVirtualBaseClass class.
The element attribute manager is used to provide access to element attribute data. It includes maps between the display name attribute and element id to make it easier to find an element by name. However, note that these maps only valid if display names are unique (and that is not the case internally for the VRF GUI). The DtElementData class creates and owns this manager using the.
Definition: DtElementAttributeManager.h:36
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
std::map< DtUniqueID, AttributeList > ElementAttributeMap
Definition: DtElementChanges.h:36
std::vector< EntryAttributes > EntryAttributesList
Define the type used to signal changes to one or more attributes for one or more elements.
Definition: DtElementAttributeManager.h:44
ElementType
Definition: DtElementEntry.h:26
std::unordered_map< DtElementID, std::string > ElementIdToDisplayNameMap
Definition: DtElementAttributeManager.h:325
Contains makVrv::DtElementAttributes class.
DtDe & myDe
Definition: DtElementAttributeManager.h:315
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
std::vector< DtElementAttribute * > AttributeList
Define the type used to signal changes to one or more attributes for one or more elements.
Definition: DtElementAttributeManager.h:42
Contains makVrv::DtElementChanges class.
ElementIdToDisplayNameMap myElementIdToDisplayNameMap
Definition: DtElementAttributeManager.h:326
Contains makVrv::DtElementEntry class.

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)