VTK  9.0.1
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 =========================================================================*/
26 #ifndef vtkViewNode_h
27 #define vtkViewNode_h
28 
29 #include "vtkObject.h"
30 #include "vtkRenderingSceneGraphModule.h" // For export macro
31 #include "vtkWeakPointer.h" //avoid ref loop to parent
32 
33 class vtkCollection;
34 class vtkViewNodeFactory;
36 
37 class VTKRENDERINGSCENEGRAPH_EXPORT vtkViewNode : public vtkObject
38 {
39 public:
40  vtkTypeMacro(vtkViewNode, vtkObject);
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
44 
47  vtkGetObjectMacro(Renderable, vtkObject);
49 
53  virtual void Build(bool /* prepass */) {}
54 
58  virtual void Synchronize(bool /* prepass */) {}
59 
63  virtual void Render(bool /*prepass*/) {}
64 
68  virtual void Invalidate(bool /*prepass*/) {}
69 
71 
74  virtual void SetParent(vtkViewNode*);
75  virtual vtkViewNode* GetParent();
77 
79 
82  virtual void SetChildren(vtkViewNodeCollection*);
83  vtkGetObjectMacro(Children, vtkViewNodeCollection);
85 
87 
91  virtual void SetMyFactory(vtkViewNodeFactory*);
92  vtkGetObjectMacro(MyFactory, vtkViewNodeFactory);
94 
99  vtkViewNode* GetViewNodeFor(vtkObject*);
100 
104  vtkViewNode* GetFirstAncestorOfType(const char* type);
105 
109  vtkViewNode* GetFirstChildOfType(const char* type);
110 
115  virtual void SetRenderable(vtkObject*);
116 
117  // if you want to traverse your children in a specific order
118  // or way override this method
119  virtual void Traverse(int operation);
120 
121  virtual void TraverseAllPasses();
122 
127 
132  {
137  invalidate
138  };
139 
140 protected:
141  vtkViewNode();
142  ~vtkViewNode() override;
143 
144  static const char* operation_type_strings[];
145 
146  void Apply(int operation, bool prepass);
147 
149 
153  void AddMissingNode(vtkObject* obj);
154  void AddMissingNodes(vtkCollection* col);
156 
158 
162  void PrepareNodes();
165 
170  void RemoveUnusedNodes();
171 
175  virtual vtkViewNode* CreateViewNode(vtkObject* obj);
176 
181 
182  friend class vtkViewNodeFactory;
183 
184 private:
185  vtkViewNode(const vtkViewNode&) = delete;
186  void operator=(const vtkViewNode&) = delete;
187 };
188 
189 #endif
virtual void Build(bool)
Builds myself.
Definition: vtkViewNode.h:53
vtkViewNodeFactory * MyFactory
Definition: vtkViewNode.h:180
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:293
vtkCollection * PreparedNodes
Called first before adding missing nodes.
Definition: vtkViewNode.h:163
operation_type
internal mechanics of graph traversal and actions
Definition: vtkViewNode.h:131
virtual void Synchronize(bool)
Ensures that my state agrees with my Renderable's.
Definition: vtkViewNode.h:58
collection of view nodes
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkWeakPointer< vtkViewNode > Parent
Definition: vtkViewNode.h:178
vtkMTimeType RenderTime
Allows smart caching.
Definition: vtkViewNode.h:126
factory that chooses vtkViewNodes to create
virtual void Render(bool)
Makes calls to make self visible.
Definition: vtkViewNode.h:63
vtkViewNodeCollection * Children
Definition: vtkViewNode.h:179
virtual void Invalidate(bool)
Clear any cached data.
Definition: vtkViewNode.h:68
create and manipulate ordered lists of objects
Definition: vtkCollection.h:52
vtkObject * Renderable
Definition: vtkViewNode.h:177
a node within a VTK scene graph
Definition: vtkViewNode.h:37