VR-Forces 4.7 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) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 #include <vrvCore/DtElementEntry.h>
12 
13 #include <boost/signals.hpp>
14 #include <boost/unordered_map.hpp>
15 #include <boost/unordered_set.hpp>
16 
17 namespace makVrv
18 {
19  class DtElementChanges;
20  class DtElementEntry;
21  class DtElementAttribute;
22  class DtDe;
23 
28  {
29  public:
30 
31  //A list of scene object Ids.
32  typedef std::vector<DtUniqueID> SceneObjectIdList;
33 
35  typedef boost::unordered_map<DtElementID, DtElementEntry*> ElementEntryMap;
36  typedef boost::unordered_map<DtElementID, SceneObjectIdList>
38 
40 
41  typedef std::vector<DtElementEntry*> ElementList;
42  typedef std::vector<DtElementID> UniqueIdList; // deprecated
43  typedef std::vector<DtElementID> ElementIdList;
44  typedef std::vector<DtElementAttribute*> AttributeList;
45  typedef std::pair<DtElementEntry*,AttributeList> EntryAttributes;
46  typedef std::vector<EntryAttributes> EntryAttributesList;
48 
50  DtElementData(DtDe& de);
51 
53  virtual ~DtElementData();
54 
56  void applyChanges(const DtElementChanges& changes);
57 
59  const ElementEntryMap& elements() const;
60 
62  const ElementToSceneObjectMap& elementToSceneObjectMap() const;
63 
65  DtElementEntry* findElement(DtElementID id );
66 
69  void findAll(DtElementEntry::ElementType type,
70  ElementList& outVector, bool sort = true);
71 
74  void findAll(const std::vector<DtElementEntry::ElementType>& types,
75  ElementList& outVector, bool sort = true);
76 
79  void findAll(ElementList& outVector, bool sort = true);
80 
81 
84  virtual void addElementID( const DtElementID& elementID,
85  const DtUniqueID& sceneObjectID, int modelSet );
86 
90  virtual void addElementID( const DtElementID& elementID,
91  const DtUniqueID& sceneObjectID );
92 
94  virtual void removeElementID( const DtElementID& elementID,
95  const DtUniqueID& sceneObjectID, int modelSet );
96 
97  virtual void removeElementID( const DtElementID& elementID,
98  const DtUniqueID& sceneObjectID);
99 
103  virtual void getSceneObjectIds( const DtElementID& elementID,
104  SceneObjectIdList& outputList,
105  int modelSet = -1 /* all modelSets */ ) const;
106 
108  virtual DtElementID elementId( const DtUniqueID& sceneObjectID ) const;
109 
110 
112  boost::signal< void (const ElementList&) > signal_elementsAdded;
113 
125  boost::signal< void (const ElementIdList&) > signal_elementsInitialized;
126 
128  boost::signal< void (const ElementIdList&) > signal_elementsToBeRemoved;
129 
131  boost::signal< void (const EntryAttributesList&) > signal_attributesChanged;
132 
136  boost::signal< void(const ElementIdList&) > signal_sceneObjectsAdded;
137 
138  protected:
139 
141  virtual void slot_preTick();
142 
143  protected:
144 
145  typedef boost::unordered_map<int, ElementToSceneObjectMap>
147  typedef boost::unordered_map<DtUniqueID, DtElementID>
149 
152 
153  // map to go from element ID to scene object IDs
155 
156  // map to go from element ID and model set to scene object id(s)
158 
159  // map to go from scene object id to element id
161 
162  // List of elements that were added last frame OR that had scene objects added
163  // last frame.
164  boost::unordered_set<DtElementID> myElementsAddedLastFrame;
165 
166  };
167 }

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)