VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtElementData.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 #include <vrvCore/DtElementEntry.h>
13 
14 #include <vrvUtil/signalslib.h>
15 #include <boost/unordered_map.hpp>
16 #include <boost/unordered_set.hpp>
17 
18 namespace makVrv
19 {
20  class DtElementChanges;
21  class DtElementEntry;
22  class DtElementAttribute;
23  class DtDe;
24  class DtSceneObject;
25  class DtElementAttributeManager;
26 
30  {
31  public:
32 
34 
37  typedef std::vector<DtUniqueID> SceneObjectIdList;
38 
40  typedef boost::unordered_map<DtElementID, DtElementEntry*> ElementEntryMap;
41 
43  typedef boost::unordered_map<DtElementID, SceneObjectIdList> ElementToSceneObjectMap;
44 
46  typedef std::vector<DtElementEntry*> ElementList;
47 
48  typedef std::vector<DtElementID> UniqueIdList; // deprecated (but still widely used)
49 
53  typedef std::vector<DtElementID> ElementIdList;
55 
57  DtElementData(DtDe& de);
58 
60  virtual ~DtElementData();
61 
63  void applyChanges(const DtElementChanges& changes);
64 
66  const ElementEntryMap& elements() const;
67 
69  const ElementToSceneObjectMap& elementToSceneObjectMap() const;
70 
72  DtElementEntry* findElement(DtElementID id );
73 
76  void findAll(DtElementEntry::ElementType type,
77  ElementList& outVector, bool sort = true);
78 
81  void findAll(const std::vector<DtElementEntry::ElementType>& types,
82  ElementList& outVector, bool sort = true);
83 
86  void findAll(ElementList& outVector, bool sort = true);
87 
88 
91  virtual void addElementID( const DtElementID& elementID,
92  const DtUniqueID& sceneObjectID, int modelSet );
93 
97  virtual void addElementID( const DtElementID& elementID,
98  const DtUniqueID& sceneObjectID );
99 
102  virtual void removeElementID( const DtElementID& elementID,
103  const DtUniqueID& sceneObjectID, int modelSet );
104 
107  virtual void removeElementID(const DtElementID& elementID,
108  const DtUniqueID& sceneObjectID);
109 
113  virtual void getSceneObjectIds( const DtElementID& elementID,
114  SceneObjectIdList& outputList, int modelSet = -1 /* all modelSets */ ) const;
115 
123  DtSceneObject* findSceneObjectFromElementId(DtElementID elementId, int modelSet=0);
124 
127  DtSceneObject* findSceneObjectFromSceneObjectId(DtUniqueID sceneObjId);
128 
131  virtual DtElementID elementIdFromSceneObjectId( const DtUniqueID& sceneObjectID ) const;
132 
134  virtual const DtElementAttributeManager& attributeManager() const;
135 
137  virtual DtElementAttributeManager& attributeManager();
138 
140  boost::signalslib::signal< void (const ElementList&) > signal_elementsAdded;
141 
150  boost::signalslib::signal< void (const ElementIdList&) > signal_elementsInitialized;
151 
153  boost::signalslib::signal< void (const ElementIdList&) > signal_elementsToBeRemoved;
154 
158  boost::signalslib::signal< void(const ElementIdList&) > signal_sceneObjectsAdded;
159 
160  private:
162  DtElementData();
163 
165  DtElementData(const DtElementData& orig);
166 
168  DtElementData& operator=(const DtElementData& rhs);
169 
170  protected:
171 
173  virtual void slot_preTick();
174 
175  protected:
176 
177  typedef boost::unordered_map<int, ElementToSceneObjectMap>
179  typedef boost::unordered_map<DtUniqueID, DtElementID>
181 
184 
185  // map to go from element ID to scene object IDs
187 
188  // map to go from element ID and model set to scene object id(s)
190 
191  // map to go from scene object id to element id
193 
194  // List of elements that were added last frame OR that had scene objects added
195  // last frame.
196  boost::unordered_set<DtElementID> myElementsAddedLastFrame;
197 
199  };
200 }
std::vector< DtUniqueID > SceneObjectIdList
Public Type Definitions.
Definition: DtElementData.h:37
ElementToSceneObjectMap myElementToSceneObjectMap
Definition: DtElementData.h:186
std::vector< DtElementID > ElementIdList
Type definition for a vector of DtElementIDs.
Definition: DtElementData.h:53
ElementEntryMap myElements
Definition: DtElementData.h:183
The element data is all the information about all elements in the scene.
Definition: DtElementData.h:29
DtElementEntry holds the non-simulation-specific data about an element, including its element type an...
Definition: DtElementEntry.h:22
boost::unordered_set< DtElementID > myElementsAddedLastFrame
Definition: DtElementData.h:196
DtUniqueID DtElementID
The ElementID is a specific type of unique ID used to represent VR-Vantage uniquely defined elements...
Definition: DtUniqueID.h:23
DtElementChanges is used to communicate changes in element data between drivers and the main applicat...
Definition: DtElementChanges.h:25
The element attribute manager is used to provide access to element attribute data.
Definition: DtElementAttributeManager.h:35
boost::signalslib::signal< void(const ElementIdList &) > signal_elementsInitialized
When the signal_elementsAdded signal is raised, none of the element attributes (like displayName...
Definition: DtElementData.h:150
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
boost::unordered_map< DtUniqueID, DtElementID > SceneObjectToElementMap
Definition: DtElementData.h:180
boost::signalslib::signal< void(const ElementList &) > signal_elementsAdded
Signal that elements have been added.
Definition: DtElementData.h:140
ElementType
Definition: DtElementEntry.h:26
DtElementAttributeManager * myElementAttributeManager
Definition: DtElementData.h:198
boost::signalslib::signal< void(const ElementIdList &) > signal_elementsToBeRemoved
Signal elements to be removed.
Definition: DtElementData.h:153
ModelSetToElementSceneObjectMap myModelSetToElementSceneObjectMap
Definition: DtElementData.h:189
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
std::vector< DtElementEntry * > ElementList
Type definition for a vector of DtElementEntry pointers.
Definition: DtElementData.h:46
boost::unordered_map< DtElementID, DtElementEntry * > ElementEntryMap
Type definition for an unordered map of element ids to DtElementEntry pointers.
Definition: DtElementData.h:40
DtDe & myDe
Definition: DtElementData.h:182
A DtSceneObject represents an object that can be positioned in the scene by (possibly) attaching it t...
Definition: DtSceneObject.h:41
std::vector< DtElementID > UniqueIdList
Definition: DtElementData.h:48
Contains makVrv::DtElementAttributes class.
boost::signalslib::signal< void(const ElementIdList &) > signal_sceneObjectsAdded
Signal a list of elements that have had scene objects added.
Definition: DtElementData.h:158
boost::unordered_map< DtElementID, SceneObjectIdList > ElementToSceneObjectMap
Type definition for an unordered map of element ids to SceneObjectIdList.
Definition: DtElementData.h:43
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
boost::unordered_map< int, ElementToSceneObjectMap > ModelSetToElementSceneObjectMap
Definition: DtElementData.h:178
SceneObjectToElementMap mySceneObjectToElementMap
Definition: DtElementData.h:192
Contains makVrv::DtElementEntry class.

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)