vtkSubsetInclusionLattice.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSubsetInclusionLattice.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
61 #ifndef vtkSubsetInclusionLattice_h
62 #define vtkSubsetInclusionLattice_h
63 
64 #include "vtkObject.h"
65 
66 #include "vtkNew.h" // For vtkNew.
67 #include "vtkPVVTKExtensionsCoreModule.h" // For export macro
68 #include "vtkSmartPointer.h" // For vtkSmartPointer
69 #include <map> // for std::map
70 #include <vector> // for std::vector
71 
72 class vtkInformation;
75 
77 {
78 public:
81  void PrintSelf(ostream& os, vtkIndent indent) override;
82 
86  void Initialize();
87 
91  std::string Serialize() const;
92 
94 
97  bool Deserialize(const std::string& data);
98  bool Deserialize(const char* data);
100 
104  void DeepCopy(const vtkSubsetInclusionLattice* other);
105 
109  void Merge(const std::string& state);
110 
114  void Merge(const vtkSubsetInclusionLattice* other);
115 
125  int AddNode(const char* name, int parent = 0);
126 
132  int AddNodeAtPath(const char* path);
133 
144  bool AddCrossLink(int src, int dst);
145 
162  int FindNode(const char* path) const;
163 
165  {
166  NotSelected = 0,
169  };
170 
178  SelectionStates GetSelectionState(int node) const;
179 
187  SelectionStates GetSelectionState(const char* path) const
188  {
189  return this->GetSelectionState(this->FindNode(path));
190  }
191 
196  bool Select(const char* path);
197 
202  bool Deselect(const char* path);
203 
205 
209  bool Select(int node);
210  bool Deselect(int node);
212 
216  void ClearSelections();
217 
219 
226  bool SelectAll(const char* path);
227  bool DeselectAll(const char* path);
228 
232  vtkGetMacro(SelectionChangeTime, vtkMTimeType);
233 
239  std::vector<int> GetChildren(int node) const;
240 
245  int GetParent(int node, int* childIndex = nullptr) const;
246 
250  const char* GetNodeName(int node) const;
251 
257  using SelectionType = std::map<std::string, bool>;
258 
264  SelectionType GetSelection() const;
265 
269  void SetSelection(const SelectionType& selection);
270 
275  void Modified() override;
276 
283  static vtkInformationObjectBaseKey* SUBSET_INCLUSION_LATTICE();
284 
286 
289  static vtkSubsetInclusionLattice* GetSIL(vtkInformation* info);
290  static vtkSubsetInclusionLattice* GetSIL(vtkInformationVector* v, int i = 0);
292 
297 
298  bool IsMaxedOut();
299 
300 protected:
303 
304 private:
306  void operator=(const vtkSubsetInclusionLattice&) = delete;
307 
308  class vtkInternals;
309  vtkInternals* Internals;
310  friend class vtkInternals;
311 
312  void TriggerSelectionChanged(int node);
313 
314  vtkTimeStamp SelectionChangeTime;
315 };
316 
317 #endif
A directed acyclic graph to manage data hierarchy and relationships between hierarchy nodes...
#define VTKPVVTKEXTENSIONSCORE_EXPORT
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
vtkTypeUInt64 vtkMTimeType
virtual void Modified()
std::map< std::string, bool > SelectionType
This defines the type for selection states for nodes exposed by API.
SelectionStates GetSelectionState(const char *path) const
Get the current state for a node given its path.
static vtkObject * New()
void operator=(const vtkObjectBase &)