VTK  9.3.20240418
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 
50 #include <array> // for ColorResult. Remove when double* GetBlockColor gets removed.
51 #include <memory> // for unique_ptr
52 #include <vector> // for return
53 
54 VTK_ABI_NAMESPACE_BEGIN
55 class vtkActor;
60 class vtkInformation;
61 class vtkPolyData;
62 class vtkRenderer;
63 
64 class VTKRENDERINGCORE_EXPORT vtkCompositePolyDataMapper : public vtkPolyDataMapper
65 {
66 public:
69  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
75  void Render(vtkRenderer* renderer, vtkActor* actor) override;
76 
78 
81  double* GetBounds() VTK_SIZEHINT(6) override;
82  void GetBounds(double bounds[6]) override { this->Superclass::GetBounds(bounds); }
84 
88  void ShallowCopy(vtkAbstractMapper* mapper) override;
89 
94 
96 
101  bool HasOpaqueGeometry() override;
104 
106 
112 
114 
117  void SetBlockVisibility(unsigned int index, bool visible);
118  bool GetBlockVisibility(unsigned int index);
119  void RemoveBlockVisibility(unsigned int index);
122 
124 
127  void SetBlockColor(unsigned int index, const double color[3]);
128  void SetBlockColor(unsigned int index, double r, double g, double b)
129  {
130  double color[3] = { r, g, b };
131  this->SetBlockColor(index, color);
132  }
133  VTK_DEPRECATED_IN_9_3_0("Use void GetBlockColor(unsigned int index, double color[3])")
134  double* GetBlockColor(unsigned int index);
135  void GetBlockColor(unsigned int index, double color[3]);
136  void RemoveBlockColor(unsigned int index);
137  void RemoveBlockColors();
139 
141 
144  void SetBlockOpacity(unsigned int index, double opacity);
145  double GetBlockOpacity(unsigned int index);
146  void RemoveBlockOpacity(unsigned int index);
147  void RemoveBlockOpacities();
149 
151 
154  void SetBlockScalarMode(unsigned int index, int value);
155  int GetBlockScalarMode(unsigned int index);
156  void RemoveBlockScalarMode(unsigned int index);
157  void RemoveBlockScalarModes();
159 
161 
164  void SetBlockArrayAccessMode(unsigned int index, int value);
165  int GetBlockArrayAccessMode(unsigned int index);
166  void RemoveBlockArrayAccessMode(unsigned int index);
167  void RemoveBlockArrayAccessModes();
169 
171 
174  void SetBlockArrayComponent(unsigned int index, int value);
175  int GetBlockArrayComponent(unsigned int index);
176  void RemoveBlockArrayComponent(unsigned int index);
177  void RemoveBlockArrayComponents();
179 
181 
184  void SetBlockArrayId(unsigned int index, int value);
185  int GetBlockArrayId(unsigned int index);
186  void RemoveBlockArrayId(unsigned int index);
187  void RemoveBlockArrayIds();
189 
191 
194  void SetBlockArrayName(unsigned int index, const std::string& value);
195  std::string GetBlockArrayName(unsigned int index);
196  void RemoveBlockArrayName(unsigned int index);
197  void RemoveBlockArrayNames();
199 
201 
204  void SetBlockFieldDataTupleId(unsigned int index, vtkIdType value);
205  vtkIdType GetBlockFieldDataTupleId(unsigned int index);
206  void RemoveBlockFieldDataTupleId(unsigned int index);
207  void RemoveBlockFieldDataTupleIds();
209 
211 
217  vtkSetMacro(ColorMissingArraysWithNanColor, bool);
218  vtkGetMacro(ColorMissingArraysWithNanColor, bool);
219  vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
221 
223 
226  using vtkAlgorithm::SetInputArrayToProcess;
227  void SetInputArrayToProcess(
228  int idx, int port, int connection, int fieldAssociation, const char* name) override;
229  void SetInputArrayToProcess(
230  int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
231  void SetInputArrayToProcess(int idx, vtkInformation* info) override;
233 
237  std::vector<vtkPolyData*> GetRenderedList();
238 
243  void ProcessSelectorPixelBuffers(
244  vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
245 
249  void SetVBOShiftScaleMethod(int method) override;
250 
256  void SetPauseShiftScale(bool pauseShiftScale) override;
257 
261  vtkMTimeType GetMTime() override;
262 
264 
270  vtkSetStringMacro(PointIdArrayName);
271  vtkGetStringMacro(PointIdArrayName);
272  vtkSetStringMacro(CellIdArrayName);
273  vtkGetStringMacro(CellIdArrayName);
275 
277 
282  vtkSetStringMacro(ProcessIdArrayName);
283  vtkGetStringMacro(ProcessIdArrayName);
285 
287 
296  vtkSetStringMacro(CompositeIdArrayName);
297  vtkGetStringMacro(CompositeIdArrayName);
299 
300 protected:
303 
304  MapperHashType InsertPolyData(vtkPolyData* polydata, const unsigned int& flatIndex);
305 
311  vtkExecutive* CreateDefaultExecutive() override;
312 
316  int FillInputPortInformation(int port, vtkInformation* info) override;
317 
325  virtual vtkCompositePolyDataMapperDelegator* CreateADelegator();
326 
334  {
335  }
336 
343  {
344  }
345 
350 
355 
359  void ComputeBounds() override;
360 
361  bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
362 
364  vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
365 
372 
377 
382  bool ColorMissingArraysWithNanColor = false;
383 
388 
389  // additional picking indirection
390  char* PointIdArrayName = nullptr;
391  char* CellIdArrayName = nullptr;
392  char* ProcessIdArrayName = nullptr;
393  char* CompositeIdArrayName = nullptr;
394 
396  bool HasTranslucentGeometry = false;
400 
401 private:
403  void operator=(const vtkCompositePolyDataMapper&) = delete;
404 
405  std::array<double, 3> ColorResult = {};
406 
407  class vtkInternals;
408  std::unique_ptr<vtkInternals> Internals;
409 };
410 
411 VTK_ABI_NAMESPACE_END
412 #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.
Definition: vtkAlgorithm.h:162
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.
static vtkCompositePolyDataMapper * New()
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.
void RemoveBlockVisibilities()
Set/get the visibility for a block given its flat index.
virtual void PostRender(const std::vector< vtkSmartPointer< vtkCompositePolyDataMapperDelegator >> &, vtkRenderer *, vtkActor *)
Invoked just after all delegators render their datasets.
void BuildRenderValues(vtkRenderer *renderer, vtkActor *actor, vtkDataObject *dobj, unsigned int &flat_index)
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.
double * GetBounds() override
Standard vtkProp method to get 3D bounds of a 3D prop.
superclass for composite data iterators
general representation of visualization data
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:69
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,...
map vtkPolyData to graphics primitives
std::uintptr_t MapperHashType
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:181
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:66
abstract specification for renderers
Definition: vtkRenderer.h:172
Hold a reference to a vtkObjectBase instance.
Class to make storing and comparing state quick and easy.
record modification and/or execution time
Definition: vtkTimeStamp.h:44
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
void GetBounds(T a, double bds[6])
@ vector
Definition: vtkX3D.h:237
@ info
Definition: vtkX3D.h:376
@ value
Definition: vtkX3D.h:220
@ port
Definition: vtkX3D.h:447
@ color
Definition: vtkX3D.h:221
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
#define VTK_DEPRECATED_IN_9_3_0(reason)
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_SIZEHINT(...)