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
38class vtkCollection;
40
41class VTKRENDERINGSCENEGRAPH_EXPORT vtkViewNode : public vtkObject
42{
43public:
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*);
81
83
86 virtual std::list<vtkViewNode*> const& GetChildren() { return this->Children; }
88
90
95 vtkGetObjectMacro(MyFactory, vtkViewNodeFactory);
97
103
108
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
143protected:
145 ~vtkViewNode() override;
146
147 static const char* operation_type_strings[];
148
149 virtual void Apply(int operation, bool prepass);
150
152
159
161
167
173
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
189private:
190 vtkViewNode(const vtkViewNode&) = delete;
191 void operator=(const vtkViewNode&) = delete;
192};
193
194#endif
create and manipulate ordered lists of objects
a simple class to control print indentation
Definition vtkIndent.h:40
abstract base class for most VTK objects
Definition vtkObject.h:63
factory that chooses vtkViewNodes to create
a node within a VTK scene graph
Definition vtkViewNode.h:42
virtual void SetRenderable(vtkObject *)
Allow explicit setting of the renderable for a view node.
virtual void Apply(int operation, bool prepass)
virtual void TraverseAllPasses()
vtkWeakPointer< vtkViewNode > Parent
void AddMissingNodes(vtkCollection *col)
convenience method to add node or nodes if missing from our current list
std::list< vtkViewNode * > Children
virtual vtkViewNode * GetParent()
Access the node that owns this one.
vtkViewNode * GetViewNodeFor(vtkObject *)
Returns the view node that corresponding to the provided object Will return NULL if a match is not fo...
virtual void Render(bool)
Makes calls to make self visible.
Definition vtkViewNode.h:67
~vtkViewNode() override
void RemoveUnusedNodes()
Called after PrepareNodes and AddMissingNodes removes any extra leftover nodes.
vtkObject * Renderable
vtkViewNode * GetFirstChildOfType(const char *type)
Find the first child of the desired type.
vtkMTimeType RenderTime
Allows smart caching.
vtkViewNodeFactory * MyFactory
operation_type
internal mechanics of graph traversal and actions
std::map< vtkObject *, vtkViewNode * > Renderables
void AddMissingNode(vtkObject *obj)
convenience method to add node or nodes if missing from our current list
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void PrepareNodes()
Called first before adding missing nodes.
virtual void Traverse(int operation)
virtual void Build(bool)
Builds myself.
Definition vtkViewNode.h:57
virtual void Invalidate(bool)
Clear any cached data.
Definition vtkViewNode.h:72
vtkViewNode * GetFirstAncestorOfType(const char *type)
Find the first parent/grandparent of the desired type.
virtual std::list< vtkViewNode * > const & GetChildren()
Access nodes that this one owns.
Definition vtkViewNode.h:86
virtual void SetMyFactory(vtkViewNodeFactory *)
A factory that creates particular subclasses for different rendering back ends.
virtual vtkViewNode * CreateViewNode(vtkObject *obj)
Create the correct ViewNode subclass for the passed in object.
virtual void Synchronize(bool)
Ensures that my state agrees with my Renderable's.
Definition vtkViewNode.h:62
virtual void SetParent(vtkViewNode *)
Access the node that owns this one.
a weak reference to a vtkObject.
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287