VTK
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 "vtkRenderingSceneGraphModule.h" // For export macro
33 #include "vtkWeakPointer.h" //avoid ref loop to parent
34 #include "vtkObject.h"
35 
36 class vtkCollection;
37 class vtkViewNodeFactory;
39 
40 class VTKRENDERINGSCENEGRAPH_EXPORT vtkViewNode :
41  public vtkObject
42 {
43 public:
44  vtkTypeMacro(vtkViewNode, vtkObject);
45  void PrintSelf(ostream& os, vtkIndent indent);
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*);
79  virtual vtkViewNode * GetParent();
81 
83 
86  virtual void SetChildren(vtkViewNodeCollection*);
87  vtkGetObjectMacro(Children, vtkViewNodeCollection);
89 
91 
95  virtual void SetMyFactory(vtkViewNodeFactory*);
96  vtkGetObjectMacro(MyFactory, vtkViewNodeFactory);
98 
103  vtkViewNode* GetViewNodeFor(vtkObject *);
104 
108  vtkViewNode *GetFirstAncestorOfType(const char *type);
109 
114  virtual void SetRenderable(vtkObject *);
115 
116  // if you want to traverse your children in a specific order
117  // or way override this method
118  virtual void Traverse(int operation);
119 
120  virtual void TraverseAllPasses();
121 
126 
130  enum operation_type{noop, build, synchronize, render, invalidate};
131 
132 protected:
133  vtkViewNode();
134  ~vtkViewNode();
135 
136  static const char* operation_type_strings[];
137 
138  void Apply(int operation, bool prepass);
139 
141 
145  void AddMissingNode(vtkObject *obj);
146  void AddMissingNodes(vtkCollection *col);
148 
150 
154  void PrepareNodes();
157 
162  void RemoveUnusedNodes();
163 
167  virtual vtkViewNode *CreateViewNode(vtkObject *obj);
168 
173 
174  friend class vtkViewNodeFactory;
175 
176 private:
177  vtkViewNode(const vtkViewNode&) VTK_DELETE_FUNCTION;
178  void operator=(const vtkViewNode&) VTK_DELETE_FUNCTION;
179 };
180 
181 #endif
virtual void Build(bool)
Builds myself.
Definition: vtkViewNode.h:57
vtkViewNodeFactory * MyFactory
Definition: vtkViewNode.h:172
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCollection * PreparedNodes
Called first before adding missing nodes.
Definition: vtkViewNode.h:155
operation_type
internal mechanics of graph traversal and actions
Definition: vtkViewNode.h:130
virtual void Synchronize(bool)
Ensures that my state agrees with my Renderable's.
Definition: vtkViewNode.h:62
collection of view nodes
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkWeakPointer< vtkViewNode > Parent
Definition: vtkViewNode.h:170
vtkMTimeType RenderTime
Allows smart caching.
Definition: vtkViewNode.h:125
factory that chooses vtkViewNodes to create
virtual void Render(bool)
Makes calls to make self visible.
Definition: vtkViewNode.h:67
vtkViewNodeCollection * Children
Definition: vtkViewNode.h:171
virtual void Invalidate(bool)
Clear any cached data.
Definition: vtkViewNode.h:72
create and manipulate unsorted lists of objects
Definition: vtkCollection.h:51
vtkObject * Renderable
Definition: vtkViewNode.h:169
a node within a VTK scene graph
Definition: vtkViewNode.h:40