VTK  9.3.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
22 #ifndef vtkCompositePolyDataMapper_h
23 #define vtkCompositePolyDataMapper_h
24 
25 #include "vtkPolyDataMapper.h"
26 
27 #include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_3_0
28 #include "vtkRenderingCoreModule.h" // for export macro
29 #include "vtkStateStorage.h" // for ivar
30 
31 #include <array> // for ColorResult. Remove when double* GetBlockColor gets removed.
32 #include <memory> // for unique_ptr
33 #include <vector> // for return
34 
35 VTK_ABI_NAMESPACE_BEGIN
36 class vtkActor;
41 class vtkInformation;
42 class vtkPolyData;
43 class vtkRenderer;
44 
45 class VTKRENDERINGCORE_EXPORT vtkCompositePolyDataMapper : public vtkPolyDataMapper
46 {
47 public:
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
56  void Render(vtkRenderer* renderer, vtkActor* actor) override;
57 
59 
62  double* GetBounds() VTK_SIZEHINT(6) override;
63  void GetBounds(double bounds[6]) override { this->Superclass::GetBounds(bounds); }
65 
69  void ShallowCopy(vtkAbstractMapper* mapper) override;
70 
74  void ReleaseGraphicsResources(vtkWindow*) override;
75 
77 
82  bool HasOpaqueGeometry() override;
83  bool HasTranslucentPolygonalGeometry() override;
85 
87 
90  void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes* attributes);
91  vtkCompositeDataDisplayAttributes* GetCompositeDataDisplayAttributes();
93 
95 
98  void SetBlockVisibility(unsigned int index, bool visible);
99  bool GetBlockVisibility(unsigned int index);
100  void RemoveBlockVisibility(unsigned int index);
101  void RemoveBlockVisibilities();
103 
105 
108  void SetBlockColor(unsigned int index, const double color[3]);
109  void SetBlockColor(unsigned int index, double r, double g, double b)
110  {
111  double color[3] = { r, g, b };
112  this->SetBlockColor(index, color);
113  }
114  VTK_DEPRECATED_IN_9_3_0("Use void GetBlockColor(unsigned int index, double color[3])")
115  double* GetBlockColor(unsigned int index);
116  void GetBlockColor(unsigned int index, double color[3]);
117  void RemoveBlockColor(unsigned int index);
118  void RemoveBlockColors();
120 
122 
125  void SetBlockOpacity(unsigned int index, double opacity);
126  double GetBlockOpacity(unsigned int index);
127  void RemoveBlockOpacity(unsigned int index);
128  void RemoveBlockOpacities();
130 
132 
135  void SetBlockScalarMode(unsigned int index, int value);
136  int GetBlockScalarMode(unsigned int index);
137  void RemoveBlockScalarMode(unsigned int index);
138  void RemoveBlockScalarModes();
140 
142 
145  void SetBlockArrayAccessMode(unsigned int index, int value);
146  int GetBlockArrayAccessMode(unsigned int index);
147  void RemoveBlockArrayAccessMode(unsigned int index);
148  void RemoveBlockArrayAccessModes();
150 
152 
155  void SetBlockArrayComponent(unsigned int index, int value);
156  int GetBlockArrayComponent(unsigned int index);
157  void RemoveBlockArrayComponent(unsigned int index);
158  void RemoveBlockArrayComponents();
160 
162 
165  void SetBlockArrayId(unsigned int index, int value);
166  int GetBlockArrayId(unsigned int index);
167  void RemoveBlockArrayId(unsigned int index);
168  void RemoveBlockArrayIds();
170 
172 
175  void SetBlockArrayName(unsigned int index, const std::string& value);
176  std::string GetBlockArrayName(unsigned int index);
177  void RemoveBlockArrayName(unsigned int index);
178  void RemoveBlockArrayNames();
180 
182 
185  void SetBlockFieldDataTupleId(unsigned int index, vtkIdType value);
186  vtkIdType GetBlockFieldDataTupleId(unsigned int index);
187  void RemoveBlockFieldDataTupleId(unsigned int index);
188  void RemoveBlockFieldDataTupleIds();
190 
192 
198  vtkSetMacro(ColorMissingArraysWithNanColor, bool);
199  vtkGetMacro(ColorMissingArraysWithNanColor, bool);
200  vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
202 
204 
207  using vtkAlgorithm::SetInputArrayToProcess;
208  void SetInputArrayToProcess(
209  int idx, int port, int connection, int fieldAssociation, const char* name) override;
210  void SetInputArrayToProcess(
211  int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
212  void SetInputArrayToProcess(int idx, vtkInformation* info) override;
214 
218  std::vector<vtkPolyData*> GetRenderedList();
219 
224  void ProcessSelectorPixelBuffers(
225  vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
226 
230  void SetVBOShiftScaleMethod(int method) override;
231 
237  void SetPauseShiftScale(bool pauseShiftScale) override;
238 
242  vtkMTimeType GetMTime() override;
243 
245 
251  vtkSetStringMacro(PointIdArrayName);
252  vtkGetStringMacro(PointIdArrayName);
253  vtkSetStringMacro(CellIdArrayName);
254  vtkGetStringMacro(CellIdArrayName);
256 
258 
263  vtkSetStringMacro(ProcessIdArrayName);
264  vtkGetStringMacro(ProcessIdArrayName);
266 
268 
277  vtkSetStringMacro(CompositeIdArrayName);
278  vtkGetStringMacro(CompositeIdArrayName);
280 
281 protected:
283  ~vtkCompositePolyDataMapper() override;
284 
285  MapperHashType InsertPolyData(vtkPolyData* polydata, const unsigned int& flatIndex);
286 
292  vtkExecutive* CreateDefaultExecutive() override;
293 
297  int FillInputPortInformation(int port, vtkInformation* info) override;
298 
306  virtual vtkCompositePolyDataMapperDelegator* CreateADelegator();
307 
315  {
316  }
317 
324  {
325  }
326 
331 
335  virtual vtkDataObjectTreeIterator* MakeAnIterator(vtkCompositeDataSet* dataset);
336 
340  void ComputeBounds() override;
341 
342  bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
343 
344  void BuildRenderValues(
345  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
346 
353 
358 
363  bool ColorMissingArraysWithNanColor = false;
364 
369 
370  // additional picking indirection
371  char* PointIdArrayName = nullptr;
372  char* CellIdArrayName = nullptr;
373  char* ProcessIdArrayName = nullptr;
374  char* CompositeIdArrayName = nullptr;
375 
377  bool HasTranslucentGeometry = false;
381 
382 private:
384  void operator=(const vtkCompositePolyDataMapper&) = delete;
385 
386  std::array<double, 3> ColorResult = {};
387 
388  class vtkInternals;
389  std::unique_ptr<vtkInternals> Internals;
390 };
391 
392 VTK_ABI_NAMESPACE_END
393 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:45
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:40
virtual MapperHashType GenerateHash(vtkPolyData *)
This hash integer is computed by concrete graphics implementation of this class.
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
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:61
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:23
int vtkIdType
Definition: vtkType.h:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:38
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
#define VTK_DEPRECATED_IN_9_3_0(reason)
Delegates rendering of multiple polydata that share similar signatures.
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:51
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.
void Render(vtkRenderer *ren, vtkActor *act) override
This calls RenderPiece (in a for loop if streaming is necessary).
#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().
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).
superclass for composite data iterators
general representation of visualization data
Definition: vtkDataObject.h:54
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:104
a class that renders hierarchical polygonal data