VTK  9.4.2
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
41#ifndef vtkCompositePolyDataMapper_h
42#define vtkCompositePolyDataMapper_h
43
44#include "vtkPolyDataMapper.h"
45
46#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_3_0
47#include "vtkRenderingCoreModule.h" // for export macro
48#include "vtkStateStorage.h" // for ivar
49#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
50
51#include <array> // for ColorResult. Remove when double* GetBlockColor gets removed.
52#include <memory> // for unique_ptr
53#include <vector> // for return
54
55VTK_ABI_NAMESPACE_BEGIN
56class vtkActor;
61class vtkInformation;
62class vtkPolyData;
63class vtkRenderer;
64
65class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkCompositePolyDataMapper : public vtkPolyDataMapper
66{
67public:
70 void PrintSelf(ostream& os, vtkIndent indent) override;
71
76 void Render(vtkRenderer* renderer, vtkActor* actor) override;
77
79
82 double* GetBounds() VTK_SIZEHINT(6) override;
83 void GetBounds(double bounds[6]) override { this->Superclass::GetBounds(bounds); }
85
89 void ShallowCopy(vtkAbstractMapper* mapper) override;
90
95
97
102 bool HasOpaqueGeometry() override;
105
107
113
115
118 void SetBlockVisibility(unsigned int index, bool visible);
119 bool GetBlockVisibility(unsigned int index);
120 void RemoveBlockVisibility(unsigned int index);
123
125
128 void SetBlockColor(unsigned int index, const double color[3]);
129 void SetBlockColor(unsigned int index, double r, double g, double b)
130 {
131 double color[3] = { r, g, b };
132 this->SetBlockColor(index, color);
133 }
134 VTK_DEPRECATED_IN_9_3_0("Use void GetBlockColor(unsigned int index, double color[3])")
135 double* GetBlockColor(unsigned int index);
136 void GetBlockColor(unsigned int index, double color[3]);
137 void RemoveBlockColor(unsigned int index);
138 void RemoveBlockColors();
140
142
145 void SetBlockOpacity(unsigned int index, double opacity);
146 double GetBlockOpacity(unsigned int index);
147 void RemoveBlockOpacity(unsigned int index);
148 void RemoveBlockOpacities();
150
152
155 void SetBlockScalarMode(unsigned int index, int value);
156 int GetBlockScalarMode(unsigned int index);
157 void RemoveBlockScalarMode(unsigned int index);
158 void RemoveBlockScalarModes();
160
162
165 void SetBlockArrayAccessMode(unsigned int index, int value);
166 int GetBlockArrayAccessMode(unsigned int index);
167 void RemoveBlockArrayAccessMode(unsigned int index);
168 void RemoveBlockArrayAccessModes();
170
172
175 void SetBlockArrayComponent(unsigned int index, int value);
176 int GetBlockArrayComponent(unsigned int index);
177 void RemoveBlockArrayComponent(unsigned int index);
178 void RemoveBlockArrayComponents();
180
182
185 void SetBlockArrayId(unsigned int index, int value);
186 int GetBlockArrayId(unsigned int index);
187 void RemoveBlockArrayId(unsigned int index);
188 void RemoveBlockArrayIds();
190
192
195 void SetBlockArrayName(unsigned int index, const std::string& value);
196 std::string GetBlockArrayName(unsigned int index);
197 void RemoveBlockArrayName(unsigned int index);
198 void RemoveBlockArrayNames();
200
202
205 void SetBlockFieldDataTupleId(unsigned int index, vtkIdType value);
206 vtkIdType GetBlockFieldDataTupleId(unsigned int index);
207 void RemoveBlockFieldDataTupleId(unsigned int index);
208 void RemoveBlockFieldDataTupleIds();
210
212
218 vtkSetMacro(ColorMissingArraysWithNanColor, bool);
219 vtkGetMacro(ColorMissingArraysWithNanColor, bool);
220 vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
222
224
227 using vtkAlgorithm::SetInputArrayToProcess;
228 void SetInputArrayToProcess(
229 int idx, int port, int connection, int fieldAssociation, const char* name) override;
230 void SetInputArrayToProcess(
231 int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
232 void SetInputArrayToProcess(int idx, vtkInformation* info) override;
234
238 std::vector<vtkPolyData*> GetRenderedList();
239
244 void ProcessSelectorPixelBuffers(
245 vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
246
250 void SetVBOShiftScaleMethod(int method) override;
251
257 void SetPauseShiftScale(bool pauseShiftScale) override;
258
262 vtkMTimeType GetMTime() override;
263
265
271 vtkSetStringMacro(PointIdArrayName);
272 vtkGetStringMacro(PointIdArrayName);
273 vtkSetStringMacro(CellIdArrayName);
274 vtkGetStringMacro(CellIdArrayName);
276
278
284 vtkSetStringMacro(ProcessIdArrayName);
285 vtkGetStringMacro(ProcessIdArrayName);
287
289
299 vtkSetStringMacro(CompositeIdArrayName);
300 vtkGetStringMacro(CompositeIdArrayName);
302
303protected:
306
307 MapperHashType InsertPolyData(vtkPolyData* polydata, const unsigned int& flatIndex);
308
314 vtkExecutive* CreateDefaultExecutive() override;
315
319 int FillInputPortInformation(int port, vtkInformation* info) override;
320
328 virtual vtkCompositePolyDataMapperDelegator* CreateADelegator();
329
335 virtual void PreRender(const std::vector<vtkSmartPointer<vtkCompositePolyDataMapperDelegator>>&,
337 {
338 }
339
346 {
347 }
348
353
358
362 void ComputeBounds() override;
363
364 bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
365
367 vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
368
375
380
385 bool ColorMissingArraysWithNanColor = false;
386
391
392 // additional picking indirection
393 char* PointIdArrayName = nullptr;
394 char* CellIdArrayName = nullptr;
395 char* ProcessIdArrayName = nullptr;
396 char* CompositeIdArrayName = nullptr;
397
399 bool HasTranslucentGeometry = false;
403
404private:
406 void operator=(const vtkCompositePolyDataMapper&) = delete;
407
408 std::array<double, 3> ColorResult = {};
409
410 class vtkInternals;
411 std::unique_ptr<vtkInternals> Internals;
412};
413
414VTK_ABI_NAMESPACE_END
415#endif
abstract class specifies interface to map data
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
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:108
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:167
map vtkPolyData to graphics primitives
std::uintptr_t MapperHashType
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
abstract specification for renderers
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:48
#define VTK_DEPRECATED_IN_9_3_0(reason)
int vtkIdType
Definition vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO