VTK  9.4.20241219
vtkViewNode.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
17#ifndef vtkViewNode_h
18#define vtkViewNode_h
19
20#include "vtkObject.h"
21#include "vtkRenderingSceneGraphModule.h" // For export macro
22#include "vtkWeakPointer.h" //avoid ref loop to parent
23#include <list> // for ivar
24#include <map> // for ivar
25
26VTK_ABI_NAMESPACE_BEGIN
27class vtkCollection;
29
30class VTKRENDERINGSCENEGRAPH_EXPORT vtkViewNode : public vtkObject
31{
32public:
33 vtkTypeMacro(vtkViewNode, vtkObject);
34 void PrintSelf(ostream& os, vtkIndent indent) override;
35
37
40 vtkGetObjectMacro(Renderable, vtkObject);
42
46 virtual void Build(bool /* prepass */) {}
47
51 virtual void Synchronize(bool /* prepass */) {}
52
56 virtual void Render(bool /*prepass*/) {}
57
61 virtual void Invalidate(bool /*prepass*/) {}
62
64
67 virtual void SetParent(vtkViewNode*);
70
72
75 virtual std::list<vtkViewNode*> const& GetChildren() { return this->Children; }
77
79
84 vtkGetObjectMacro(MyFactory, vtkViewNodeFactory);
86
92
97
102
107 virtual void SetRenderable(vtkObject*);
108
109 // if you want to traverse your children in a specific order
110 // or way override this method
111 virtual void Traverse(int operation);
112
113 virtual void TraverseAllPasses();
114
119
124 {
129 invalidate
130 };
131
132protected:
134 ~vtkViewNode() override;
135
136 static const char* operation_type_strings[];
137
138 virtual void Apply(int operation, bool prepass);
139
141
148
150
156
162
167
170 std::list<vtkViewNode*> Children;
172 std::map<vtkObject*, vtkViewNode*> Renderables;
173 friend class vtkViewNodeFactory;
174
175 // used in the prepare/add/remove operations
176 bool Used;
177
178private:
179 vtkViewNode(const vtkViewNode&) = delete;
180 void operator=(const vtkViewNode&) = delete;
181};
182
183VTK_ABI_NAMESPACE_END
184#endif
create and manipulate ordered lists of objects
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
factory that chooses vtkViewNodes to create
a node within a VTK scene graph
Definition vtkViewNode.h:31
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:56
~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:46
virtual void Invalidate(bool)
Clear any cached data.
Definition vtkViewNode.h:61
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:75
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:51
virtual void SetParent(vtkViewNode *)
Access the node that owns this one.
a weak reference to a vtkObject.
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270