VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtSelectionManager.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/vrvCore.h>
14 #include <vrvCore/DtElementData.h>
15 #include <vrvCore/DtMouseEvent.h>
16 #include <vrvCore/DtUniqueID.h>
17 #include <set>
18 #include <queue>
19 
20 namespace makVrv
21 {
22  class DtDe;
23  class DtDriverManager;
24  class DtColorValue;
25 
29  {
30  public:
31 
32  typedef std::set<DtUniqueID> IdSet;
33 
35  {
36  SelectionModeAll = 0,
37  SelectionModeEntities = 1,
38  SelectionModeTerrain = 2
39  };
40 
43  {
55  Mixed
56  };
57 
59  {
60  NoOperation = 0,
66  MaintainSelectionIfSelected
70  };
71 
73  static DtSelectionManager& instance(DtDe& de);
74 
76  virtual ~DtSelectionManager();
77 
79  virtual void performSelectionOperation(SelectionOperation op, const IdSet& ids);
80 
82  virtual void setCurrentSelections( const IdSet& selections );
83 
85  const DtSelectionManager::IdSet& currentSelections() const;
86 
88  virtual void addToCurrentSelection( const IdSet& adds );
89 
93  virtual void maintainCurrentSelectionIfSelected( const IdSet& maintain );
94 
96  virtual void removeFromCurrentSelection( const IdSet& removes );
97 
100  virtual void toggleFromCurrentSelection( const IdSet& toggles );
101 
103  virtual void removeFromCurrentSelection(
104  const DtElementData::UniqueIdList& removes );
105 
107  SelectionMode selectionMode() const;
108  virtual void setSelectionMode( SelectionMode mode );
109 
115  virtual bool isSelectable( DtUniqueID id ) const;
116 
120  virtual bool isSelectable( const DtElementEntry* entry ) const;
121 
123  bool isSelected( DtUniqueID id ) const;
124 
125  virtual SelectionType selectionType() const;
126 
128  virtual bool propSelectionHasNonReplacedProp();
129 
132  virtual bool propSelectionMajorityTransparent();
133 
135  virtual void slot_onElementsRemoved(
136  const DtElementData::UniqueIdList& elementIds);
137 
139  virtual void backupCurrentSelection();
140 
143  virtual bool restoreCurrentSelection();
144 
145  bool selectionIsVertex( const IdSet& selection );
146 
147  bool objectIsVertex( const DtUniqueID& id );
148  DtUniqueID parentId( const DtUniqueID& id );
149 
154  virtual bool allItemsWantVertexSelection(const IdSet&) const;
155 
157  virtual void addWantsVertexSelection(DtElementEntry::ElementType);
158 
160  virtual void removeWantsVertexSelection(DtElementEntry::ElementType);
161 
163  virtual bool wantsVertexSelection(DtElementID) const;
164 
166  boost::signal<void (const IdSet& selected, const IdSet& deselected,
167  SelectionType newType,
169 
172  boost::signal<void (const DtUniqueID& id, const DtUniqueID& parentId)>
174 
177  boost::signal<void (const DtUniqueID& id, const DtUniqueID& parentId)>
179 
182  boost::signal<void (const IdSet& entityIds)> signal_entityInfoToggled;
183 
185  boost::signal<void(const DtUniqueID&, const DtColorValue&, bool)> signal_entityTrackHistoryColorOverride;
186 
187 
189  boost::signal<void ()> signal_selectionModeChanged;
190 
192  virtual void addSelectableObjectType(DtElementEntry::ElementType type,
193  SelectionMode = SelectionModeAll);
194  virtual void removeSelectableObjectType(DtElementEntry::ElementType type,
195  SelectionMode);
196  virtual void removeSelectableObjectTypeFromAllModes(
198  virtual bool objectTypeSelectable( DtElementEntry::ElementType type,
199  SelectionMode mode ) const;
200 
202  virtual bool objectTypeSelectable( DtElementEntry::ObjectType type) const;
204 
207  static SelectionOperation selectionOperationForMouseEvent(
208  const DtMouseEvent& mouseEvent);
209 
213  static bool typeSupportsMultipleSelection(DtElementEntry::ObjectType type,
214  bool vertexSelectsParent );
215 
216  protected:
217 
220 
222  void addToCurrentSelection( DtUniqueID id );
223 
225  void removeFromCurrentSelection( DtUniqueID id );
226 
228  void announceCurrentSelectionChanged( const IdSet& selected,
229  const IdSet& deselected, SelectionType oldType );
230 
231  void updateSelectionDisplay( const IdSet& selected,
232  const IdSet& deselected );
233 
234  void updateSelectionType();
235 
237  SelectionType elementSelectionType( DtElementEntry* entry ) const;
238 
239  void convertVertexIdsToParentIds( const IdSet& in, IdSet& out );
240 
241  protected:
242  typedef std::set<DtElementEntry::ElementType> WantsVertexSelection;
243  typedef std::set<DtElementEntry::ElementType> ElementTypeSet;
244  typedef boost::unordered_map<SelectionMode, ElementTypeSet>
246  typedef std::queue<IdSet> IdSetQueue;
247 
248 
260  };
261 }
262 
Definition: DtSelectionManager.h:65
SelectionMode mySelectionMode
Definition: DtSelectionManager.h:251
IdSetQueue myBackupSelections
Definition: DtSelectionManager.h:256
Virtual base class.
Definition: DtVirtualBaseClass.h:22
boost::signal< void()> signal_selectionModeChanged
Emited when the selection mode changes.
Definition: DtSelectionManager.h:189
Definition: DtSelectionManager.h:50
SelectionModeMap mySelectionModeMap
Definition: DtSelectionManager.h:258
DtSignalConnectionManager mySignals
Definition: DtSelectionManager.h:259
Definition: DtSelectionManager.h:53
The master window of the scene.
Definition: DtSelectionManager.h:28
boost::signal< void(const DtUniqueID &, const DtColorValue &, bool)> signal_entityTrackHistoryColorOverride
Emitted when the selected entity has its track history color changed.
Definition: DtSelectionManager.h:185
Definition: DtSelectionManager.h:52
Contains makVrv::DtElementData class.
boost::signal< void(const IdSet &entityIds)> signal_entityInfoToggled
Emitted when the selected entities have their info pin state toggled Perhaps this signal doesn&#39;t belo...
Definition: DtSelectionManager.h:182
std::set< DtElementEntry::ElementType > ElementTypeSet
Definition: DtSelectionManager.h:243
std::set< DtElementEntry::ElementType > WantsVertexSelection
Definition: DtSelectionManager.h:242
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:26
This class encapsulates a mouse button event.
Definition: DtMouseEvent.h:22
Definition: DtSelectionManager.h:47
Definition: DtSelectionManager.h:64
Definition: DtSelectionManager.h:51
Definition: DtSelectionManager.h:62
boost::signal< void(const DtUniqueID &id, const DtUniqueID &parentId)> signal_vertexSelected
Special case: emitted in addition to of currentSelectionChanged when a vertex is selected.
Definition: DtSelectionManager.h:173
unsigned int ObjectType
Definition: DtElementEntry.h:50
bool myIgnoreSelectionModeChanges
Definition: DtSelectionManager.h:254
Contains makVrv::DtVirtualBaseClass class.
Definition: DtSelectionManager.h:54
DtDe & myDe
Definition: DtSelectionManager.h:249
Definition: DtSelectionManager.h:45
boost::unordered_map< SelectionMode, ElementTypeSet > SelectionModeMap
Definition: DtSelectionManager.h:245
This file contains the declaration for the class DtMouseEvent.
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
bool myIgnoreSelectionChanges
Set when a signal is raised to avoid loops.
Definition: DtSelectionManager.h:253
IdSet myCurrentSelections
Definition: DtSelectionManager.h:250
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:24
SelectionOperation
Definition: DtSelectionManager.h:58
boost::signal< void(const DtUniqueID &id, const DtUniqueID &parentId)> signal_vertexDeselected
Special case: emitted in addition to currentSelectionChanged when a vertex is deselected.
Definition: DtSelectionManager.h:178
ElementType
Definition: DtElementEntry.h:26
Definition: DtSelectionManager.h:44
unsigned long long DtUniqueID
Definition: DtUniqueID.h:22
WantsVertexSelection myWantsVertexSelection
Definition: DtSelectionManager.h:257
Definition: DtSelectionManager.h:46
Base class to provide boost signal/slot management.
Definition: DtSelectionManager.h:61
std::queue< IdSet > IdSetQueue
Definition: DtSelectionManager.h:246
const char int mode
Definition: ioapi.h:38
std::vector< DtElementID > UniqueIdList
Definition: DtElementData.h:48
boost::signal< void(const IdSet &selected, const IdSet &deselected, SelectionType newType, SelectionType oldType)> signal_currentSelectionChanged
Emited when the current selection changes.
Definition: DtSelectionManager.h:168
Contains makVrv::DtUniqueID type.
SelectionType
The nature of the current selection.
Definition: DtSelectionManager.h:42
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
Definition: DtSelectionManager.h:48
SelectionType mySelectionType
Definition: DtSelectionManager.h:255
Definition: DtSelectionManager.h:49
SelectionMode
Definition: DtSelectionManager.h:34
Definition: DtSelectionManager.h:63
std::set< DtUniqueID > IdSet
Definition: DtSelectionManager.h:32
Contains DLL export macros.

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)