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 
129 
134  int idx, int port, int connection, int fieldAssociation, const char* name) override;
136  int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
137  void SetInputArrayToProcess(int idx, vtkInformation* info) override;
139 
143  std::vector<vtkPolyData*> GetRenderedList()
144  {
145  return this->RenderedList;
146  }
147 
148 protected:
150  ~vtkCompositePolyDataMapper2() override;
151 
158 
162  int FillInputPortInformation(int port, vtkInformation* info) override;
163 
167  void ComputeBounds() override;
168 
173  virtual void InitializeHelpersBeforeRendering(vtkRenderer *vtkNotUsed(ren),
174  vtkActor *vtkNotUsed(act)) {}
175 
180 
181  // what "index" are we currently rendering, -1 means none
183  std::map<const std::string, vtkCompositeMapperHelper2 *> Helpers;
184  std::map<vtkPolyData *, vtkCompositeMapperHelperData *> HelperDataMap;
186 
187  virtual vtkCompositeMapperHelper2 *CreateHelper();
188 
189  // copy values to the helpers
190  virtual void CopyMapperValuesToHelper(vtkCompositeMapperHelper2 *helper);
191 
193  {
194  public:
195  std::stack<bool> Visibility;
196  std::stack<bool> Pickability;
197  std::stack<double> Opacity;
198  std::stack<vtkColor3d> AmbientColor;
199  std::stack<vtkColor3d> DiffuseColor;
200  std::stack<vtkColor3d> SpecularColor;
201  };
202 
203  void BuildRenderValues(vtkRenderer *renderer,
204  vtkActor *actor,
205  vtkDataObject *dobj,
206  unsigned int &flat_index);
208 
210  void RenderBlock(vtkRenderer *renderer,
211  vtkActor *actor,
212  vtkDataObject *dobj,
213  unsigned int &flat_index);
214 
219 
221 
227 
228  std::vector<vtkPolyData*> RenderedList;
229 
230 private:
231  vtkMTimeType LastOpaqueCheckTime;
232  bool LastOpaqueCheckValue;
233  double ColorResult[3];
234 
236  void operator=(const vtkCompositePolyDataMapper2&) = delete;
237 
238 };
239 
240 #endif
PolyDataMapper using OpenGL to render.
void ComputeBounds() override
Called in GetBounds().
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
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:32
Rendering attributes for a multi-block dataset.
abstract specification for renderers
Definition: vtkRenderer.h:57
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:46
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.
virtual void InitializeHelpersBeforeRendering(vtkRenderer *vtkNotUsed(ren), vtkActor *vtkNotUsed(act))
This method is called before RenderPiece is called on helpers.
virtual void SetInputArrayToProcess(int idx, int port, int connection, int fieldAssociation, const char *name)
Set the input data arrays that this algorithm will process.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
a simple class to control print indentation
Definition: vtkIndent.h:33
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.
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 'color by' array is missing on some datasets, color these dataset by the LookupTable's...
vtkTimeStamp BoundsMTime
Time stamp for computation of bounds.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
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.