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 
132 
137  int idx, int port, int connection, int fieldAssociation, const char* name) override;
139  int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
140  void SetInputArrayToProcess(int idx, vtkInformation* info) override;
142 
146  std::vector<vtkPolyData*> GetRenderedList()
147  {
148  return this->RenderedList;
149  }
150 
156  std::vector<unsigned int> &pixeloffsets,
157  vtkProp *prop) override;
158 
159 protected:
161  ~vtkCompositePolyDataMapper2() override;
162 
169 
173  int FillInputPortInformation(int port, vtkInformation* info) override;
174 
178  void ComputeBounds() override;
179 
184  virtual void InitializeHelpersBeforeRendering(vtkRenderer *vtkNotUsed(ren),
185  vtkActor *vtkNotUsed(act)) {}
186 
191 
192  // what "index" are we currently rendering, -1 means none
194  std::map<const std::string, vtkCompositeMapperHelper2 *> Helpers;
195  std::map<vtkPolyData *, vtkCompositeMapperHelperData *> HelperDataMap;
197 
198  virtual vtkCompositeMapperHelper2 *CreateHelper();
199 
200  // copy values to the helpers
201  virtual void CopyMapperValuesToHelper(vtkCompositeMapperHelper2 *helper);
202 
204  {
205  public:
206  std::stack<bool> Visibility;
207  std::stack<bool> Pickability;
208  std::stack<double> Opacity;
209  std::stack<vtkColor3d> AmbientColor;
210  std::stack<vtkColor3d> DiffuseColor;
211  std::stack<vtkColor3d> SpecularColor;
212  };
213 
214  void BuildRenderValues(vtkRenderer *renderer,
215  vtkActor *actor,
216  vtkDataObject *dobj,
217  unsigned int &flat_index);
219 
221  void RenderBlock(vtkRenderer *renderer,
222  vtkActor *actor,
223  vtkDataObject *dobj,
224  unsigned int &flat_index);
225 
230 
232 
238 
239  std::vector<vtkPolyData*> RenderedList;
240 
241 private:
242  vtkMTimeType LastOpaqueCheckTime;
243  bool LastOpaqueCheckValue;
244  double ColorResult[3];
245 
247  void operator=(const vtkCompositePolyDataMapper2&) = delete;
248 
249 };
250 
251 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
PolyDataMapper using OpenGL to render.
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:302
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.
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:37
a simple class to control print indentation
Definition: vtkIndent.h:39
std::map< const std::string, vtkCompositeMapperHelper2 * > Helpers
void ProcessSelectorPixelBuffers(vtkHardwareSelector *sel, std::vector< unsigned int > &pixeloffsets, vtkProp *prop) override
allows a mapper to update a selections color buffers Called from a prop which in turn is called from ...
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 &#39;color by&#39; array is missing on some datasets, color these dataset by the LookupTable&#39;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:64
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.