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 =========================================================================*/
28 #ifndef vtkCompositePolyDataMapper2_h
29 #define vtkCompositePolyDataMapper2_h
30 
31 #include "vtkRenderingOpenGL2Module.h" // For export macro
32 #include "vtkSmartPointer.h" // for vtkSmartPointer
34 
35 #include "vtkColor.h" // used for ivars
36 #include <map> // use for ivars
37 #include <stack> // used for ivars
38 
40 class vtkCompositeMapperHelper2;
41 class vtkCompositeMapperHelperData;
42 
43 class VTKRENDERINGOPENGL2_EXPORT vtkCompositePolyDataMapper2 : public vtkOpenGLPolyDataMapper
44 {
45 public:
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
60  virtual bool GetIsOpaque();
61 
63 
66  void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes *attributes);
67  vtkCompositeDataDisplayAttributes* GetCompositeDataDisplayAttributes();
69 
71 
74  void SetBlockVisibility(unsigned int index, bool visible);
75  bool GetBlockVisibility(unsigned int index) const;
76  void RemoveBlockVisibility(unsigned int index);
77  void RemoveBlockVisibilites();
79 
81 
84  void SetBlockColor(unsigned int index, double color[3]);
85  void SetBlockColor(unsigned int index, double r, double g, double b)
86  {
87  double color[3] = {r, g, b};
88  this->SetBlockColor(index, color);
89  }
90  double* GetBlockColor(unsigned int index);
91  void RemoveBlockColor(unsigned int index);
92  void RemoveBlockColors();
94 
96 
99  void SetBlockOpacity(unsigned int index, double opacity);
100  double GetBlockOpacity(unsigned int index);
101  void RemoveBlockOpacity(unsigned int index);
102  void RemoveBlockOpacities();
104 
111  vtkSetMacro(ColorMissingArraysWithNanColor, bool)
112  vtkGetMacro(ColorMissingArraysWithNanColor, bool)
113  vtkBooleanMacro(ColorMissingArraysWithNanColor, bool)
122 
126  virtual void Render(vtkRenderer *ren, vtkActor *act);
127 
128 protected:
131 
138 
143 
147  virtual void ComputeBounds();
148 
152  vtkTimeStamp BoundsMTime;
153 
154  // what "index" are we currently rendering, -1 means none
156  std::map<const std::string, vtkCompositeMapperHelper2 *> Helpers;
157  std::map<vtkPolyData *, vtkCompositeMapperHelperData *> HelperDataMap;
159 
160  // copy values to the helpers
161  void CopyMapperValuesToHelper(vtkCompositeMapperHelper2 *helper);
162 
164  {
165  public:
166  std::stack<bool> Visibility;
167  std::stack<double> Opacity;
168  std::stack<vtkColor3d> AmbientColor;
169  std::stack<vtkColor3d> DiffuseColor;
170  std::stack<vtkColor3d> SpecularColor;
171  };
172 
173  void BuildRenderValues(vtkRenderer *renderer,
174  vtkActor *actor,
175  vtkDataObject *dobj,
176  unsigned int &flat_index);
178 
180  void RenderBlock(vtkRenderer *renderer,
181  vtkActor *actor,
182  vtkDataObject *dobj,
183  unsigned int &flat_index);
184 
189 
190  friend class vtkCompositeMapperHelper2;
191 
197 
198 private:
199  vtkMTimeType LastOpaqueCheckTime;
200  bool LastOpaqueCheckValue;
201  double ColorResult[3];
202 
203  vtkCompositePolyDataMapper2(const vtkCompositePolyDataMapper2&) VTK_DELETE_FUNCTION;
204  void operator=(const vtkCompositePolyDataMapper2&) VTK_DELETE_FUNCTION;
205 
206 };
207 
208 #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:37
a simple class to control print indentation
Definition: vtkIndent.h:39
std::map< const std::string, vtkCompositeMapperHelper2 * > Helpers
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
bool ColorMissingArraysWithNanColor
If the current &#39;color by&#39; array is missing on some datasets, color these dataset by the LookupTable&#39;s...
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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.