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) override;
47 
58  bool GetIsOpaque() 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);
74  void RemoveBlockVisibility(unsigned int index);
75  void RemoveBlockVisibilities();
76  // This method is deprecated and will be removed in VTK 8.2. It is misspelled.
77  VTK_LEGACY(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)
121  void ReleaseGraphicsResources(vtkWindow *) override;
122 
126  void Render(vtkRenderer *ren, vtkActor *act) override;
127 
131  std::vector<vtkPolyData*> GetRenderedList()
132  {
133  return this->RenderedList;
134  }
135 
136 protected:
138  ~vtkCompositePolyDataMapper2() override;
139 
146 
150  int FillInputPortInformation(int port, vtkInformation* info) override;
151 
155  void ComputeBounds() override;
156 
160  vtkTimeStamp BoundsMTime;
161 
162  // what "index" are we currently rendering, -1 means none
164  std::map<const std::string, vtkCompositeMapperHelper2 *> Helpers;
165  std::map<vtkPolyData *, vtkCompositeMapperHelperData *> HelperDataMap;
167 
168  virtual vtkCompositeMapperHelper2 *CreateHelper();
169 
170  // copy values to the helpers
171  virtual void CopyMapperValuesToHelper(vtkCompositeMapperHelper2 *helper);
172 
174  {
175  public:
176  std::stack<bool> Visibility;
177  std::stack<bool> Pickability;
178  std::stack<double> Opacity;
179  std::stack<vtkColor3d> AmbientColor;
180  std::stack<vtkColor3d> DiffuseColor;
181  std::stack<vtkColor3d> SpecularColor;
182  };
183 
184  void BuildRenderValues(vtkRenderer *renderer,
185  vtkActor *actor,
186  vtkDataObject *dobj,
187  unsigned int &flat_index);
189 
191  void RenderBlock(vtkRenderer *renderer,
192  vtkActor *actor,
193  vtkDataObject *dobj,
194  unsigned int &flat_index);
195 
200 
202 
208 
209  std::vector<vtkPolyData*> RenderedList;
210 
211 private:
212  vtkMTimeType LastOpaqueCheckTime;
213  bool LastOpaqueCheckValue;
214  double ColorResult[3];
215 
217  void operator=(const vtkCompositePolyDataMapper2&) = delete;
218 
219 };
220 
221 #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.