VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtSelectionManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2010 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/DtElementEntry.h>
19 #include <vrvCore/DtMouseEvent.h>
20 #include <vrvCore/DtUniqueID.h>
21 #include <set>
22 #include <queue>
23 
24 namespace makVrv
25 {
26  class DtDe;
27  class DtDriverManager;
28 
32  {
33  public:
34 
35  typedef std::set<DtUniqueID> IdSet;
36 
38  {
39  SelectionModeAll = 0,
40  SelectionModeEntities = 1,
41  SelectionModeTerrain = 2
42  };
43 
46  {
58  Mixed
59  };
60 
62  {
63  NoOperation = 0,
69  MaintainSelectionIfSelected
73  };
74 
76  static DtSelectionManager& instance(DtDe& de);
77 
80 
82  void performSelectionOperation(SelectionOperation op, const IdSet& ids);
83 
85  void setCurrentSelections( const IdSet& selections );
86 
88  const DtSelectionManager::IdSet& currentSelections() const;
89 
91  void addToCurrentSelection( const IdSet& adds );
92 
96  void maintainCurrentSelectionIfSelected( const IdSet& maintain );
97 
99  void removeFromCurrentSelection( const IdSet& removes );
100 
103  void toggleFromCurrentSelection( const IdSet& toggles );
104 
106  void removeFromCurrentSelection(
107  const DtElementData::UniqueIdList& removes );
108 
110  SelectionMode selectionMode() const;
111  void setSelectionMode( SelectionMode mode );
112 
118  bool isSelectable( DtUniqueID id ) const;
119 
123  bool isSelectable( const DtElementEntry* entry ) const;
124 
126  bool isSelected( DtUniqueID id ) const;
127 
128  SelectionType selectionType() const;
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  void addWantsVertexSelection(DtElementEntry::ElementType);
158 
160  void removeWantsVertexSelection(DtElementEntry::ElementType);
161 
163  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 ()> signal_selectionModeChanged;
186 
188  virtual void addSelectableObjectType(DtElementEntry::ElementType type,
189  SelectionMode = SelectionModeAll);
190  virtual void removeSelectableObjectType(DtElementEntry::ElementType type,
191  SelectionMode);
192  virtual void removeSelectableObjectTypeFromAllModes(
194  virtual bool objectTypeSelectable( DtElementEntry::ElementType type,
195  SelectionMode mode ) const;
196 
198  virtual bool objectTypeSelectable( DtElementEntry::ObjectType type) const;
200 
203  static SelectionOperation selectionOperationForMouseEvent(
204  const DtMouseEvent& mouseEvent);
205 
209  static bool typeSupportsMultipleSelection(DtElementEntry::ObjectType type,
210  bool vertexSelectsParent );
211 
212  protected:
213 
216 
218  void addToCurrentSelection( DtUniqueID id );
219 
221  void removeFromCurrentSelection( DtUniqueID id );
222 
224  void announceCurrentSelectionChanged( const IdSet& selected,
225  const IdSet& deselected, SelectionType oldType );
226 
227  void updateSelectionDisplay( const IdSet& selected,
228  const IdSet& deselected );
229 
230  void updateSelectionType();
231 
233  SelectionType elementSelectionType( DtElementEntry* entry ) const;
234 
235  void convertVertexIdsToParentIds( const IdSet& in, IdSet& out );
236 
237  protected:
238  typedef std::set<DtElementEntry::ElementType> WantsVertexSelection;
239  typedef std::set<DtElementEntry::ElementType> ElementTypeSet;
240  typedef boost::unordered_map<SelectionMode, ElementTypeSet>
242  typedef std::queue<IdSet> IdSetQueue;
243 
244 
256  };
257 }
258 

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)