VTK
vtkCompositePolyDataMapper2.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCompositePolyDataMapper2.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 =========================================================================*/
25 #ifndef vtkCompositePolyDataMapper2_h
26 #define vtkCompositePolyDataMapper2_h
27 
28 #include "vtkRenderingOpenGL2Module.h" // For export macro
29 #include "vtkSmartPointer.h" // for vtkSmartPointer
31 
32 #include "vtkColor.h" // used for ivars
33 #include <map> // use for ivars
34 #include <stack> // used for ivars
35 
37 class vtkCompositeMapperHelper2;
38 class vtkCompositeMapperHelperData;
39 
40 class VTKRENDERINGOPENGL2_EXPORT vtkCompositePolyDataMapper2 : public vtkOpenGLPolyDataMapper
41 {
42 public:
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
57  virtual bool GetIsOpaque();
58 
60 
63  void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes *attributes);
64  vtkCompositeDataDisplayAttributes* GetCompositeDataDisplayAttributes();
66 
68 
71  void SetBlockVisibility(unsigned int index, bool visible);
72  bool GetBlockVisibility(unsigned int index) const;
73  void RemoveBlockVisibility(unsigned int index);
74  void RemoveBlockVisibilites();
76 
78 
81  void SetBlockColor(unsigned int index, double color[3]);
82  void SetBlockColor(unsigned int index, double r, double g, double b)
83  {
84  double color[3] = {r, g, b};
85  this->SetBlockColor(index, color);
86  }
87  double* GetBlockColor(unsigned int index);
88  void RemoveBlockColor(unsigned int index);
89  void RemoveBlockColors();
91 
93 
96  void SetBlockOpacity(unsigned int index, double opacity);
97  double GetBlockOpacity(unsigned int index);
98  void RemoveBlockOpacity(unsigned int index);
99  void RemoveBlockOpacities();
101 
108 
112  virtual void Render(vtkRenderer *ren, vtkActor *act);
113 
114 protected:
117 
124 
129 
133  virtual void ComputeBounds();
134 
138  vtkTimeStamp BoundsMTime;
139 
140  // what "index" are we currently rendering, -1 means none
142  std::map<const std::string, vtkCompositeMapperHelper2 *> Helpers;
143  std::map<vtkPolyData *, vtkCompositeMapperHelperData *> HelperDataMap;
145 
146  // copy values to the helpers
147  void CopyMapperValuesToHelper(vtkCompositeMapperHelper2 *helper);
148 
150  {
151  public:
152  std::stack<bool> Visibility;
153  std::stack<double> Opacity;
154  std::stack<vtkColor3d> AmbientColor;
155  std::stack<vtkColor3d> DiffuseColor;
156  std::stack<vtkColor3d> SpecularColor;
157  };
158 
159  void BuildRenderValues(vtkRenderer *renderer,
160  vtkActor *actor,
161  vtkDataObject *dobj,
162  unsigned int &flat_index);
164 
166  void RenderBlock(vtkRenderer *renderer,
167  vtkActor *actor,
168  vtkDataObject *dobj,
169  unsigned int &flat_index);
170 
175 
176  friend class vtkCompositeMapperHelper2;
177 
178 private:
179  vtkMTimeType LastOpaqueCheckTime;
180  bool LastOpaqueCheckValue;
181  double ColorResult[3];
182 
183  vtkCompositePolyDataMapper2(const vtkCompositePolyDataMapper2&) VTK_DELETE_FUNCTION;
184  void operator=(const vtkCompositePolyDataMapper2&) VTK_DELETE_FUNCTION;
185 
186 };
187 
188 #endif
a PolyDataMapper for the OpenGL library
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
virtual int FillInputPortInformation(int, vtkInformation *)
Fill the input port information objects for this algorithm.
static vtkOpenGLPolyDataMapper * New()
virtual vtkExecutive * CreateDefaultExecutive()
Create a default executive.
Store vtkAlgorithm input/output information.
mapper for composite dataset consisting of polygonal data.
record modification and/or execution time
Definition: vtkTimeStamp.h:35
rendering attributes for a multi-block dataset.
abstract specification for renderers
Definition: vtkRenderer.h:63
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:49
std::map< vtkPolyData *, vtkCompositeMapperHelperData * > HelperDataMap
virtual void ComputeBounds()
Called in GetBounds().
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
void SetBlockColor(unsigned int index, double r, double g, double b)
Set/get the color for a block given its flat index.
virtual bool GetIsOpaque()
Returns if the mapper does not expect to have translucent geometry.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
a simple class to control print indentation
Definition: vtkIndent.h:39
std::map< const std::string, vtkCompositeMapperHelper2 * > Helpers
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
virtual void Render(vtkRenderer *ren, vtkActor *act)
This calls RenderPiece (in a for loop if streaming is necessary).
general representation of visualization data
Definition: vtkDataObject.h:64
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.