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) 2023 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 reportOverlayNameChanged();
161 
163  virtual void reportVisibility();
164 
166  virtual void reportDamageStateChanged();
167 
169  virtual void reportDriverType();
170 
173  virtual void reportElementSubtype();
174 
176  virtual void reportElementDefinitionName();
177 
179  virtual void reportDisplayUnitCollectionName();
181 
183  void slot_updateOverlayNameRaw(const char* text);
184 
186  void slot_updateConnectionObjectID( const std::string& id );
187 
190  void slot_updateConnectionObjectType( const std::string& type );
191 
193  void slot_updateDisplayName(const std::string& text);
194 
196  void slot_updateOverlayName(const std::string& pname);
197 
199  void slot_updateDamageState(EntityStateListener::DamageState state);
200 
204  virtual void getDefinitions( std::vector<DtUnicode>& definitions );
205 
206  virtual void setModelSetEnabled( DtModelSetId modelSet, bool enabled ) = 0;
207 
210  virtual bool distribute() const;
211  virtual void setDistribute( const bool distribute );
213 
217  virtual void warnVisualizationFailed( const std::string& file, int line, const std::string& function,
218  DtVisualizerSet* visSet, DtSceneObjectAgent* sceneObject, DtModelSetId modelSet, DtException ex );
219 
220  protected:
231  std::string myConnectionObjectID;
233  std::string myDisplayName;
234  std::string myElementOverlayName;
235  std::string myDriverType;
242  };
243 
247  {
248  public:
249 
252  {
253  // intentional nop
254  }
255 
258  {
259  // intentional nop
260  }
261 
263  virtual DtElementCreator* clone() const = 0;
264 
266  virtual DtElement* createElement( DtBaseConnection& simulation,
267  DtStateListener& listener ) const = 0;
268 
270  virtual const DtElementEntry::ElementType elementType() const = 0;
271 
273  virtual const std::string& tag() = 0;
274  };
275 
276  template<typename ElementTemplateType>
278  {
279  public:
280  // CTOR
282  {
283  // intentional nop
284  }
285 
288  {
289  // intentional nop
290  }
291 
293  {
295  }
296 
297  virtual DtElement* createElement( DtBaseConnection& simulation,
298  DtStateListener& listener ) const
299  {
300  return new ElementTemplateType( simulation, listener );
301  }
302 
304  {
305  return ElementTemplateType::theElementType();
306  }
307 
308  virtual const std::string& tag()
309  {
310 #ifdef DtDIS
311  const static std::string str( "DIS" );
312 #elif DtHLA_1516_EVOLVED
313  const static std::string str( "HLA1516e" );
314 #elif DtHLA_1516
315  const static std::string str( "HLA1516" );
316 #elif DtHLA
317  const static std::string str( "HLA13" );
318 #else
319  const static std::string str( "" );
320 #endif
321  return str;
322  }
323  };
324 }
325 
DtBaseConnection & myBaseConnection
Definition: DtElement.h:226
DtUnicode myElementDefinitionName
Definition: DtElement.h:228
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:230
DamageState
Definition: DtEntityStateListener.h:64
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
EntityStateListener::DamageState myDamageState
Definition: DtElement.h:237
std::string myElementOverlayName
Definition: DtElement.h:234
bool myElementReported
Definition: DtElement.h:239
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:277
The DtElement class implements the common behavior of simulation based elements added to the scene...
Definition: DtElement.h:44
ElementSubtypes
Definition: DtElementAttributes.h:57
virtual DtElementCreatorTemplate * clone() const
Every derived class must override this method.
Definition: DtElement.h:292
The DtBaseConnection is an abstract class.
Definition: DtBaseConnection.h:35
std::string myConnectionObjectType
Definition: DtElement.h:232
ModelSetToSceneObjectIdMap myModelSetToSceneObjectIdMap
Definition: DtElement.h:241
Contains makVrv::DtSharedModelSetSettings class.
bool myElementVisible
Definition: DtElement.h:238
DtElementID myElementId
Definition: DtElement.h:227
Abstract DtElementCreator creator.
Definition: DtElement.h:246
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
virtual ~DtElementCreator()
DTOR.
Definition: DtElement.h:257
The element definition class contains the element definition information. The makVrv::DtElementDefini...
Definition: DtElementDefinition.h:26
DtElementCreatorTemplate()
Definition: DtElement.h:281
virtual const std::string & tag()
Returns the creator&#39;s tag.
Definition: DtElement.h:308
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:229
std::map< DtModelSetId, bool > ModelSetVisualizedMap
Definition: DtSharedModelSetSettings.h:28
Contains makVrv::DtElementAttributes class.
DtElementAttributes::ElementSubtypes myElementSubtype
Definition: DtElement.h:236
bool myDistribute
Definition: DtElement.h:240
DtSharedSettingsManager & mySettingsManager
Definition: DtElement.h:224
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:233
DtModelSetId
Definition: DtModelSetEnums.h:19
const DtVisualizerCreationSettings::VisualTypeVisualizerCreationMap & myVisualTypeVisualizerCreationMap
Definition: DtElement.h:225
std::string myConnectionObjectID
Definition: DtElement.h:231
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:251
DtAgentManagerInterface & mySceneInterface
Map that indicates whether a visualizer should be created, by visual type, for all given model sets...
Definition: DtElement.h:223
Contains makVrv::DtElementEntry class.
Contains makVrv::DtVisualizerCreationSettingsManager class.
virtual const DtElementEntry::ElementType elementType() const
Returns the creator&#39;s type.
Definition: DtElement.h:303
std::string myDriverType
Definition: DtElement.h:235
virtual ~DtElementCreatorTemplate()
DTOR.
Definition: DtElement.h:287
virtual DtElement * createElement(DtBaseConnection &simulation, DtStateListener &listener) const
Create function.
Definition: DtElement.h:297
Contains DLL export macros.

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)