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
28#ifndef vtkCompositePolyDataMapper_h
29#define vtkCompositePolyDataMapper_h
30
31#include "vtkPolyDataMapper.h"
32
33#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_3_0
34#include "vtkRenderingCoreModule.h" // for export macro
35#include "vtkStateStorage.h" // for ivar
36
37#include <array> // for ColorResult. Remove when double* GetBlockColor gets removed.
38#include <memory> // for unique_ptr
39#include <vector> // for return
40
41VTK_ABI_NAMESPACE_BEGIN
42class vtkActor;
47class vtkInformation;
48class vtkPolyData;
49class vtkRenderer;
50
51class VTKRENDERINGCORE_EXPORT vtkCompositePolyDataMapper : public vtkPolyDataMapper
52{
53public:
56 void PrintSelf(ostream& os, vtkIndent indent) override;
57
62 void Render(vtkRenderer* renderer, vtkActor* actor) override;
63
65
68 double* GetBounds() VTK_SIZEHINT(6) override;
69 void GetBounds(double bounds[6]) override { this->Superclass::GetBounds(bounds); }
71
75 void ShallowCopy(vtkAbstractMapper* mapper) override;
76
81
83
88 bool HasOpaqueGeometry() override;
91
93
99
101
104 void SetBlockVisibility(unsigned int index, bool visible);
105 bool GetBlockVisibility(unsigned int index);
106 void RemoveBlockVisibility(unsigned int index);
109
111
114 void SetBlockColor(unsigned int index, const double color[3]);
115 void SetBlockColor(unsigned int index, double r, double g, double b)
116 {
117 double color[3] = { r, g, b };
118 this->SetBlockColor(index, color);
119 }
120 VTK_DEPRECATED_IN_9_3_0("Use void GetBlockColor(unsigned int index, double color[3])")
121 double* GetBlockColor(unsigned int index);
122 void GetBlockColor(unsigned int index, double color[3]);
123 void RemoveBlockColor(unsigned int index);
124 void RemoveBlockColors();
126
128
131 void SetBlockOpacity(unsigned int index, double opacity);
132 double GetBlockOpacity(unsigned int index);
133 void RemoveBlockOpacity(unsigned int index);
134 void RemoveBlockOpacities();
136
138
141 void SetBlockScalarMode(unsigned int index, int value);
142 int GetBlockScalarMode(unsigned int index);
143 void RemoveBlockScalarMode(unsigned int index);
144 void RemoveBlockScalarModes();
146
148
151 void SetBlockArrayAccessMode(unsigned int index, int value);
152 int GetBlockArrayAccessMode(unsigned int index);
153 void RemoveBlockArrayAccessMode(unsigned int index);
154 void RemoveBlockArrayAccessModes();
156
158
161 void SetBlockArrayComponent(unsigned int index, int value);
162 int GetBlockArrayComponent(unsigned int index);
163 void RemoveBlockArrayComponent(unsigned int index);
164 void RemoveBlockArrayComponents();
166
168
171 void SetBlockArrayId(unsigned int index, int value);
172 int GetBlockArrayId(unsigned int index);
173 void RemoveBlockArrayId(unsigned int index);
174 void RemoveBlockArrayIds();
176
178
181 void SetBlockArrayName(unsigned int index, const std::string& value);
182 std::string GetBlockArrayName(unsigned int index);
183 void RemoveBlockArrayName(unsigned int index);
184 void RemoveBlockArrayNames();
186
188
191 void SetBlockFieldDataTupleId(unsigned int index, vtkIdType value);
192 vtkIdType GetBlockFieldDataTupleId(unsigned int index);
193 void RemoveBlockFieldDataTupleId(unsigned int index);
194 void RemoveBlockFieldDataTupleIds();
196
198
204 vtkSetMacro(ColorMissingArraysWithNanColor, bool);
205 vtkGetMacro(ColorMissingArraysWithNanColor, bool);
206 vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
208
210
213 using vtkAlgorithm::SetInputArrayToProcess;
214 void SetInputArrayToProcess(
215 int idx, int port, int connection, int fieldAssociation, const char* name) override;
216 void SetInputArrayToProcess(
217 int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
218 void SetInputArrayToProcess(int idx, vtkInformation* info) override;
220
224 std::vector<vtkPolyData*> GetRenderedList();
225
230 void ProcessSelectorPixelBuffers(
231 vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
232
236 void SetVBOShiftScaleMethod(int method) override;
237
243 void SetPauseShiftScale(bool pauseShiftScale) override;
244
248 vtkMTimeType GetMTime() override;
249
251
257 vtkSetStringMacro(PointIdArrayName);
258 vtkGetStringMacro(PointIdArrayName);
259 vtkSetStringMacro(CellIdArrayName);
260 vtkGetStringMacro(CellIdArrayName);
262
264
269 vtkSetStringMacro(ProcessIdArrayName);
270 vtkGetStringMacro(ProcessIdArrayName);
272
274
283 vtkSetStringMacro(CompositeIdArrayName);
284 vtkGetStringMacro(CompositeIdArrayName);
286
287protected:
290
291 MapperHashType InsertPolyData(vtkPolyData* polydata, const unsigned int& flatIndex);
292
298 vtkExecutive* CreateDefaultExecutive() override;
299
303 int FillInputPortInformation(int port, vtkInformation* info) override;
304
312 virtual vtkCompositePolyDataMapperDelegator* CreateADelegator();
313
319 virtual void PreRender(const std::vector<vtkSmartPointer<vtkCompositePolyDataMapperDelegator>>&,
321 {
322 }
323
330 {
331 }
332
337
342
346 void ComputeBounds() override;
347
348 bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
349
351 vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
352
359
364
369 bool ColorMissingArraysWithNanColor = false;
370
375
376 // additional picking indirection
377 char* PointIdArrayName = nullptr;
378 char* CellIdArrayName = nullptr;
379 char* ProcessIdArrayName = nullptr;
380 char* CompositeIdArrayName = nullptr;
381
383 bool HasTranslucentGeometry = false;
387
388private:
390 void operator=(const vtkCompositePolyDataMapper&) = delete;
391
392 std::array<double, 3> ColorResult = {};
393
394 class vtkInternals;
395 std::unique_ptr<vtkInternals> Internals;
396};
397
398VTK_ABI_NAMESPACE_END
399#endif
abstract class specifies interface to map data
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:50
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:38
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:60
map vtkPolyData to graphics primitives
std::uintptr_t MapperHashType
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:89
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:52
abstract specification for renderers
Definition vtkRenderer.h:68
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:34
#define VTK_DEPRECATED_IN_9_3_0(reason)
int vtkIdType
Definition vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_SIZEHINT(...)