VTK  9.7.1
vtkCompositePolyDataMapper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
25 #ifndef vtkCompositePolyDataMapper_h
26 #define vtkCompositePolyDataMapper_h
27 
28 #include "vtkPolyDataMapper.h"
29 
30 #include "vtkRenderingCoreModule.h" // for export macro
31 #include "vtkStateStorage.h" // for ivar
32 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
33 
34 #include <array> // for ColorResult. Remove when double* GetBlockColor gets removed.
35 #include <memory> // for unique_ptr
36 #include <vector> // for return
37 
38 VTK_ABI_NAMESPACE_BEGIN
39 class vtkActor;
44 class vtkInformation;
45 class vtkPolyData;
46 class vtkRenderer;
47 class vtkTexture;
48 
49 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkCompositePolyDataMapper : public vtkPolyDataMapper
50 {
51 public:
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
60  void Render(vtkRenderer* renderer, vtkActor* actor) override;
61 
63 
66  double* GetBounds() VTK_SIZEHINT(6) override;
67  void GetBounds(double bounds[6]) override { this->Superclass::GetBounds(bounds); }
69 
73  void ShallowCopy(vtkAbstractMapper* mapper) override;
74 
78  void ReleaseGraphicsResources(vtkWindow*) override;
79 
81 
86  bool HasOpaqueGeometry() override;
87  bool HasTranslucentPolygonalGeometry() override;
89 
91 
94  void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes* attributes);
95  vtkCompositeDataDisplayAttributes* GetCompositeDataDisplayAttributes();
97 
99 
102  void SetBlockVisibility(unsigned int index, bool visible);
103  bool GetBlockVisibility(unsigned int index);
104  void RemoveBlockVisibility(unsigned int index);
105  void RemoveBlockVisibilities();
107 
109 
112  void SetBlockColor(unsigned int index, const double color[3]);
113  void SetBlockColor(unsigned int index, double r, double g, double b)
114  {
115  double color[3] = { r, g, b };
116  this->SetBlockColor(index, color);
117  }
118  void GetBlockColor(unsigned int index, double color[3]);
119  void RemoveBlockColor(unsigned int index);
120  void RemoveBlockColors();
122 
124 
127  void SetBlockOpacity(unsigned int index, double opacity);
128  double GetBlockOpacity(unsigned int index);
129  void RemoveBlockOpacity(unsigned int index);
130  void RemoveBlockOpacities();
132 
134 
137  void SetBlockScalarMode(unsigned int index, int value);
138  int GetBlockScalarMode(unsigned int index);
139  void RemoveBlockScalarMode(unsigned int index);
140  void RemoveBlockScalarModes();
142 
144 
147  void SetBlockArrayAccessMode(unsigned int index, int value);
148  int GetBlockArrayAccessMode(unsigned int index);
149  void RemoveBlockArrayAccessMode(unsigned int index);
150  void RemoveBlockArrayAccessModes();
152 
154 
157  void SetBlockArrayComponent(unsigned int index, int value);
158  int GetBlockArrayComponent(unsigned int index);
159  void RemoveBlockArrayComponent(unsigned int index);
160  void RemoveBlockArrayComponents();
162 
164 
167  void SetBlockArrayId(unsigned int index, int value);
168  int GetBlockArrayId(unsigned int index);
169  void RemoveBlockArrayId(unsigned int index);
170  void RemoveBlockArrayIds();
172 
174 
177  void SetBlockArrayName(unsigned int index, const std::string& value);
178  std::string GetBlockArrayName(unsigned int index);
179  void RemoveBlockArrayName(unsigned int index);
180  void RemoveBlockArrayNames();
182 
184 
187  void SetBlockFieldDataTupleId(unsigned int index, vtkIdType value);
188  vtkIdType GetBlockFieldDataTupleId(unsigned int index);
189  void RemoveBlockFieldDataTupleId(unsigned int index);
190  void RemoveBlockFieldDataTupleIds();
192 
194 
200  void SetBlockTextureImage(unsigned int index, vtkSmartPointer<vtkImageData> textureImage);
201  void SetBlockTexture(unsigned int index, vtkSmartPointer<vtkTexture> texture);
202  vtkSmartPointer<vtkTexture> GetBlockTexture(unsigned int index);
203  void RemoveBlockTexture(unsigned int index);
204  void RemoveBlockTextures();
206 
208 
214  vtkSetMacro(ColorMissingArraysWithNanColor, bool);
215  vtkGetMacro(ColorMissingArraysWithNanColor, bool);
216  vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
218 
220 
225  int idx, int port, int connection, int fieldAssociation, const char* name) override;
227  int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
228  void SetInputArrayToProcess(int idx, vtkInformation* info) override;
230 
234  std::vector<vtkPolyData*> GetRenderedList();
235 
241  vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
242 
246  void SetVBOShiftScaleMethod(int method) override;
247 
253  void SetPauseShiftScale(bool pauseShiftScale) override;
254 
258  vtkMTimeType GetMTime() override;
259 
260 protected:
262  ~vtkCompositePolyDataMapper() override;
263 
264  MapperHashType InsertPolyData(vtkPolyData* polydata, const unsigned int& flatIndex);
265 
272 
276  int FillInputPortInformation(int port, vtkInformation* info) override;
277 
285  virtual vtkCompositePolyDataMapperDelegator* CreateADelegator();
286 
294  {
295  }
296 
303  {
304  }
305 
310 
314  virtual vtkDataObjectTreeIterator* MakeAnIterator(vtkCompositeDataSet* dataset);
315 
319  void ComputeBounds() override;
320 
321  bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
322 
323  void BuildRenderValues(
324  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
325 
332 
337 
342  bool ColorMissingArraysWithNanColor = false;
343 
348 
350  bool HasTranslucentGeometry = false;
354 
355 private:
357  void operator=(const vtkCompositePolyDataMapper&) = delete;
358 
359  class vtkInternals;
360  std::unique_ptr<vtkInternals> Internals;
361 };
362 
363 VTK_ABI_NAMESPACE_END
364 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
void SetBlockColor(unsigned int index, double r, double g, double b)
Set/get the color for a block given its flat index.
void GetBounds(T a, double bds[6])
void ShallowCopy(vtkAbstractMapper *m) override
Make a shallow copy of this mapper.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
virtual MapperHashType GenerateHash(vtkPolyData *)
This hash integer is computed by concrete graphics implementation of this class.
virtual vtkExecutive * CreateDefaultExecutive()
Create a default executive.
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
record modification and/or execution time
Definition: vtkTimeStamp.h:24
Rendering attributes for a multi-block dataset.
virtual bool HasOpaqueGeometry()
Some introspection on the type of data the mapper will render used by props to determine if they shou...
vtkNew< vtkPolyDataMapper > PrototypeMapper
A prototype of the object factory override mapper.
vtkTimeStamp BoundsMTime
Time stamp for computation of bounds.
virtual bool HasTranslucentPolygonalGeometry()
Some introspection on the type of data the mapper will render used by props to determine if they shou...
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual void ProcessSelectorPixelBuffers(vtkHardwareSelector *, std::vector< unsigned int > &, vtkProp *)
allows a mapper to update a selections color buffers Called from a prop which in turn is called from ...
Definition: vtkMapper.h:469
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:39
virtual void PreRender(const std::vector< vtkSmartPointer< vtkCompositePolyDataMapperDelegator >> &, vtkRenderer *, vtkActor *)
Invoked just before all delegators render their datasets.
void SetInputArrayToProcess(const char *name, int fieldAssociation, int component=vtkArrayComponents::AllComponents)
Set the input data arrays that this algorithm will process.
virtual void SetPauseShiftScale(bool pauseShiftScale)
Pause per-render updates to VBO shift+scale parameters.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
Delegates rendering of multiple polydata that share similar signatures.
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax, zmin,zmax).
abstract superclass for composite (multi-block or AMR) datasets
std::uintptr_t MapperHashType
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkSmartPointer< vtkCompositeDataDisplayAttributes > CompositeAttributes
Composite data set attributes.
virtual void PostRender(const std::vector< vtkSmartPointer< vtkCompositePolyDataMapperDelegator >> &, vtkRenderer *, vtkActor *)
Invoked just after all delegators render their datasets.
handles properties associated with a texture map
Definition: vtkTexture.h:58
void Render(vtkRenderer *ren, vtkActor *act) override
This calls RenderPiece (in a for loop if streaming is necessary).
vtkMTimeType GetMTime() override
Overload standard modified time function.
#define VTK_SIZEHINT(...)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void ComputeBounds()
Called in GetBounds().
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
abstract class specifies interface to map data
map vtkPolyData to graphics primitives
static vtkPolyDataMapper * New()
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax, zmin,zmax).
#define VTK_MARSHALAUTO
superclass for composite data iterators
general representation of visualization data
Definition: vtkDataObject.h:55
virtual void SetVBOShiftScaleMethod(int)
A convenience method for enabling/disabling the VBO's shift+scale transform.
Class to make storing and comparing state quick and easy.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
Definition: vtkMapper.h:105
a class that renders hierarchical polygonal data