VTK  9.1.0
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#include <list> // for ivar
33#include <map> // for ivar
34
35class vtkCollection;
37
38class VTKRENDERINGSCENEGRAPH_EXPORT vtkViewNode : public vtkObject
39{
40public:
41 vtkTypeMacro(vtkViewNode, vtkObject);
42 void PrintSelf(ostream& os, vtkIndent indent) override;
43
45
48 vtkGetObjectMacro(Renderable, vtkObject);
50
54 virtual void Build(bool /* prepass */) {}
55
59 virtual void Synchronize(bool /* prepass */) {}
60
64 virtual void Render(bool /*prepass*/) {}
65
69 virtual void Invalidate(bool /*prepass*/) {}
70
72
75 virtual void SetParent(vtkViewNode*);
78
80
83 virtual std::list<vtkViewNode*> const& GetChildren() { return this->Children; }
85
87
92 vtkGetObjectMacro(MyFactory, vtkViewNodeFactory);
94
100
105
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
140protected:
142 ~vtkViewNode() override;
143
144 static const char* operation_type_strings[];
145
146 virtual void Apply(int operation, bool prepass);
147
149
156
158
164
170
175
178 std::list<vtkViewNode*> Children;
180 std::map<vtkObject*, vtkViewNode*> Renderables;
181 friend class vtkViewNodeFactory;
182
183 // used in the prepare/add/remove opertions
184 bool Used;
185
186private:
187 vtkViewNode(const vtkViewNode&) = delete;
188 void operator=(const vtkViewNode&) = delete;
189};
190
191#endif
create and manipulate ordered lists of objects
Definition: vtkCollection.h:53
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:73
factory that chooses vtkViewNodes to create
a node within a VTK scene graph
Definition: vtkViewNode.h:39
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
Definition: vtkViewNode.h:177
void AddMissingNodes(vtkCollection *col)
convenience method to add node or nodes if missing from our current list
std::list< vtkViewNode * > Children
Definition: vtkViewNode.h:178
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:64
~vtkViewNode() override
void RemoveUnusedNodes()
Called after PrepareNodes and AddMissingNodes removes any extra leftover nodes.
vtkObject * Renderable
Definition: vtkViewNode.h:176
vtkViewNode * GetFirstChildOfType(const char *type)
Find the first child of the desired type.
vtkMTimeType RenderTime
Allows smart caching.
Definition: vtkViewNode.h:126
vtkViewNodeFactory * MyFactory
Definition: vtkViewNode.h:179
operation_type
internal mechanics of graph traversal and actions
Definition: vtkViewNode.h:132
std::map< vtkObject *, vtkViewNode * > Renderables
Definition: vtkViewNode.h:180
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:54
virtual void Invalidate(bool)
Clear any cached data.
Definition: vtkViewNode.h:69
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:83
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:59
virtual void SetParent(vtkViewNode *)
Access the node that owns this one.
@ type
Definition: vtkX3D.h:522
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287