VR-Forces 4.10 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 
90  virtual void setCurrentHovered( const DtUniqueID& sceneObjId, bool hovered );
91 
93  const DtSelectionManager::IdSet& currentSelections() const;
94 
96  virtual void addToCurrentSelection( const IdSet& adds );
97 
101  virtual void maintainCurrentSelectionIfSelected( const IdSet& maintain );
102 
104  virtual void removeFromCurrentSelection( const IdSet& removes );
105 
108  virtual void toggleFromCurrentSelection( const IdSet& toggles );
109 
111  virtual void removeFromCurrentSelection(
112  const DtElementData::UniqueIdList& removes );
113 
115  SelectionMode selectionMode() const;
116  virtual void setSelectionMode( SelectionMode mode );
117 
123  virtual bool isSelectable( DtUniqueID id ) const;
124 
128  virtual bool isSelectable( const DtElementEntry* entry ) const;
129 
131  bool isSelected( DtUniqueID id ) const;
132 
133  virtual SelectionType selectionType() const;
134 
136  virtual bool propSelectionHasNonReplacedProp();
137 
140  virtual bool propSelectionMajorityTransparent();
141 
143  virtual void slot_onElementsRemoved(
144  const DtElementData::UniqueIdList& elementIds);
145 
147  virtual void backupCurrentSelection();
148 
151  virtual bool restoreCurrentSelection();
152 
153  bool selectionIsVertex( const IdSet& selection );
154 
155  bool objectIsVertex( const DtUniqueID& id );
156  DtUniqueID parentId( const DtUniqueID& id );
157 
162  virtual bool allItemsWantVertexSelection(const IdSet&) const;
163 
165  virtual void addWantsVertexSelection(DtElementEntry::ElementType);
166 
168  virtual void removeWantsVertexSelection(DtElementEntry::ElementType);
169 
171  virtual bool wantsVertexSelection(DtElementID) const;
172 
174  boost::signalslib::signal<void (const DtElementID& entityId, bool hasMouseCursor)> signal_elementHasMouseCursorStateChanged;
175 
177  boost::signalslib::signal<void (const IdSet& selected, const IdSet& deselected,
178  SelectionType newType,
180 
183  boost::signalslib::signal<void (const DtUniqueID& id, const DtUniqueID& parentId)>
185 
188  boost::signalslib::signal<void (const DtUniqueID& id, const DtUniqueID& parentId)>
190 
193  boost::signalslib::signal<void (const IdSet& entityIds)> signal_entityInfoToggled;
194 
196  boost::signalslib::signal<void(const DtUniqueID&, const DtColorValue&, bool)> signal_entityTrackHistoryColorOverride;
197 
198 
200  boost::signalslib::signal<void ()> signal_selectionModeChanged;
201 
203  virtual void addSelectableObjectType(DtElementEntry::ElementType type,
204  SelectionMode = SelectionModeAll);
205  virtual void removeSelectableObjectType(DtElementEntry::ElementType type,
206  SelectionMode);
207  virtual void removeSelectableObjectTypeFromAllModes(
209  virtual bool objectTypeSelectable( DtElementEntry::ElementType type,
210  SelectionMode mode ) const;
211 
213  virtual bool objectTypeSelectable( DtElementEntry::ObjectType type) const;
215 
218  static SelectionOperation selectionOperationForMouseEvent(
219  const DtMouseEvent& mouseEvent);
220 
224  static bool typeSupportsMultipleSelection(DtElementEntry::ObjectType type,
225  bool vertexSelectsParent );
226 
227  protected:
228 
231 
233  void addToCurrentSelection( DtUniqueID id );
234 
236  void removeFromCurrentSelection( DtUniqueID id );
237 
239  void announceCurrentSelectionChanged( const IdSet& selected,
240  const IdSet& deselected, SelectionType oldType );
241 
242  void updateSelectionDisplay( const IdSet& selected,
243  const IdSet& deselected );
244 
245  void updateSelectionType();
246 
248  SelectionType elementSelectionType( DtElementEntry* entry ) const;
249 
250  void convertVertexIdsToParentIds( const IdSet& in, IdSet& out );
251 
252  protected:
253  typedef std::set<DtElementEntry::ElementType> WantsVertexSelection;
254  typedef std::set<DtElementEntry::ElementType> ElementTypeSet;
255  typedef boost::unordered_map<SelectionMode, ElementTypeSet>
257  typedef std::queue<IdSet> IdSetQueue;
258 
259 
271  };
272 }
273 
Definition: DtSelectionManager.h:65
SelectionMode mySelectionMode
Definition: DtSelectionManager.h:262
IdSetQueue myBackupSelections
Definition: DtSelectionManager.h:267
Virtual base class.
Definition: DtVirtualBaseClass.h:19
boost::signalslib::signal< void()> signal_selectionModeChanged
Emited when the selection mode changes.
Definition: DtSelectionManager.h:200
boost::signalslib::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:193
Definition: DtSelectionManager.h:50
SelectionModeMap mySelectionModeMap
Definition: DtSelectionManager.h:269
DtSignalConnectionManager mySignals
Definition: DtSelectionManager.h:270
Definition: DtSelectionManager.h:53
The master window of the scene.
Definition: DtSelectionManager.h:28
boost::signalslib::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:189
Definition: DtSelectionManager.h:52
Contains makVrv::DtElementData class.
std::set< DtElementEntry::ElementType > ElementTypeSet
Definition: DtSelectionManager.h:254
std::set< DtElementEntry::ElementType > WantsVertexSelection
Definition: DtSelectionManager.h:253
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:23
This class encapsulates a mouse button event.
Definition: DtMouseEvent.h:19
Definition: DtSelectionManager.h:47
Definition: DtSelectionManager.h:64
Definition: DtSelectionManager.h:51
Definition: DtSelectionManager.h:62
boost::signalslib::signal< void(const DtElementID &entityId, bool hasMouseCursor)> signal_elementHasMouseCursorStateChanged
Emitted when an element&#39;s scene object is being hovered over by the mouse cursor. ...
Definition: DtSelectionManager.h:174
unsigned int ObjectType
Definition: DtElementEntry.h:50
bool myIgnoreSelectionModeChanges
Definition: DtSelectionManager.h:265
Contains makVrv::DtVirtualBaseClass class.
Definition: DtSelectionManager.h:54
DtDe & myDe
Definition: DtSelectionManager.h:260
boost::signalslib::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:184
Definition: DtSelectionManager.h:45
boost::unordered_map< SelectionMode, ElementTypeSet > SelectionModeMap
Definition: DtSelectionManager.h:256
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:264
boost::signalslib::signal< void(const IdSet &selected, const IdSet &deselected, SelectionType newType, SelectionType oldType)> signal_currentSelectionChanged
Emited when the current selection changes.
Definition: DtSelectionManager.h:179
IdSet myCurrentSelections
Definition: DtSelectionManager.h:261
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
SelectionOperation
Definition: DtSelectionManager.h:58
ElementType
Definition: DtElementEntry.h:26
Definition: DtSelectionManager.h:44
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
boost::signalslib::signal< void(const DtUniqueID &, const DtColorValue &, bool)> signal_entityTrackHistoryColorOverride
Emitted when the selected entity has its track history color changed.
Definition: DtSelectionManager.h:196
WantsVertexSelection myWantsVertexSelection
Definition: DtSelectionManager.h:268
Definition: DtSelectionManager.h:46
Base class to provide boost signal/slot management.
Definition: DtSelectionManager.h:61
std::queue< IdSet > IdSetQueue
Definition: DtSelectionManager.h:257
const char int mode
Definition: ioapi.h:38
std::vector< DtElementID > UniqueIdList
Definition: DtElementData.h:48
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:266
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 Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)