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 #include <vector> // used for ivars
36 
40 
41 class VTKRENDERINGOPENGL2_EXPORT vtkCompositePolyDataMapper2 : public vtkOpenGLPolyDataMapper
42 {
43 public:
46  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
47 
58  bool GetIsOpaque() VTK_OVERRIDE;
59 
61 
64  void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes *attributes);
65  vtkCompositeDataDisplayAttributes* GetCompositeDataDisplayAttributes();
67 
69 
72  void SetBlockVisibility(unsigned int index, bool visible);
73  bool GetBlockVisibility(unsigned int index) const;
74  void RemoveBlockVisibility(unsigned int index);
75  void RemoveBlockVisibilites();
77 
79 
82  void SetBlockColor(unsigned int index, double color[3]);
83  void SetBlockColor(unsigned int index, double r, double g, double b)
84  {
85  double color[3] = {r, g, b};
86  this->SetBlockColor(index, color);
87  }
88  double* GetBlockColor(unsigned int index);
89  void RemoveBlockColor(unsigned int index);
90  void RemoveBlockColors();
92 
94 
97  void SetBlockOpacity(unsigned int index, double opacity);
98  double GetBlockOpacity(unsigned int index);
99  void RemoveBlockOpacity(unsigned int index);
100  void RemoveBlockOpacities();
102 
109  vtkSetMacro(ColorMissingArraysWithNanColor, bool)
110  vtkGetMacro(ColorMissingArraysWithNanColor, bool)
111  vtkBooleanMacro(ColorMissingArraysWithNanColor, bool)
119  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
120 
124  void Render(vtkRenderer *ren, vtkActor *act) VTK_OVERRIDE;
125 
129  std::vector<vtkPolyData*> GetRenderedList()
130  {
131  return this->RenderedList;
132  }
133 
134 protected:
136  ~vtkCompositePolyDataMapper2() VTK_OVERRIDE;
137 
143  vtkExecutive* CreateDefaultExecutive() VTK_OVERRIDE;
144 
148  int FillInputPortInformation(int port, vtkInformation* info) VTK_OVERRIDE;
149 
153  void ComputeBounds() VTK_OVERRIDE;
154 
158  vtkTimeStamp BoundsMTime;
159 
160  // what "index" are we currently rendering, -1 means none
161  int CurrentFlatIndex;
162  std::map<const std::string, vtkCompositeMapperHelper2 *> Helpers;
163  std::map<vtkPolyData *, vtkCompositeMapperHelperData *> HelperDataMap;
164  vtkTimeStamp HelperMTime;
165 
166  virtual vtkCompositeMapperHelper2 *CreateHelper();
167 
168  // copy values to the helpers
169  virtual void CopyMapperValuesToHelper(vtkCompositeMapperHelper2 *helper);
170 
172  {
173  public:
174  std::stack<bool> Visibility;
175  std::stack<double> Opacity;
176  std::stack<vtkColor3d> AmbientColor;
177  std::stack<vtkColor3d> DiffuseColor;
178  std::stack<vtkColor3d> SpecularColor;
179  };
180 
181  void BuildRenderValues(vtkRenderer *renderer,
182  vtkActor *actor,
183  vtkDataObject *dobj,
184  unsigned int &flat_index);
186 
188  void RenderBlock(vtkRenderer *renderer,
189  vtkActor *actor,
190  vtkDataObject *dobj,
191  unsigned int &flat_index);
192 
197 
199 
205 
206  std::vector<vtkPolyData*> RenderedList;
207 
208 private:
209  vtkMTimeType LastOpaqueCheckTime;
210  bool LastOpaqueCheckValue;
211  double ColorResult[3];
212 
213  vtkCompositePolyDataMapper2(const vtkCompositePolyDataMapper2&) VTK_DELETE_FUNCTION;
214  void operator=(const vtkCompositePolyDataMapper2&) VTK_DELETE_FUNCTION;
215 
216 };
217 
218 #endif
a PolyDataMapper for the OpenGL library
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
static vtkOpenGLPolyDataMapper * New()
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
mapper for composite dataset consisting of polygonal data.
std::vector< vtkPolyData * > GetRenderedList()
Accessor to the ordered list of PolyData that we end last drew.
record modification and/or execution time
Definition: vtkTimeStamp.h:32
rendering attributes for a multi-block dataset.
abstract specification for renderers
Definition: vtkRenderer.h:57
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:46
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
a simple class to control print indentation
Definition: vtkIndent.h:33
void Render(vtkRenderer *ren, vtkActor *act) override
This calls RenderPiece (in a for loop if streaming is necessary).
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
std::vector< vtkPolyData * > RenderedList
bool GetIsOpaque() override
Returns if the mapper does not expect to have translucent geometry.
bool ColorMissingArraysWithNanColor
If the current &#39;color by&#39; array is missing on some datasets, color these dataset by the LookupTable&#39;s...
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
general representation of visualization data
Definition: vtkDataObject.h:58
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.