ufe  2.0
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
selection.h
Go to the documentation of this file.
1 #line 1 "S:/jenkins/workspace/ufe-full-windows/ufe/include/selection.h"
2 #ifndef _ufeSelection
3 #define _ufeSelection
4 // ===========================================================================
5 // Copyright 2020 Autodesk, Inc. All rights reserved.
6 //
7 // Use of this software is subject to the terms of the Autodesk license
8 // agreement provided at the time of installation or download, or which
9 // otherwise accompanies this software in either electronic or hard copy form.
10 // ===========================================================================
11 
12 #include "sceneItemList.h"
13 #include "sceneItem.h"
14 #include "selectionTrieFwd.h"
15 
16 UFE_NS_DEF {
17 
19 
28 {
29 public:
30 
31  typedef SceneItemList::const_iterator const_iterator;
32  typedef SceneItemList::const_reverse_iterator const_reverse_iterator;
33 
35  Selection();
36 
38  Selection(const Selection&);
39 
41  virtual ~Selection();
42 
44  Selection& operator=(const Selection&);
45 
48 
50  Selection& operator=(Selection&& rhs);
51 
53  std::size_t size() const;
54 
56  bool empty() const;
57 
66  bool append(const SceneItem::Ptr& item);
67 
76  bool remove(const SceneItem::Ptr& item);
77 
88  bool insert(const SceneItem::Ptr& position, const SceneItem::Ptr& item);
89 
94  void clear();
95 
102  void replaceWith(const Selection& selection);
103 
107  bool contains(const Path& path) const;
108 
117  bool containsDescendant(const Path& path) const;
118 
127  bool containsAncestor(const Path& path) const;
128 
135  SceneItem::Ptr closestCommonAncestor() const;
136 
145  SceneItem::Ptr next(const SceneItem::Ptr& item) const;
146 
148  const SceneItem::Ptr& front() const;
150  const SceneItem::Ptr& back() const;
152 
154  const_iterator cbegin() const;
156  const_iterator begin() const;
157  const_iterator cend() const;
158  const_iterator end() const;
159  const_reverse_iterator crbegin() const;
160  const_reverse_iterator rbegin() const;
161  const_reverse_iterator crend() const;
162  const_reverse_iterator rend() const;
164 protected:
165 
167  bool doAppend(const SceneItem::Ptr& item);
173  bool doRemove(const SceneItem::Ptr& item);
174  bool doInsert(const SceneItem::Ptr& position, const SceneItem::Ptr& item);
175  void doClear();
176  void doReplaceWith(const Selection& selection);
178 
180  // Hook methods for append, remove, insert, clear, and replaceWith.
181  // postAppend(), postRemove(), and postInsert() are only called if
182  // doAppend(), doRemove(), and doInsert() return true, respectively.
183  // Implementations in this class do nothing.
184  virtual void postAppend(const SceneItem::Ptr& item);
185  virtual void postRemove(const SceneItem::Ptr& item);
186  virtual void postInsert(
187  const SceneItem::Ptr& position, const SceneItem::Ptr& item
188  );
189  virtual void postClear();
190  virtual void postReplaceWith();
192 private:
193 
194  SceneItemList fList;
195 
197  inline SelectionTrie& trie();
200  inline const SelectionTrie& trie() const;
201 
202  void* fTrieStorage[2];
204 };
205 
206 }
207 
208 #endif /* _ufeSelection */
std::list< std::shared_ptr< SceneItem > > SceneItemList
Definition: sceneItemList.h:19
SceneItemList::const_reverse_iterator const_reverse_iterator
Definition: selection.h:32
Node for Universal Front End trie.
Identify an object or 3D path in the scene.
Definition: path.h:37
Selection list for objects in the scene.
Definition: selection.h:27
#define UFE_NS_DEF
Definition: ufe.h:35
SceneItemList::const_iterator const_iterator
Definition: selection.h:31
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:40
Path path(const std::string &pathString)
#define UFE_SDK_DECL
Definition: ufeExport.h:36