VTK  9.3.0
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
19#ifndef vtkCompositePolyDataMapper_h
20#define vtkCompositePolyDataMapper_h
21
22#include "vtkPolyDataMapper.h"
23
24#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_3_0
25#include "vtkRenderingCoreModule.h" // for export macro
26#include "vtkStateStorage.h" // for ivar
27
28#include <array> // for ColorResult. Remove when double* GetBlockColor gets removed.
29#include <memory> // for unique_ptr
30#include <vector> // for return
31
32VTK_ABI_NAMESPACE_BEGIN
33class vtkActor;
38class vtkInformation;
39class vtkPolyData;
40class vtkRenderer;
41
42class VTKRENDERINGCORE_EXPORT vtkCompositePolyDataMapper : public vtkPolyDataMapper
43{
44public:
47 void PrintSelf(ostream& os, vtkIndent indent) override;
48
53 void Render(vtkRenderer* renderer, vtkActor* actor) override;
54
56
59 double* GetBounds() VTK_SIZEHINT(6) override;
60 void GetBounds(double bounds[6]) override { this->Superclass::GetBounds(bounds); }
62
66 void ShallowCopy(vtkAbstractMapper* mapper) override;
67
72
74
79 bool HasOpaqueGeometry() override;
82
84
90
92
95 void SetBlockVisibility(unsigned int index, bool visible);
96 bool GetBlockVisibility(unsigned int index);
97 void RemoveBlockVisibility(unsigned int index);
100
102
105 void SetBlockColor(unsigned int index, const double color[3]);
106 void SetBlockColor(unsigned int index, double r, double g, double b)
107 {
108 double color[3] = { r, g, b };
109 this->SetBlockColor(index, color);
110 }
111 VTK_DEPRECATED_IN_9_3_0("Use void GetBlockColor(unsigned int index, double color[3])")
112 double* GetBlockColor(unsigned int index);
113 void GetBlockColor(unsigned int index, double color[3]);
114 void RemoveBlockColor(unsigned int index);
115 void RemoveBlockColors();
117
119
122 void SetBlockOpacity(unsigned int index, double opacity);
123 double GetBlockOpacity(unsigned int index);
124 void RemoveBlockOpacity(unsigned int index);
125 void RemoveBlockOpacities();
127
129
132 void SetBlockScalarMode(unsigned int index, int value);
133 int GetBlockScalarMode(unsigned int index);
134 void RemoveBlockScalarMode(unsigned int index);
135 void RemoveBlockScalarModes();
137
139
142 void SetBlockArrayAccessMode(unsigned int index, int value);
143 int GetBlockArrayAccessMode(unsigned int index);
144 void RemoveBlockArrayAccessMode(unsigned int index);
145 void RemoveBlockArrayAccessModes();
147
149
152 void SetBlockArrayComponent(unsigned int index, int value);
153 int GetBlockArrayComponent(unsigned int index);
154 void RemoveBlockArrayComponent(unsigned int index);
155 void RemoveBlockArrayComponents();
157
159
162 void SetBlockArrayId(unsigned int index, int value);
163 int GetBlockArrayId(unsigned int index);
164 void RemoveBlockArrayId(unsigned int index);
165 void RemoveBlockArrayIds();
167
169
172 void SetBlockArrayName(unsigned int index, const std::string& value);
173 std::string GetBlockArrayName(unsigned int index);
174 void RemoveBlockArrayName(unsigned int index);
175 void RemoveBlockArrayNames();
177
179
182 void SetBlockFieldDataTupleId(unsigned int index, vtkIdType value);
183 vtkIdType GetBlockFieldDataTupleId(unsigned int index);
184 void RemoveBlockFieldDataTupleId(unsigned int index);
185 void RemoveBlockFieldDataTupleIds();
187
189
195 vtkSetMacro(ColorMissingArraysWithNanColor, bool);
196 vtkGetMacro(ColorMissingArraysWithNanColor, bool);
197 vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
199
201
204 using vtkAlgorithm::SetInputArrayToProcess;
205 void SetInputArrayToProcess(
206 int idx, int port, int connection, int fieldAssociation, const char* name) override;
207 void SetInputArrayToProcess(
208 int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
209 void SetInputArrayToProcess(int idx, vtkInformation* info) override;
211
215 std::vector<vtkPolyData*> GetRenderedList();
216
221 void ProcessSelectorPixelBuffers(
222 vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
223
227 void SetVBOShiftScaleMethod(int method) override;
228
234 void SetPauseShiftScale(bool pauseShiftScale) override;
235
239 vtkMTimeType GetMTime() override;
240
242
248 vtkSetStringMacro(PointIdArrayName);
249 vtkGetStringMacro(PointIdArrayName);
250 vtkSetStringMacro(CellIdArrayName);
251 vtkGetStringMacro(CellIdArrayName);
253
255
260 vtkSetStringMacro(ProcessIdArrayName);
261 vtkGetStringMacro(ProcessIdArrayName);
263
265
274 vtkSetStringMacro(CompositeIdArrayName);
275 vtkGetStringMacro(CompositeIdArrayName);
277
278protected:
281
282 MapperHashType InsertPolyData(vtkPolyData* polydata, const unsigned int& flatIndex);
283
289 vtkExecutive* CreateDefaultExecutive() override;
290
294 int FillInputPortInformation(int port, vtkInformation* info) override;
295
303 virtual vtkCompositePolyDataMapperDelegator* CreateADelegator();
304
310 virtual void PreRender(const std::vector<vtkSmartPointer<vtkCompositePolyDataMapperDelegator>>&,
312 {
313 }
314
321 {
322 }
323
328
333
337 void ComputeBounds() override;
338
339 bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
340
342 vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
343
350
355
360 bool ColorMissingArraysWithNanColor = false;
361
366
367 // additional picking indirection
368 char* PointIdArrayName = nullptr;
369 char* CellIdArrayName = nullptr;
370 char* ProcessIdArrayName = nullptr;
371 char* CompositeIdArrayName = nullptr;
372
374 bool HasTranslucentGeometry = false;
378
379private:
381 void operator=(const vtkCompositePolyDataMapper&) = delete;
382
383 std::array<double, 3> ColorResult = {};
384
385 class vtkInternals;
386 std::unique_ptr<vtkInternals> Internals;
387};
388
389VTK_ABI_NAMESPACE_END
390#endif
abstract class specifies interface to map data
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:41
Superclass for all sources, filters, and sinks in VTK.
Rendering attributes for a multi-block dataset.
abstract superclass for composite (multi-block or AMR) datasets
Delegates rendering of multiple polydata that share similar signatures.
a class that renders hierarchical polygonal data
vtkCompositeDataDisplayAttributes * GetCompositeDataDisplayAttributes()
Set/get the composite data set attributes.
bool GetBlockVisibility(unsigned int index)
Set/get the visibility for a block given its flat index.
void ComputeBounds() override
Need to loop over the hierarchy to compute bounds.
void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes *attributes)
Set/get the composite data set attributes.
vtkPolyDataMapper::MapperHashType GenerateHash(vtkPolyData *polydata) override
Creates an empty polydata mapper and asks the mapper to hash the polydata.
vtkNew< vtkPolyDataMapper > PrototypeMapper
A prototype of the object factory override mapper.
void RemoveBlockVisibility(unsigned int index)
Set/get the visibility for a block given its flat index.
void SetBlockVisibility(unsigned int index, bool visible)
Set/get the visibility for a block given its flat index.
bool RecursiveHasTranslucentGeometry(vtkDataObject *dobj, unsigned int &flat_index)
void Render(vtkRenderer *renderer, vtkActor *actor) override
Standard method for rendering a mapper.
void ShallowCopy(vtkAbstractMapper *mapper) override
Make a shallow copy of this mapper.
void ReleaseGraphicsResources(vtkWindow *) override
Release the underlying resources associated with this mapper.
vtkSmartPointer< vtkCompositeDataDisplayAttributes > CompositeAttributes
Composite data set attributes.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetBlockColor(unsigned int index, const double color[3])
Set/get the color for a block given its flat index.
static vtkCompositePolyDataMapper * New()
void RemoveBlockVisibilities()
Set/get the visibility for a block given its flat index.
double * GetBounds() override
Standard vtkProp method to get 3D bounds of a 3D prop.
void BuildRenderValues(vtkRenderer *renderer, vtkActor *actor, vtkDataObject *dobj, unsigned int &flat_index)
virtual void PostRender(const std::vector< vtkSmartPointer< vtkCompositePolyDataMapperDelegator > > &, vtkRenderer *, vtkActor *)
Invoked just after all delegators render their datasets.
virtual vtkDataObjectTreeIterator * MakeAnIterator(vtkCompositeDataSet *dataset)
Initialize an iterator for the composite dataset.
bool HasTranslucentPolygonalGeometry() override
Some introspection on the type of data the mapper will render used by props to determine if they shou...
bool HasOpaqueGeometry() override
Some introspection on the type of data the mapper will render used by props to determine if they shou...
void SetBlockColor(unsigned int index, double r, double g, double b)
Set/get the color for a block given its flat index.
vtkTimeStamp BoundsMTime
Time stamp for computation of bounds.
superclass for composite data iterators
general representation of visualization data
Superclass for all pipeline executives in VTK.
a simple class to control print indentation
Definition vtkIndent.h:29
Store vtkAlgorithm input/output information.
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
Allocate and hold a VTK object.
Definition vtkNew.h:51
map vtkPolyData to graphics primitives
std::uintptr_t MapperHashType
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:43
abstract specification for renderers
Definition vtkRenderer.h:59
Hold a reference to a vtkObjectBase instance.
Class to make storing and comparing state quick and easy.
record modification and/or execution time
window superclass for vtkRenderWindow
Definition vtkWindow.h:25
#define VTK_DEPRECATED_IN_9_3_0(reason)
int vtkIdType
Definition vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_SIZEHINT(...)