VTK  9.4.20251203
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
31
32#include <array> // for ColorResult. Remove when double* GetBlockColor gets removed.
33#include <memory> // for unique_ptr
34#include <vector> // for return
35
36VTK_ABI_NAMESPACE_BEGIN
37class vtkActor;
42class vtkInformation;
43class vtkPolyData;
44class vtkRenderer;
45
46class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkCompositePolyDataMapper : public vtkPolyDataMapper
47{
48public:
51 void PrintSelf(ostream& os, vtkIndent indent) override;
52
57 void Render(vtkRenderer* renderer, vtkActor* actor) override;
58
60
63 double* GetBounds() VTK_SIZEHINT(6) override;
64 void GetBounds(double bounds[6]) override { this->Superclass::GetBounds(bounds); }
66
70 void ShallowCopy(vtkAbstractMapper* mapper) override;
71
76
78
83 bool HasOpaqueGeometry() override;
86
88
94
96
99 void SetBlockVisibility(unsigned int index, bool visible);
100 bool GetBlockVisibility(unsigned int index);
101 void RemoveBlockVisibility(unsigned int index);
104
106
109 void SetBlockColor(unsigned int index, const double color[3]);
110 void SetBlockColor(unsigned int index, double r, double g, double b)
111 {
112 double color[3] = { r, g, b };
113 this->SetBlockColor(index, color);
114 }
115 VTK_DEPRECATED_IN_9_3_0("Use void GetBlockColor(unsigned int index, double color[3])")
116 double* GetBlockColor(unsigned int index);
117 void GetBlockColor(unsigned int index, double color[3]);
118 void RemoveBlockColor(unsigned int index);
119 void RemoveBlockColors();
121
123
126 void SetBlockOpacity(unsigned int index, double opacity);
127 double GetBlockOpacity(unsigned int index);
128 void RemoveBlockOpacity(unsigned int index);
129 void RemoveBlockOpacities();
131
133
136 void SetBlockScalarMode(unsigned int index, int value);
137 int GetBlockScalarMode(unsigned int index);
138 void RemoveBlockScalarMode(unsigned int index);
139 void RemoveBlockScalarModes();
141
143
146 void SetBlockArrayAccessMode(unsigned int index, int value);
147 int GetBlockArrayAccessMode(unsigned int index);
148 void RemoveBlockArrayAccessMode(unsigned int index);
149 void RemoveBlockArrayAccessModes();
151
153
156 void SetBlockArrayComponent(unsigned int index, int value);
157 int GetBlockArrayComponent(unsigned int index);
158 void RemoveBlockArrayComponent(unsigned int index);
159 void RemoveBlockArrayComponents();
161
163
166 void SetBlockArrayId(unsigned int index, int value);
167 int GetBlockArrayId(unsigned int index);
168 void RemoveBlockArrayId(unsigned int index);
169 void RemoveBlockArrayIds();
171
173
176 void SetBlockArrayName(unsigned int index, const std::string& value);
177 std::string GetBlockArrayName(unsigned int index);
178 void RemoveBlockArrayName(unsigned int index);
179 void RemoveBlockArrayNames();
181
183
186 void SetBlockFieldDataTupleId(unsigned int index, vtkIdType value);
187 vtkIdType GetBlockFieldDataTupleId(unsigned int index);
188 void RemoveBlockFieldDataTupleId(unsigned int index);
189 void RemoveBlockFieldDataTupleIds();
191
193
199 vtkSetMacro(ColorMissingArraysWithNanColor, bool);
200 vtkGetMacro(ColorMissingArraysWithNanColor, bool);
201 vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
203
205
208 using vtkAlgorithm::SetInputArrayToProcess;
209 void SetInputArrayToProcess(
210 int idx, int port, int connection, int fieldAssociation, const char* name) override;
211 void SetInputArrayToProcess(
212 int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
213 void SetInputArrayToProcess(int idx, vtkInformation* info) override;
215
219 std::vector<vtkPolyData*> GetRenderedList();
220
225 void ProcessSelectorPixelBuffers(
226 vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
227
231 void SetVBOShiftScaleMethod(int method) override;
232
238 void SetPauseShiftScale(bool pauseShiftScale) override;
239
243 vtkMTimeType GetMTime() override;
244
246
252 vtkSetStringMacro(PointIdArrayName);
253 vtkGetStringMacro(PointIdArrayName);
254 vtkSetStringMacro(CellIdArrayName);
255 vtkGetStringMacro(CellIdArrayName);
257
259
265 vtkSetStringMacro(ProcessIdArrayName);
266 vtkGetStringMacro(ProcessIdArrayName);
268
270
280 vtkSetStringMacro(CompositeIdArrayName);
281 vtkGetStringMacro(CompositeIdArrayName);
283
284protected:
287
288 MapperHashType InsertPolyData(vtkPolyData* polydata, const unsigned int& flatIndex);
289
295 vtkExecutive* CreateDefaultExecutive() override;
296
300 int FillInputPortInformation(int port, vtkInformation* info) override;
301
309 virtual vtkCompositePolyDataMapperDelegator* CreateADelegator();
310
316 virtual void PreRender(const std::vector<vtkSmartPointer<vtkCompositePolyDataMapperDelegator>>&,
318 {
319 }
320
327 {
328 }
329
334
339
343 void ComputeBounds() override;
344
345 bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
346
348 vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
349
356
361
366 bool ColorMissingArraysWithNanColor = false;
367
372
373 // additional picking indirection
374 char* PointIdArrayName = nullptr;
375 char* CellIdArrayName = nullptr;
376 char* ProcessIdArrayName = nullptr;
377 char* CompositeIdArrayName = nullptr;
378
380 bool HasTranslucentGeometry = false;
384
385private:
387 void operator=(const vtkCompositePolyDataMapper&) = delete;
388
389 std::array<double, 3> ColorResult = {};
390
391 class vtkInternals;
392 std::unique_ptr<vtkInternals> Internals;
393};
394
395VTK_ABI_NAMESPACE_END
396#endif
abstract class specifies interface to map data
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:42
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:58
map vtkPolyData to graphics primitives
std::uintptr_t MapperHashType
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:47
abstract specification for renderers
Definition vtkRenderer.h:63
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:29
#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