VTK  9.2.6
vtkViewNode.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkViewNode.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 =========================================================================*/
29 #ifndef vtkViewNode_h
30 #define vtkViewNode_h
31 
32 #include "vtkObject.h"
33 #include "vtkRenderingSceneGraphModule.h" // For export macro
34 #include "vtkWeakPointer.h" //avoid ref loop to parent
35 #include <list> // for ivar
36 #include <map> // for ivar
37 
38 class vtkCollection;
39 class vtkViewNodeFactory;
40 
41 class VTKRENDERINGSCENEGRAPH_EXPORT vtkViewNode : public vtkObject
42 {
43 public:
44  vtkTypeMacro(vtkViewNode, vtkObject);
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
48 
51  vtkGetObjectMacro(Renderable, vtkObject);
53 
57  virtual void Build(bool /* prepass */) {}
58 
62  virtual void Synchronize(bool /* prepass */) {}
63 
67  virtual void Render(bool /*prepass*/) {}
68 
72  virtual void Invalidate(bool /*prepass*/) {}
73 
75 
78  virtual void SetParent(vtkViewNode*);
79  virtual vtkViewNode* GetParent();
81 
83 
86  virtual std::list<vtkViewNode*> const& GetChildren() { return this->Children; }
88 
90 
94  virtual void SetMyFactory(vtkViewNodeFactory*);
95  vtkGetObjectMacro(MyFactory, vtkViewNodeFactory);
97 
102  vtkViewNode* GetViewNodeFor(vtkObject*);
103 
107  vtkViewNode* GetFirstAncestorOfType(const char* type);
108 
112  vtkViewNode* GetFirstChildOfType(const char* type);
113 
118  virtual void SetRenderable(vtkObject*);
119 
120  // if you want to traverse your children in a specific order
121  // or way override this method
122  virtual void Traverse(int operation);
123 
124  virtual void TraverseAllPasses();
125 
130 
135  {
140  invalidate
141  };
142 
143 protected:
144  vtkViewNode();
145  ~vtkViewNode() override;
146 
147  static const char* operation_type_strings[];
148 
149  virtual void Apply(int operation, bool prepass);
150 
152 
156  void AddMissingNode(vtkObject* obj);
157  void AddMissingNodes(vtkCollection* col);
159 
161 
165  void PrepareNodes();
167 
172  void RemoveUnusedNodes();
173 
177  virtual vtkViewNode* CreateViewNode(vtkObject* obj);
178 
181  std::list<vtkViewNode*> Children;
183  std::map<vtkObject*, vtkViewNode*> Renderables;
184  friend class vtkViewNodeFactory;
185 
186  // used in the prepare/add/remove operations
187  bool Used;
188 
189 private:
190  vtkViewNode(const vtkViewNode&) = delete;
191  void operator=(const vtkViewNode&) = delete;
192 };
193 
194 #endif
virtual void Build(bool)
Builds myself.
Definition: vtkViewNode.h:57
vtkViewNodeFactory * MyFactory
Definition: vtkViewNode.h:182
std::list< vtkViewNode * > Children
Definition: vtkViewNode.h:181
abstract base class for most VTK objects
Definition: vtkObject.h:62
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
operation_type
internal mechanics of graph traversal and actions
Definition: vtkViewNode.h:134
virtual void Synchronize(bool)
Ensures that my state agrees with my Renderable's.
Definition: vtkViewNode.h:62
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual std::list< vtkViewNode * > const & GetChildren()
Access nodes that this one owns.
Definition: vtkViewNode.h:86
vtkWeakPointer< vtkViewNode > Parent
Definition: vtkViewNode.h:180
vtkMTimeType RenderTime
Allows smart caching.
Definition: vtkViewNode.h:129
std::map< vtkObject *, vtkViewNode * > Renderables
Definition: vtkViewNode.h:183
factory that chooses vtkViewNodes to create
virtual void Render(bool)
Makes calls to make self visible.
Definition: vtkViewNode.h:67
virtual void Invalidate(bool)
Clear any cached data.
Definition: vtkViewNode.h:72
create and manipulate ordered lists of objects
Definition: vtkCollection.h:55
vtkObject * Renderable
Definition: vtkViewNode.h:179
a node within a VTK scene graph
Definition: vtkViewNode.h:41