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 #include <vector> // used for ivars
39 
43 
44 class VTKRENDERINGOPENGL2_EXPORT vtkCompositePolyDataMapper2 : public vtkOpenGLPolyDataMapper
45 {
46 public:
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
61  bool GetIsOpaque() override;
62 
64 
67  void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes *attributes);
68  vtkCompositeDataDisplayAttributes* GetCompositeDataDisplayAttributes();
70 
72 
75  void SetBlockVisibility(unsigned int index, bool visible);
76  bool GetBlockVisibility(unsigned int index);
77  void RemoveBlockVisibility(unsigned int index);
78  void RemoveBlockVisibilities();
79  // This method is deprecated and will be removed in VTK 8.2. It is misspelled.
80  VTK_LEGACY(void RemoveBlockVisibilites());
82 
84 
87  void SetBlockColor(unsigned int index, double color[3]);
88  void SetBlockColor(unsigned int index, double r, double g, double b)
89  {
90  double color[3] = {r, g, b};
91  this->SetBlockColor(index, color);
92  }
93  double* GetBlockColor(unsigned int index);
94  void RemoveBlockColor(unsigned int index);
95  void RemoveBlockColors();
97 
99 
102  void SetBlockOpacity(unsigned int index, double opacity);
103  double GetBlockOpacity(unsigned int index);
104  void RemoveBlockOpacity(unsigned int index);
105  void RemoveBlockOpacities();
107 
114  vtkSetMacro(ColorMissingArraysWithNanColor, bool)
115  vtkGetMacro(ColorMissingArraysWithNanColor, bool)
116  vtkBooleanMacro(ColorMissingArraysWithNanColor, bool)
124  void ReleaseGraphicsResources(vtkWindow *) override;
125 
129  void Render(vtkRenderer *ren, vtkActor *act) override;
130 
134  std::vector<vtkPolyData*> GetRenderedList()
135  {
136  return this->RenderedList;
137  }
138 
139 protected:
141  ~vtkCompositePolyDataMapper2() override;
142 
149 
153  int FillInputPortInformation(int port, vtkInformation* info) override;
154 
158  void ComputeBounds() override;
159 
163  vtkTimeStamp BoundsMTime;
164 
165  // what "index" are we currently rendering, -1 means none
167  std::map<const std::string, vtkCompositeMapperHelper2 *> Helpers;
168  std::map<vtkPolyData *, vtkCompositeMapperHelperData *> HelperDataMap;
170 
171  virtual vtkCompositeMapperHelper2 *CreateHelper();
172 
173  // copy values to the helpers
174  virtual void CopyMapperValuesToHelper(vtkCompositeMapperHelper2 *helper);
175 
177  {
178  public:
179  std::stack<bool> Visibility;
180  std::stack<bool> Pickability;
181  std::stack<double> Opacity;
182  std::stack<vtkColor3d> AmbientColor;
183  std::stack<vtkColor3d> DiffuseColor;
184  std::stack<vtkColor3d> SpecularColor;
185  };
186 
187  void BuildRenderValues(vtkRenderer *renderer,
188  vtkActor *actor,
189  vtkDataObject *dobj,
190  unsigned int &flat_index);
192 
194  void RenderBlock(vtkRenderer *renderer,
195  vtkActor *actor,
196  vtkDataObject *dobj,
197  unsigned int &flat_index);
198 
203 
205 
211 
212  std::vector<vtkPolyData*> RenderedList;
213 
214 private:
215  vtkMTimeType LastOpaqueCheckTime;
216  bool LastOpaqueCheckValue;
217  double ColorResult[3];
218 
220  void operator=(const vtkCompositePolyDataMapper2&) = delete;
221 
222 };
223 
224 #endif
a PolyDataMapper for the OpenGL library
void ComputeBounds() override
Called in GetBounds().
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
static vtkOpenGLPolyDataMapper * New()
virtual vtkExecutive * CreateDefaultExecutive()
Create a default executive.
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: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
void SetBlockColor(unsigned int index, double r, double g, double b)
Set/get the color for a block given its flat index.
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
void Render(vtkRenderer *ren, vtkActor *act) override
This calls RenderPiece (in a for loop if streaming is necessary).
vtkSmartPointer< vtkCompositeDataDisplayAttributes > CompositeAttributes
Composite data set attributes.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
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:64
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.