VR-Forces 4.6 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) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtSelectionManager.h,v $ $Revision: 1.21 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #pragma once
14 #include <vrvCore/vrvCore.h>
17 #include <vrvCore/DtElementData.h>
18 #include <vrvCore/DtMouseEvent.h>
19 #include <vrvCore/DtUniqueID.h>
20 #include <set>
21 #include <queue>
22 
23 namespace makVrv
24 {
25  class DtDe;
26  class DtDriverManager;
27 
31  {
32  public:
33 
34  typedef std::set<DtUniqueID> IdSet;
35 
37  {
38  SelectionModeAll = 0,
39  SelectionModeEntities = 1,
40  SelectionModeTerrain = 2
41  };
42 
45  {
57  Mixed
58  };
59 
61  {
62  NoOperation = 0,
68  MaintainSelectionIfSelected
72  };
73 
75  static DtSelectionManager& instance(DtDe& de);
76 
78  virtual ~DtSelectionManager();
79 
81  virtual void performSelectionOperation(SelectionOperation op, const IdSet& ids);
82 
84  virtual void setCurrentSelections( const IdSet& selections );
85 
87  const DtSelectionManager::IdSet& currentSelections() const;
88 
90  virtual void addToCurrentSelection( const IdSet& adds );
91 
95  virtual void maintainCurrentSelectionIfSelected( const IdSet& maintain );
96 
98  virtual void removeFromCurrentSelection( const IdSet& removes );
99 
102  virtual void toggleFromCurrentSelection( const IdSet& toggles );
103 
105  virtual void removeFromCurrentSelection(
106  const DtElementData::UniqueIdList& removes );
107 
109  SelectionMode selectionMode() const;
110  virtual void setSelectionMode( SelectionMode mode );
111 
117  virtual bool isSelectable( DtUniqueID id ) const;
118 
122  virtual bool isSelectable( const DtElementEntry* entry ) const;
123 
125  bool isSelected( DtUniqueID id ) const;
126 
127  virtual SelectionType selectionType() const;
128 
130  virtual bool propSelectionHasNonReplacedProp();
131 
134  virtual bool propSelectionMajorityTransparent();
135 
137  virtual void slot_onElementsRemoved(
138  const DtElementData::UniqueIdList& elementIds);
139 
141  virtual void backupCurrentSelection();
142 
145  virtual bool restoreCurrentSelection();
146 
147  bool selectionIsVertex( const IdSet& selection );
148 
149  bool objectIsVertex( const DtUniqueID& id );
150  DtUniqueID parentId( const DtUniqueID& id );
151 
156  virtual bool allItemsWantVertexSelection(const IdSet&) const;
157 
159  virtual void addWantsVertexSelection(DtElementEntry::ElementType);
160 
162  virtual void removeWantsVertexSelection(DtElementEntry::ElementType);
163 
165  virtual bool wantsVertexSelection(DtElementID) const;
166 
168  boost::signal<void (const IdSet& selected, const IdSet& deselected,
169  SelectionType newType,
171 
174  boost::signal<void (const DtUniqueID& id, const DtUniqueID& parentId)>
176 
179  boost::signal<void (const DtUniqueID& id, const DtUniqueID& parentId)>
181 
184  boost::signal<void (const IdSet& entityIds)> signal_entityInfoToggled;
185 
187  boost::signal<void ()> signal_selectionModeChanged;
188 
190  virtual void addSelectableObjectType(DtElementEntry::ElementType type,
191  SelectionMode = SelectionModeAll);
192  virtual void removeSelectableObjectType(DtElementEntry::ElementType type,
193  SelectionMode);
194  virtual void removeSelectableObjectTypeFromAllModes(
196  virtual bool objectTypeSelectable( DtElementEntry::ElementType type,
197  SelectionMode mode ) const;
198 
200  virtual bool objectTypeSelectable( DtElementEntry::ObjectType type) const;
202 
205  static SelectionOperation selectionOperationForMouseEvent(
206  const DtMouseEvent& mouseEvent);
207 
211  static bool typeSupportsMultipleSelection(DtElementEntry::ObjectType type,
212  bool vertexSelectsParent );
213 
214  protected:
215 
218 
220  void addToCurrentSelection( DtUniqueID id );
221 
223  void removeFromCurrentSelection( DtUniqueID id );
224 
226  void announceCurrentSelectionChanged( const IdSet& selected,
227  const IdSet& deselected, SelectionType oldType );
228 
229  void updateSelectionDisplay( const IdSet& selected,
230  const IdSet& deselected );
231 
232  void updateSelectionType();
233 
235  SelectionType elementSelectionType( DtElementEntry* entry ) const;
236 
237  void convertVertexIdsToParentIds( const IdSet& in, IdSet& out );
238 
239  protected:
240  typedef std::set<DtElementEntry::ElementType> WantsVertexSelection;
241  typedef std::set<DtElementEntry::ElementType> ElementTypeSet;
242  typedef boost::unordered_map<SelectionMode, ElementTypeSet>
244  typedef std::queue<IdSet> IdSetQueue;
245 
246 
258  };
259 }
260 

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)