VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtElement.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2026 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
15 #include <vrvCore/DtElementEntry.h>
17 
19 
20 #include <vrvUtil/DtUnicode.h>
21 
22 #include <vector>
23 
24 #include <boost/unordered_map.hpp>
25 
26 namespace makVrv
27 {
28  class DtAgentManagerInterface;
29  class DtSharedSettingsManager;
30  class DtElementDefinition;
31  class DtStateListener;
32  class DtSceneObjectAgent;
33  class DtVisualizerSet;
34  enum class DtModelSetId;
35 
36  namespace EntityStateListener
37  {
38  enum class DamageState;
39  }
40 
45  {
46  public:
47 
48  using ModelSetToSceneObjectIdMap = boost::unordered_map<DtModelSetId, DtUniqueID>;
49 
51  DtElement( DtBaseConnection& conn, DtElementID elementId );
52 
54  virtual ~DtElement();
55 
57  DtElement() = delete;
58 
60  DtElement( const DtElement& ) = delete;
61 
63  DtElement& operator=( const DtElement& ) = delete;
64 
65  public:
66 
68  virtual void visualize(const DtSharedModelSetSettings::ModelSetVisualizedMap& sets);
69 
71  virtual void setVisible( bool visible );
72 
74  virtual bool visible() const;
75 
78  virtual void setElementId( const DtElementID );
79 
82  inline DtElementID elementID() const
83  {
84  return myElementId;
85  }
86 
88 
89 
93  virtual void updateElementDefinitionFromDefinitions();
94 
97  virtual void updateElementDefinitionFromDefinitions( std::vector<DtUnicode>& definitions );
99 
102  virtual const DtUnicode& elementDefinition() const;
103  virtual void setElementDefinition(const DtUnicode& definition);
104 
106  virtual std::string displayUnitCollectionName() const;
107 
109  virtual void setDisplayUnitCollectionName(const std::string& definition);
110 
112  virtual const DtElementEntry::ElementType elementType() const = 0;
113 
116  virtual void setDriverType(const std::string& driverType);
117 
119  virtual void setElementSubtype(DtElementAttributes::ElementSubtypes subtype);
120 
125  virtual void changeElementAttribute( const DtElementAttribute* attr );
126 
129 
130  virtual ModelSetToSceneObjectIdMap& modelSetToSceneObjectIdMap();
132 
134  virtual void setSceneObjectIdForModelSet( DtModelSetId modelSet, DtUniqueID id );
135 
137  virtual void removeSceneObjectIdForModelSet( DtModelSetId modelSet ) ;
138 
140  virtual DtUniqueID sceneObjectIdForModelSet( DtModelSetId modelSet ) const;
142 
143  protected:
144 
146 
147  virtual void reportElementCreated();
149 
151  virtual void reportDisplayName();
152 
154  virtual void reportConnectionObjectID();
155 
157  virtual void reportConnectionObjectType();
158 
160  virtual void reportConnectionObjectSidc();
161 
163  virtual void reportConnectionObjectGlobalID();
164 
166  virtual void reportOverlayNameChanged();
167 
169  virtual void reportVisibility();
170 
172  virtual void reportDamageStateChanged();
173 
175  virtual void reportDriverType();
176 
179  virtual void reportElementSubtype();
180 
182  virtual void reportElementDefinitionName();
183 
185  virtual void reportDisplayUnitCollectionName();
187 
189  void slot_updateOverlayNameRaw(const char* text);
190 
192  void slot_updateConnectionObjectID( const std::string& id );
193 
196  void slot_updateConnectionObjectType( const std::string& type );
197 
199  void slot_updateConnectionObjectSidc( const std::string& sidc );
200 
202  void slot_updateConnectionObjectGlobalID( const std::string& globalId );
203 
205  void slot_updateDisplayName(const std::string& text);
206 
208  void slot_updateOverlayName(const std::string& pname);
209 
211  void slot_updateDamageState(EntityStateListener::DamageState state);
212 
216  virtual void getDefinitions( std::vector<DtUnicode>& definitions );
217 
218  virtual void setModelSetEnabled( DtModelSetId modelSet, bool enabled ) = 0;
219 
222  virtual bool distribute() const;
223  virtual void setDistribute( const bool distribute );
225 
229  virtual void warnVisualizationFailed( const std::string& file, int line, const std::string& function,
230  DtVisualizerSet* visSet, DtSceneObjectAgent* sceneObject, DtModelSetId modelSet, DtException ex );
231 
232  protected:
243  std::string myConnectionObjectID;
247  std::string myDisplayName;
248  std::string myElementOverlayName;
249  std::string myDriverType;
256  };
257 
261  {
262  public:
263 
266  {
267  // intentional nop
268  }
269 
272  {
273  // intentional nop
274  }
275 
277  virtual DtElementCreator* clone() const = 0;
278 
280  virtual DtElement* createElement( DtBaseConnection& simulation,
281  DtStateListener& listener ) const = 0;
282 
284  virtual const DtElementEntry::ElementType elementType() const = 0;
285 
287  virtual const std::string& tag() = 0;
288  };
289 
290  template<typename ElementTemplateType>
292  {
293  public:
294  // CTOR
296  {
297  // intentional nop
298  }
299 
302  {
303  // intentional nop
304  }
305 
307  {
309  }
310 
311  virtual DtElement* createElement( DtBaseConnection& simulation,
312  DtStateListener& listener ) const
313  {
314  return new ElementTemplateType( simulation, listener );
315  }
316 
318  {
319  return ElementTemplateType::theElementType();
320  }
321 
322  virtual const std::string& tag()
323  {
324 #ifdef DtDIS
325  const static std::string str("DIS");
326 #elif DtHLA_4
327  const static std::string str("HLA4");
328 #elif DtHLA_1516_EVOLVED
329  const static std::string str( "HLA1516e" );
330 #elif DtHLA_1516
331  const static std::string str( "HLA1516" );
332 #elif DtHLA
333  const static std::string str( "HLA13" );
334 #else
335  const static std::string str( "" );
336 #endif
337  return str;
338  }
339  };
340 }
341 
DtBaseConnection & myBaseConnection
Definition: DtElement.h:238
DtUnicode myElementDefinitionName
Definition: DtElement.h:240
A unicode string. DtUnicode stores a UTF-16 encoded unicode string. Code Point, a Unicode character...
Definition: DtUnicode.h:33
std::string myDisplayUnitCollectionName
Definition: DtElement.h:242
DamageState
Definition: DtEntityStateListener.h:65
std::unordered_map< DtModelSetId, ModelSetVisualizerCreationMap > VisualTypeVisualizerCreationMap
Map that indicates whether a visualizer should be created, by visual type, for all given model sets...
Definition: DtVisualizerCreationSettings.h:43
std::string myConnectionObjectGlobalID
Definition: DtElement.h:246
EntityStateListener::DamageState myDamageState
Definition: DtElement.h:251
std::string myElementOverlayName
Definition: DtElement.h:248
bool myElementReported
Definition: DtElement.h:253
The shared settings manager, is the global object responsible for managing any shared settings object...
Definition: DtSharedSettingsManager.h:42
DtUniqueID DtElementID
The ElementID is a specific type of unique ID used to represent VR-Vantage uniquely defined elements...
Definition: DtUniqueID.h:23
Definition: DtElement.h:291
The DtElement class implements the common behavior of simulation based elements added to the scene...
Definition: DtElement.h:44
ElementSubtypes
Definition: DtElementAttributes.h:59
virtual DtElementCreatorTemplate * clone() const
Every derived class must override this method.
Definition: DtElement.h:306
The DtBaseConnection is an abstract class.
Definition: DtBaseConnection.h:35
std::string myConnectionObjectType
Definition: DtElement.h:244
ModelSetToSceneObjectIdMap myModelSetToSceneObjectIdMap
Definition: DtElement.h:255
Contains makVrv::DtSharedModelSetSettings class.
bool myElementVisible
Definition: DtElement.h:252
DtElementID myElementId
Definition: DtElement.h:239
Abstract DtElementCreator creator.
Definition: DtElement.h:260
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
virtual ~DtElementCreator()
DTOR.
Definition: DtElement.h:271
The element definition class contains the element definition information. The makVrv::DtElementDefini...
Definition: DtElementDefinition.h:26
DtElementCreatorTemplate()
Definition: DtElement.h:295
virtual const std::string & tag()
Returns the creator&#39;s tag.
Definition: DtElement.h:322
boost::unordered_map< DtModelSetId, DtUniqueID > ModelSetToSceneObjectIdMap
Definition: DtElement.h:48
ElementType
Definition: DtElementEntry.h:26
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
This contains all the DtVisualizers used to visualize an element in a particular model set...
Definition: DtVisualizerSet.h:31
Contains makVrv:DtBaseConnection class.
const DtElementDefinition * myElementDefinition
Definition: DtElement.h:241
std::string myConnectionObjectSidc
Definition: DtElement.h:245
std::map< DtModelSetId, bool > ModelSetVisualizedMap
Definition: DtSharedModelSetSettings.h:28
Contains makVrv::DtElementAttributes class.
DtElementAttributes::ElementSubtypes myElementSubtype
Definition: DtElement.h:250
bool myDistribute
Definition: DtElement.h:254
DtSharedSettingsManager & mySettingsManager
Definition: DtElement.h:236
The abstract interface necessary for agents.
Definition: DtAgentManagerInterface.h:33
DtElementID elementID() const
Get the element ID of the element. Usually the element ID is the unique id of the listener...
Definition: DtElement.h:82
std::string myDisplayName
Definition: DtElement.h:247
DtModelSetId
Definition: DtModelSetEnums.h:19
const DtVisualizerCreationSettings::VisualTypeVisualizerCreationMap & myVisualTypeVisualizerCreationMap
Definition: DtElement.h:237
std::string myConnectionObjectID
Definition: DtElement.h:243
DtElementAttribute is a common base class used for all element attributes, such as those found in a D...
Definition: DtElementAttribute.h:20
The DtStateListener is an abstract class. Subclasses implement functionality that will allow data to ...
Definition: DtStateListener.h:26
DtElementCreator()
CTOR.
Definition: DtElement.h:265
DtAgentManagerInterface & mySceneInterface
Map that indicates whether a visualizer should be created, by visual type, for all given model sets...
Definition: DtElement.h:235
Contains makVrv::DtElementEntry class.
Contains makVrv::DtVisualizerCreationSettingsManager class.
virtual const DtElementEntry::ElementType elementType() const
Returns the creator&#39;s type.
Definition: DtElement.h:317
std::string myDriverType
Definition: DtElement.h:249
virtual ~DtElementCreatorTemplate()
DTOR.
Definition: DtElement.h:301
virtual DtElement * createElement(DtBaseConnection &simulation, DtStateListener &listener) const
Create function.
Definition: DtElement.h:311
Contains DLL export macros.

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)