VR-Forces Developer's Guide
 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) 2024 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  virtual 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  virtual 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  virtual 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  virtual bool selectionIsVertex( const IdSet& selection );
154 
155  virtual bool objectIsVertex( const DtUniqueID& id );
156  virtual 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 DtElementID& parentId, const DtElementID& vertexElementId, bool hasMouseCursor)> signal_vertexElementHasMouseCursorStateChanged;
178 
180  boost::signalslib::signal<void (const IdSet& selected, const IdSet& deselected,
181  SelectionType newType,
183 
186  boost::signalslib::signal<void (const DtUniqueID& id, const DtUniqueID& parentId)>
188 
191  boost::signalslib::signal<void (const DtUniqueID& id, const DtUniqueID& parentId)>
193 
196  boost::signalslib::signal<void (const IdSet& entityIds, bool pinAllLabels)> signal_infoLabelsArePinned;
197 
199  boost::signalslib::signal<void(const DtUniqueID&)> signal_switchEntitySymbolDecorationQuadrant;
200 
202  boost::signalslib::signal<void(const DtUniqueID&, const DtColorValue&, bool)> signal_entityTrackHistoryColorOverride;
203 
204 
206  boost::signalslib::signal<void ()> signal_selectionModeChanged;
207 
209  virtual void addSelectableObjectType(DtElementEntry::ElementType type,
210  SelectionMode = SelectionModeAll);
211  virtual void removeSelectableObjectType(DtElementEntry::ElementType type,
212  SelectionMode);
213  virtual void removeSelectableObjectTypeFromAllModes(
215  virtual bool objectTypeSelectable( DtElementEntry::ElementType type,
216  SelectionMode mode ) const;
217 
219  virtual bool objectTypeSelectable( DtElementEntry::ObjectType type) const;
221 
224  static SelectionOperation selectionOperationForMouseEvent(
225  const DtMouseEvent& mouseEvent);
226 
230  static bool typeSupportsMultipleSelection(DtElementEntry::ObjectType type,
231  bool vertexSelectsParent );
232 
233  protected:
234 
237 
239  virtual void addToCurrentSelection( DtUniqueID id );
240 
242  virtual void removeFromCurrentSelection( DtUniqueID id );
243 
245  virtual void announceCurrentSelectionChanged( const IdSet& selected,
246  const IdSet& deselected, SelectionType oldType );
247 
248  virtual void updateSelectionType();
249 
251  virtual SelectionType elementSelectionType( DtElementEntry* entry ) const;
252 
253  virtual void convertVertexIdsToParentIds( const IdSet& in, IdSet& out );
254 
255  protected:
256  typedef std::set<DtElementEntry::ElementType> WantsVertexSelection;
257  typedef std::set<DtElementEntry::ElementType> ElementTypeSet;
258  typedef std::unordered_map<SelectionMode, ElementTypeSet>
260  typedef std::queue<IdSet> IdSetQueue;
261 
262 
274  };
275 }
276 
Definition: DtSelectionManager.h:65
SelectionMode mySelectionMode
Definition: DtSelectionManager.h:265
IdSetQueue myBackupSelections
Definition: DtSelectionManager.h:270
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
boost::signalslib::signal< void()> signal_selectionModeChanged
Emited when the selection mode changes.
Definition: DtSelectionManager.h:206
boost::signalslib::signal< void(const DtElementID &parentId, const DtElementID &vertexElementId, bool hasMouseCursor)> signal_vertexElementHasMouseCursorStateChanged
Emitted when the vertex of an element is being hovered over by the mouse cursor.
Definition: DtSelectionManager.h:177
Definition: DtSelectionManager.h:50
SelectionModeMap mySelectionModeMap
Definition: DtSelectionManager.h:272
DtSignalConnectionManager mySignals
Definition: DtSelectionManager.h:273
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:192
Definition: DtSelectionManager.h:52
Contains makVrv::DtElementData class.
std::set< DtElementEntry::ElementType > ElementTypeSet
Definition: DtSelectionManager.h:257
std::set< DtElementEntry::ElementType > WantsVertexSelection
Definition: DtSelectionManager.h:256
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:54
bool myIgnoreSelectionModeChanges
Definition: DtSelectionManager.h:268
Contains makVrv::DtVirtualBaseClass class.
Definition: DtSelectionManager.h:54
DtDe & myDe
Definition: DtSelectionManager.h:263
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:187
Definition: DtSelectionManager.h:45
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:267
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:182
IdSet myCurrentSelections
Definition: DtSelectionManager.h:264
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:202
WantsVertexSelection myWantsVertexSelection
Definition: DtSelectionManager.h:271
Definition: DtSelectionManager.h:46
Base class to provide boost signal/slot management.
Definition: DtSelectionManager.h:61
std::unordered_map< SelectionMode, ElementTypeSet > SelectionModeMap
Definition: DtSelectionManager.h:259
std::queue< IdSet > IdSetQueue
Definition: DtSelectionManager.h:260
const char int mode
Definition: ioapi.h:38
std::vector< DtElementID > UniqueIdList
Public Type Definitions.
Definition: DtElementData.h:49
boost::signalslib::signal< void(const DtUniqueID &)> signal_switchEntitySymbolDecorationQuadrant
Emitted when the selected entity has its symbol decoration quadrant switched.
Definition: DtSelectionManager.h:199
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. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
Definition: DtSelectionManager.h:48
SelectionType mySelectionType
Definition: DtSelectionManager.h:269
Definition: DtSelectionManager.h:49
SelectionMode
Definition: DtSelectionManager.h:34
Definition: DtSelectionManager.h:63
std::set< DtUniqueID > IdSet
Definition: DtSelectionManager.h:32
boost::signalslib::signal< void(const IdSet &entityIds, bool pinAllLabels)> signal_infoLabelsArePinned
Emitted when the selected entities have their info pin state toggled Perhaps this signal doesn&#39;t belo...
Definition: DtSelectionManager.h:196
Contains DLL export macros.

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)