VR-Forces 4.1 Class Documentation
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  {
57  Mixed
58  };
59 
61  {
62  NoOperation = 0,
68  MaintainSelectionIfSelected
72  };
73 
75  static DtSelectionManager& instance(DtDe& de);
76 
79 
81  void performSelectionOperation(SelectionOperation op, const IdSet& ids);
82 
84  void setCurrentSelections( const IdSet& selections );
85 
87  const DtSelectionManager::IdSet& currentSelections() const;
88 
90  void addToCurrentSelection( const IdSet& adds );
91 
95  void maintainCurrentSelectionIfSelected( const IdSet& maintain );
96 
98  void removeFromCurrentSelection( const IdSet& removes );
99 
102  void toggleFromCurrentSelection( const IdSet& toggles );
103 
105  void removeFromCurrentSelection(
106  const DtElementData::UniqueIdList& removes );
107 
109  SelectionMode selectionMode() const;
110  void setSelectionMode( SelectionMode mode );
111 
117  bool isSelectable( DtUniqueID id ) const;
118 
122  bool isSelectable( const DtElementEntry* entry ) const;
123 
125  bool isSelected( DtUniqueID id ) const;
126 
127  SelectionType selectionType() const;
128 
131  virtual bool propSelectionMajorityTransparent();
132 
134  virtual void slot_onElementsRemoved(
135  const DtElementData::UniqueIdList& elementIds);
136 
138  virtual void backupCurrentSelection();
139 
142  virtual bool restoreCurrentSelection();
143 
144  bool selectionIsVertex( const IdSet& selection );
145 
146  bool objectIsVertex( const DtUniqueID& id );
147  DtUniqueID parentId( const DtUniqueID& id );
148 
153  virtual bool allItemsWantVertexSelection(const IdSet&) const;
154 
156  void addWantsVertexSelection(DtElementEntry::ElementType);
157 
159  void removeWantsVertexSelection(DtElementEntry::ElementType);
160 
162  bool wantsVertexSelection(DtElementID) const;
163 
165  boost::signal<void (const IdSet& selected, const IdSet& deselected,
166  SelectionType newType,
168 
171  boost::signal<void (const DtUniqueID& id, const DtUniqueID& parentId)>
173 
176  boost::signal<void (const DtUniqueID& id, const DtUniqueID& parentId)>
178 
181  boost::signal<void (const IdSet& entityIds)> signal_entityInfoToggled;
182 
184  boost::signal<void ()> signal_selectionModeChanged;
185 
187  virtual void addSelectableObjectType(DtElementEntry::ElementType type,
188  SelectionMode = SelectionModeAll);
189  virtual void removeSelectableObjectType(DtElementEntry::ElementType type,
190  SelectionMode);
191  virtual void removeSelectableObjectTypeFromAllModes(
193  virtual bool objectTypeSelectable( DtElementEntry::ElementType type,
194  SelectionMode mode ) const;
195 
197  virtual bool objectTypeSelectable( DtElementEntry::ObjectType type) const;
199 
202  static SelectionOperation selectionOperationForMouseEvent(
203  const DtMouseEvent& mouseEvent);
204 
208  static bool typeSupportsMultipleSelection(DtElementEntry::ObjectType type,
209  bool vertexSelectsParent );
210 
211  protected:
212 
215 
217  void addToCurrentSelection( DtUniqueID id );
218 
220  void removeFromCurrentSelection( DtUniqueID id );
221 
223  void announceCurrentSelectionChanged( const IdSet& selected,
224  const IdSet& deselected, SelectionType oldType );
225 
226  void updateSelectionDisplay( const IdSet& selected,
227  const IdSet& deselected );
228 
229  void updateSelectionType();
230 
232  SelectionType elementSelectionType( DtElementEntry* entry ) const;
233 
234  void convertVertexIdsToParentIds( const IdSet& in, IdSet& out );
235 
236  protected:
237  typedef std::set<DtElementEntry::ElementType> WantsVertexSelection;
238  typedef std::set<DtElementEntry::ElementType> ElementTypeSet;
239  typedef boost::unordered_map<SelectionMode, ElementTypeSet>
241  typedef std::queue<IdSet> IdSetQueue;
242 
243 
255  };
256 }
257 

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)