VTK: Rendering/Core/vtkCompositePolyDataMapper.h Source File

| 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
31 #ifndef vtkCompositePolyDataMapper_h
32 #define vtkCompositePolyDataMapper_h
33
34 #include "vtkPolyDataMapper.h"
35
36 #include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_3_0
37 #include "vtkRenderingCoreModule.h" // for export macro
38 #include "vtkStateStorage.h" // for ivar
39
40 #include <array> // for ColorResult. Remove when double* GetBlockColor gets removed.
41 #include <memory> // for unique_ptr
42 #include <vector> // for return
43
44 VTK_ABI_NAMESPACE_BEGIN
45 class vtkActor;
46 class vtkCompositePolyDataMapperDelegator;
47 class vtkCompositeDataDisplayAttributes;
48 class vtkCompositeDataSet;
49 class vtkDataObjectTreeIterator;
50 class vtkInformation;
51 class vtkPolyData;
52 class vtkRenderer;
53
54 class VTKRENDERINGCORE_EXPORT vtkCompositePolyDataMapper : public vtkPolyDataMapper
55 {
56 public:
57 static vtkCompositePolyDataMapper* New();
58 vtkTypeMacro(vtkCompositePolyDataMapper, vtkPolyDataMapper);
59 void PrintSelf(ostream& os, vtkIndent indent) override;
60
65 void Render(vtkRenderer* renderer, vtkActor* actor) override;
66
68
71 double* GetBounds() VTK_SIZEHINT(6) override;
72 void GetBounds(double bounds[6]) override { this->Superclass::GetBounds(bounds); }
74
78 void ShallowCopy(vtkAbstractMapper* mapper) override;
79
83 void ReleaseGraphicsResources(vtkWindow*) override;
84
86
91 bool HasOpaqueGeometry() override;
92 bool HasTranslucentPolygonalGeometry() override;
94
96
99 void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes* attributes);
100 vtkCompositeDataDisplayAttributes* GetCompositeDataDisplayAttributes();
102
104
107 void SetBlockVisibility(unsigned int index, bool visible);
108 bool GetBlockVisibility(unsigned int index);
109 void RemoveBlockVisibility(unsigned int index);
110 void RemoveBlockVisibilities();
112
114
117 void SetBlockColor(unsigned int index, const double color[3]);
118 void SetBlockColor(unsigned int index, double r, double g, double b)
119 {
120 double color[3] = { r, g, b };
121 this->SetBlockColor(index, color);
122 }
123 VTK_DEPRECATED_IN_9_3_0("Use void GetBlockColor(unsigned int index, double color[3])")
124 double* GetBlockColor(unsigned int index);
125 void GetBlockColor(unsigned int index, double color[3]);
126 void RemoveBlockColor(unsigned int index);
127 void RemoveBlockColors();
129
131
134 void SetBlockOpacity(unsigned int index, double opacity);
135 double GetBlockOpacity(unsigned int index);
136 void RemoveBlockOpacity(unsigned int index);
137 void RemoveBlockOpacities();
139
141
144 void SetBlockScalarMode(unsigned int index, int value);
145 int GetBlockScalarMode(unsigned int index);
146 void RemoveBlockScalarMode(unsigned int index);
147 void RemoveBlockScalarModes();
149
151
154 void SetBlockArrayAccessMode(unsigned int index, int value);
155 int GetBlockArrayAccessMode(unsigned int index);
156 void RemoveBlockArrayAccessMode(unsigned int index);
157 void RemoveBlockArrayAccessModes();
159
161
164 void SetBlockArrayComponent(unsigned int index, int value);
165 int GetBlockArrayComponent(unsigned int index);
166 void RemoveBlockArrayComponent(unsigned int index);
167 void RemoveBlockArrayComponents();
169
171
174 void SetBlockArrayId(unsigned int index, int value);
175 int GetBlockArrayId(unsigned int index);
176 void RemoveBlockArrayId(unsigned int index);
177 void RemoveBlockArrayIds();
179
181
184 void SetBlockArrayName(unsigned int index, const std::string& value);
185 std::string GetBlockArrayName(unsigned int index);
186 void RemoveBlockArrayName(unsigned int index);
187 void RemoveBlockArrayNames();
189
191
194 void SetBlockFieldDataTupleId(unsigned int index, vtkIdType value);
195 vtkIdType GetBlockFieldDataTupleId(unsigned int index);
196 void RemoveBlockFieldDataTupleId(unsigned int index);
197 void RemoveBlockFieldDataTupleIds();
199
201
207 vtkSetMacro(ColorMissingArraysWithNanColor, bool);
208 vtkGetMacro(ColorMissingArraysWithNanColor, bool);
209 vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
211
213
216 using vtkAlgorithm::SetInputArrayToProcess;
217 void SetInputArrayToProcess(
218 int idx, int port, int connection, int fieldAssociation, const char* name) override;
219 void SetInputArrayToProcess(
220 int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
221 void SetInputArrayToProcess(int idx, vtkInformation* info) override;
223
227 std::vector<vtkPolyData*> GetRenderedList();
228
233 void ProcessSelectorPixelBuffers(
234 vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
235
239 void SetVBOShiftScaleMethod(int method) override;
240
246 void SetPauseShiftScale(bool pauseShiftScale) override;
247
251 vtkMTimeType GetMTime() override;
252
254
260 vtkSetStringMacro(PointIdArrayName);
261 vtkGetStringMacro(PointIdArrayName);
262 vtkSetStringMacro(CellIdArrayName);
263 vtkGetStringMacro(CellIdArrayName);
265
267
272 vtkSetStringMacro(ProcessIdArrayName);
273 vtkGetStringMacro(ProcessIdArrayName);
275
277
286 vtkSetStringMacro(CompositeIdArrayName);
287 vtkGetStringMacro(CompositeIdArrayName);
289
290 protected:
291 vtkCompositePolyDataMapper();
292 ~vtkCompositePolyDataMapper() override;
293
294 MapperHashType InsertPolyData(vtkPolyData* polydata, const unsigned int& flatIndex);
295
301 vtkExecutive* CreateDefaultExecutive() override;
302
306 int FillInputPortInformation(int port, vtkInformation* info) override;
307
315 virtual vtkCompositePolyDataMapperDelegator* CreateADelegator();
316
322 virtual void PreRender(const std::vector<vtkSmartPointer<vtkCompositePolyDataMapperDelegator>>&,
323 vtkRenderer*, vtkActor*)
324 {
325 }
326
331 virtual void PostRender(const std::vector<vtkSmartPointer<vtkCompositePolyDataMapperDelegator>>&,
332 vtkRenderer*, vtkActor*)
333 {
334 }
335
339 vtkPolyDataMapper::MapperHashType GenerateHash(vtkPolyData* polydata) override;
340
344 virtual vtkDataObjectTreeIterator* MakeAnIterator(vtkCompositeDataSet* dataset);
345
349 void ComputeBounds() override;
350
351 bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
352
353 void BuildRenderValues(
354 vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
355
361 vtkNew<vtkPolyDataMapper> PrototypeMapper;
362
366 vtkSmartPointer<vtkCompositeDataDisplayAttributes> CompositeAttributes;
367
372 bool ColorMissingArraysWithNanColor = false;
373
377 vtkTimeStamp BoundsMTime;
378
379 // additional picking indirection
380 char* PointIdArrayName = nullptr;
381 char* CellIdArrayName = nullptr;
382 char* ProcessIdArrayName = nullptr;
383 char* CompositeIdArrayName = nullptr;
384
385 vtkStateStorage TranslucentState;
386 bool HasTranslucentGeometry = false;
387 vtkStateStorage RenderValuesState;
388 vtkStateStorage TempState;
389 vtkTimeStamp DelegatorMTime;
390
391 private:
392 vtkCompositePolyDataMapper(const vtkCompositePolyDataMapper&) = delete;
393 void operator=(const vtkCompositePolyDataMapper&) = delete;
394
395 std::array<double, 3> ColorResult = {};
396
397 class vtkInternals;
398 std::unique_ptr<vtkInternals> Internals;
399 };
400
401 VTK_ABI_NAMESPACE_END
402 #endif
vtkAbstractMapper
abstract class specifies interface to map data
Definition: vtkAbstractMapper.h:46
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
vtkAlgorithm
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:61
vtkCompositeDataDisplayAttributes
Rendering attributes for a multi-block dataset.
Definition: vtkCompositeDataDisplayAttributes.h:44
vtkCompositeDataSet
abstract superclass for composite (multi-block or AMR) datasets
Definition: vtkCompositeDataSet.h:51
vtkCompositePolyDataMapperDelegator
Delegates rendering of multiple polydata that share similar signatures.
Definition: vtkCompositePolyDataMapperDelegator.h:35
vtkCompositePolyDataMapper
a class that renders hierarchical polygonal data
Definition: vtkCompositePolyDataMapper.h:55
vtkCompositePolyDataMapper::GetCompositeDataDisplayAttributes
vtkCompositeDataDisplayAttributes * GetCompositeDataDisplayAttributes()
Set/get the composite data set attributes.
vtkCompositePolyDataMapper::GetBlockVisibility
bool GetBlockVisibility(unsigned int index)
Set/get the visibility for a block given its flat index.
vtkCompositePolyDataMapper::ComputeBounds
void ComputeBounds() override
Need to loop over the hierarchy to compute bounds.
vtkCompositePolyDataMapper::SetCompositeDataDisplayAttributes
void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes *attributes)
Set/get the composite data set attributes.
vtkCompositePolyDataMapper::GenerateHash
vtkPolyDataMapper::MapperHashType GenerateHash(vtkPolyData *polydata) override
Creates an empty polydata mapper and asks the mapper to hash the polydata.
vtkCompositePolyDataMapper::TranslucentState
vtkStateStorage TranslucentState
Definition: vtkCompositePolyDataMapper.h:385
vtkCompositePolyDataMapper::TempState
vtkStateStorage TempState
Definition: vtkCompositePolyDataMapper.h:388
vtkCompositePolyDataMapper::PrototypeMapper
vtkNew< vtkPolyDataMapper > PrototypeMapper
A prototype of the object factory override mapper.
Definition: vtkCompositePolyDataMapper.h:361
vtkCompositePolyDataMapper::RemoveBlockVisibility
void RemoveBlockVisibility(unsigned int index)
Set/get the visibility for a block given its flat index.
vtkCompositePolyDataMapper::SetBlockVisibility
void SetBlockVisibility(unsigned int index, bool visible)
Set/get the visibility for a block given its flat index.
vtkCompositePolyDataMapper::RecursiveHasTranslucentGeometry
bool RecursiveHasTranslucentGeometry(vtkDataObject *dobj, unsigned int &flat_index)
vtkCompositePolyDataMapper::Render
void Render(vtkRenderer *renderer, vtkActor *actor) override
Standard method for rendering a mapper.
vtkCompositePolyDataMapper::ShallowCopy
void ShallowCopy(vtkAbstractMapper *mapper) override
Make a shallow copy of this mapper.
vtkCompositePolyDataMapper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Release the underlying resources associated with this mapper.
vtkCompositePolyDataMapper::New
static vtkCompositePolyDataMapper * New()
vtkCompositePolyDataMapper::CompositeAttributes
vtkSmartPointer< vtkCompositeDataDisplayAttributes > CompositeAttributes
Composite data set attributes.
Definition: vtkCompositePolyDataMapper.h:366
vtkCompositePolyDataMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCompositePolyDataMapper::SetBlockColor
void SetBlockColor(unsigned int index, const double color[3])
Set/get the color for a block given its flat index.
vtkCompositePolyDataMapper::DelegatorMTime
vtkTimeStamp DelegatorMTime
Definition: vtkCompositePolyDataMapper.h:389
vtkCompositePolyDataMapper::RemoveBlockVisibilities
void RemoveBlockVisibilities()
Set/get the visibility for a block given its flat index.
vtkCompositePolyDataMapper::PostRender
virtual void PostRender(const std::vector< vtkSmartPointer< vtkCompositePolyDataMapperDelegator >> &, vtkRenderer *, vtkActor *)
Invoked just after all delegators render their datasets.
Definition: vtkCompositePolyDataMapper.h:331
vtkCompositePolyDataMapper::RenderValuesState
vtkStateStorage RenderValuesState
Definition: vtkCompositePolyDataMapper.h:387
vtkCompositePolyDataMapper::BuildRenderValues
void BuildRenderValues(vtkRenderer *renderer, vtkActor *actor, vtkDataObject *dobj, unsigned int &flat_index)
vtkCompositePolyDataMapper::MakeAnIterator
virtual vtkDataObjectTreeIterator * MakeAnIterator(vtkCompositeDataSet *dataset)
Initialize an iterator for the composite dataset.
vtkCompositePolyDataMapper::HasTranslucentPolygonalGeometry
bool HasTranslucentPolygonalGeometry() override
Some introspection on the type of data the mapper will render used by props to determine if they shou...
vtkCompositePolyDataMapper::HasOpaqueGeometry
bool HasOpaqueGeometry() override
Some introspection on the type of data the mapper will render used by props to determine if they shou...
vtkCompositePolyDataMapper::SetBlockColor
void SetBlockColor(unsigned int index, double r, double g, double b)
Set/get the color for a block given its flat index.
Definition: vtkCompositePolyDataMapper.h:118
vtkCompositePolyDataMapper::BoundsMTime
vtkTimeStamp BoundsMTime
Time stamp for computation of bounds.
Definition: vtkCompositePolyDataMapper.h:377
vtkCompositePolyDataMapper::GetBounds
double * GetBounds() override
Standard vtkProp method to get 3D bounds of a 3D prop.
vtkDataObjectTreeIterator
superclass for composite data iterators
Definition: vtkDataObjectTreeIterator.h:38
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkExecutive
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:48
vtkHardwareSelector
Definition: vtkHardwareSelector.h:125
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkMapper::GetBounds
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
vtkNew< vtkPolyDataMapper >
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkPolyDataMapper::MapperHashType
std::uintptr_t MapperHashType
Definition: vtkPolyDataMapper.h:58
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:55
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:71
vtkSmartPointer
Hold a reference to a vtkObjectBase instance.
Definition: vtkSmartPointer.h:41
vtkStateStorage
Class to make storing and comparing state quick and easy.
Definition: vtkStateStorage.h:124
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:34
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
std
Definition: vtkSmartPointer.h:310
vtkBlockSortHelper::GetBounds
void GetBounds(T a, double bds[6])
Definition: vtkBlockSortHelper.h:26
vtkX3D::vector
@ vector
Definition: vtkX3D.h:237
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkX3D::value
@ value
Definition: vtkX3D.h:220
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkX3D::color
@ color
Definition: vtkX3D.h:221
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkDeprecation.h
VTK_DEPRECATED_IN_9_3_0
#define VTK_DEPRECATED_IN_9_3_0(reason)
Definition: vtkDeprecation.h:99
vtkPolyDataMapper.h
vtkStateStorage.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:36