VTK  9.0.20210409
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 
35 class vtkCollection;
36 class vtkViewNodeFactory;
37 
38 class VTKRENDERINGSCENEGRAPH_EXPORT vtkViewNode : public vtkObject
39 {
40 public:
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*);
76  virtual vtkViewNode* GetParent();
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 
140 protected:
142  ~vtkViewNode() override;
143 
144  static const char* operation_type_strings[];
145 
146  virtual void Apply(int operation, bool prepass);
147 
149 
156 
158 
162  void PrepareNodes();
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 
186 private:
187  vtkViewNode(const vtkViewNode&) = delete;
188  void operator=(const vtkViewNode&) = delete;
189 };
190 
191 #endif
vtkViewNode::Build
virtual void Build(bool)
Builds myself.
Definition: vtkViewNode.h:54
vtkX3D::type
@ type
Definition: vtkX3D.h:522
vtkViewNode::Synchronize
virtual void Synchronize(bool)
Ensures that my state agrees with my Renderable's.
Definition: vtkViewNode.h:59
vtkViewNode::GetViewNodeFor
vtkViewNode * GetViewNodeFor(vtkObject *)
Returns the view node that corresponding to the provided object Will return NULL if a match is not fo...
vtkViewNode::build
@ build
Definition: vtkViewNode.h:134
vtkViewNode::RemoveUnusedNodes
void RemoveUnusedNodes()
Called after PrepareNodes and AddMissingNodes removes any extra leftover nodes.
vtkViewNode::synchronize
@ synchronize
Definition: vtkViewNode.h:135
vtkViewNode::MyFactory
vtkViewNodeFactory * MyFactory
Definition: vtkViewNode.h:179
vtkViewNode::Children
std::list< vtkViewNode * > Children
Definition: vtkViewNode.h:178
vtkViewNode::render
@ render
Definition: vtkViewNode.h:136
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:63
vtkViewNode::AddMissingNodes
void AddMissingNodes(vtkCollection *col)
vtkViewNode::Used
bool Used
Definition: vtkViewNode.h:184
vtkViewNode::operation_type
operation_type
internal mechanics of graph traversal and actions
Definition: vtkViewNode.h:132
vtkViewNode::TraverseAllPasses
virtual void TraverseAllPasses()
vtkCollection
create and manipulate ordered lists of objects
Definition: vtkCollection.h:53
vtkViewNode::SetRenderable
virtual void SetRenderable(vtkObject *)
Allow explicit setting of the renderable for a view node.
vtkViewNode::RenderTime
vtkMTimeType RenderTime
Allows smart caching.
Definition: vtkViewNode.h:126
vtkViewNode::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkViewNodeFactory
factory that chooses vtkViewNodes to create
Definition: vtkViewNodeFactory.h:34
vtkViewNode::PrepareNodes
void PrepareNodes()
Called first before adding missing nodes.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkViewNode::~vtkViewNode
~vtkViewNode() override
vtkViewNode::Render
virtual void Render(bool)
Makes calls to make self visible.
Definition: vtkViewNode.h:64
vtkViewNode::Renderables
std::map< vtkObject *, vtkViewNode * > Renderables
Definition: vtkViewNode.h:180
vtkWeakPointer.h
vtkViewNode::GetChildren
virtual std::list< vtkViewNode * > const & GetChildren()
Access nodes that this one owns.
Definition: vtkViewNode.h:83
vtkViewNode
a node within a VTK scene graph
Definition: vtkViewNode.h:39
vtkViewNode::noop
@ noop
Definition: vtkViewNode.h:133
vtkViewNode::GetParent
virtual vtkViewNode * GetParent()
vtkObject.h
vtkViewNode::Parent
vtkWeakPointer< vtkViewNode > Parent
Definition: vtkViewNode.h:177
vtkViewNode::Apply
virtual void Apply(int operation, bool prepass)
vtkViewNode::Renderable
vtkObject * Renderable
Definition: vtkViewNode.h:176
vtkViewNode::GetFirstChildOfType
vtkViewNode * GetFirstChildOfType(const char *type)
Find the first child of the desired type.
vtkViewNode::CreateViewNode
virtual vtkViewNode * CreateViewNode(vtkObject *obj)
Create the correct ViewNode subclass for the passed in object.
vtkViewNode::Invalidate
virtual void Invalidate(bool)
Clear any cached data.
Definition: vtkViewNode.h:69
vtkViewNode::SetParent
virtual void SetParent(vtkViewNode *)
Access the node that owns this one.
vtkViewNode::vtkViewNode
vtkViewNode()
vtkViewNode::SetMyFactory
virtual void SetMyFactory(vtkViewNodeFactory *)
A factory that creates particular subclasses for different rendering back ends.
vtkViewNode::GetFirstAncestorOfType
vtkViewNode * GetFirstAncestorOfType(const char *type)
Find the first parent/grandparent of the desired type.
vtkWeakPointer< vtkViewNode >
vtkViewNode::AddMissingNode
void AddMissingNode(vtkObject *obj)
convenience method to add node or nodes if missing from our current list
vtkViewNode::Traverse
virtual void Traverse(int operation)
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293