VTK  9.3.0
vtkCompositeDataDisplayAttributes.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
18#ifndef vtkCompositeDataDisplayAttributes_h
19#define vtkCompositeDataDisplayAttributes_h
20#include <functional> // for std::function
21#include <unordered_map> // for std::unordered_map
22
23#include "vtkColor.h" // for vtkColor3d
24#include "vtkObject.h"
25#include "vtkRenderingCoreModule.h" // for export macro
26#include "vtkSmartPointer.h" // for arg
27#include "vtkVector.h" // for vtkVector2d
28
29VTK_ABI_NAMESPACE_BEGIN
30class vtkBoundingBox;
31class vtkDataObject;
33
34class VTKRENDERINGCORE_EXPORT vtkCompositeDataDisplayAttributes : public vtkObject
35{
36public:
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
45
47
50 void SetBlockVisibility(vtkDataObject* data_object, bool visible);
51 bool GetBlockVisibility(vtkDataObject* data_object) const;
53
58 bool HasBlockVisibility(vtkDataObject* data_object) const;
59
64
70
75
77
80 void SetBlockPickability(vtkDataObject* data_object, bool visible);
81 bool GetBlockPickability(vtkDataObject* data_object) const;
83
88 bool HasBlockPickability(vtkDataObject* data_object) const;
89
94
100
102
105 void SetBlockScalarVisibility(vtkDataObject* data_object, bool value);
106 bool GetBlockScalarVisibility(vtkDataObject* data_object) const;
107 bool HasBlockScalarVisibility(vtkDataObject* data_object) const;
112
114
117 void SetBlockUseLookupTableScalarRange(vtkDataObject* data_object, bool value);
124
126
136
138
141 void SetBlockColor(vtkDataObject* data_object, const double color[3]);
142 void GetBlockColor(vtkDataObject* data_object, double color[3]) const;
145
149 bool HasBlockColors() const;
150
154 bool HasBlockColor(vtkDataObject* data_object) const;
155
159 void RemoveBlockColor(vtkDataObject* data_object);
160
165
167
170 void SetBlockOpacity(vtkDataObject* data_object, double opacity);
171 double GetBlockOpacity(vtkDataObject* data_object) const;
173
177 bool HasBlockOpacities() const;
178
182 bool HasBlockOpacity(vtkDataObject* data_object) const;
183
188
193
195
199 void SetBlockMaterial(vtkDataObject* data_object, const std::string& material);
200 const std::string& GetBlockMaterial(vtkDataObject* data_object) const;
202
206 bool HasBlockMaterials() const;
207
211 bool HasBlockMaterial(vtkDataObject* data_object) const;
212
217
222
224
227 void SetBlockColorMode(vtkDataObject* data_object, int value);
228 int GetBlockColorMode(vtkDataObject* data_object) const;
229 bool HasBlockColorMode(vtkDataObject* data_object) const;
230 bool HasBlockColorModes() const;
234
236
239 void SetBlockScalarMode(vtkDataObject* data_object, int value);
240 int GetBlockScalarMode(vtkDataObject* data_object) const;
241 bool HasBlockScalarMode(vtkDataObject* data_object) const;
246
248
251 void SetBlockArrayAccessMode(vtkDataObject* data_object, int value);
252 int GetBlockArrayAccessMode(vtkDataObject* data_object) const;
253 bool HasBlockArrayAccessMode(vtkDataObject* data_object) const;
258
260
263 void SetBlockArrayComponent(vtkDataObject* data_object, int value);
264 int GetBlockArrayComponent(vtkDataObject* data_object) const;
265 bool HasBlockArrayComponent(vtkDataObject* data_object) const;
270
272
275 void SetBlockArrayId(vtkDataObject* data_object, int value);
276 int GetBlockArrayId(vtkDataObject* data_object) const;
277 bool HasBlockArrayId(vtkDataObject* data_object) const;
278 bool HasBlockArrayIds() const;
282
284
287 void SetBlockScalarRange(vtkDataObject* data_object, const vtkVector2d& value);
289 bool HasBlockScalarRange(vtkDataObject* data_object) const;
294
296
299 void SetBlockArrayName(vtkDataObject* data_object, const std::string& value);
300 std::string GetBlockArrayName(vtkDataObject* data_object) const;
301 bool HasBlockArrayName(vtkDataObject* data_object) const;
302 bool HasBlockArrayNames() const;
306
308
313 bool HasBlockFieldDataTupleId(vtkDataObject* data_object) const;
318
320
325 bool HasBlockLookupTable(vtkDataObject* data_object) const;
330
338 vtkCompositeDataDisplayAttributes* cda, vtkDataObject* dobj, double bounds[6]);
339
345 unsigned int flat_index, vtkDataObject* parent_obj, unsigned int current_flat_index = 0);
346
347 void VisitVisibilities(std::function<bool(vtkDataObject*, bool)> visitor)
348 {
349 for (auto entry : this->BlockVisibilities)
350 {
351 if (visitor(entry.first, entry.second))
352 {
353 break;
354 }
355 }
356 }
357
358protected:
361
362private:
364 void operator=(const vtkCompositeDataDisplayAttributes&) = delete;
365
374 static void ComputeVisibleBoundsInternal(vtkCompositeDataDisplayAttributes* cda,
375 vtkDataObject* dobj, vtkBoundingBox* bbox, bool parentVisible = true);
376
377 using BoolMap = std::unordered_map<vtkDataObject*, bool>;
378 using DoubleMap = std::unordered_map<vtkDataObject*, double>;
379 using IntMap = std::unordered_map<vtkDataObject*, int>;
380 using VtkIdTypeMap = std::unordered_map<vtkDataObject*, vtkIdType>;
381 using ColorMap = std::unordered_map<vtkDataObject*, vtkColor3d>;
382 using RangeMap = std::unordered_map<vtkDataObject*, vtkVector2d>;
383 using StringMap = std::unordered_map<vtkDataObject*, std::string>;
384 using LookupTableMap = std::unordered_map<vtkDataObject*, vtkSmartPointer<vtkScalarsToColors>>;
385
386 BoolMap BlockVisibilities;
387 ColorMap BlockColors;
388 DoubleMap BlockOpacities;
389 StringMap BlockMaterials;
390 BoolMap BlockPickabilities;
391 BoolMap BlockScalarVisibilities;
392 BoolMap BlockUseLookupTableScalarRanges;
393 BoolMap BlockInterpolateScalarsBeforeMappings;
394 IntMap BlockColorModes;
395 IntMap BlockScalarModes;
396 IntMap BlockArrayAccessModes;
397 IntMap BlockArrayComponents;
398 IntMap BlockArrayIds;
399 RangeMap BlockScalarRanges;
400 StringMap BlockArrayNames;
401 LookupTableMap BlockLookupTables;
402 VtkIdTypeMap BlockFieldDataTupleIds;
403};
404
405VTK_ABI_NAMESPACE_END
406#endif // vtkCompositeDataDisplayAttributes_h
Fast, simple class for representing and operating on 3D bounds.
Rendering attributes for a multi-block dataset.
void SetBlockColorMode(vtkDataObject *data_object, int value)
bool GetBlockPickability(vtkDataObject *data_object) const
Set/get the pickability for the block with data_object.
void SetBlockMaterial(vtkDataObject *data_object, const std::string &material)
Set/get the material for the block with data_object.
void SetBlockScalarVisibility(vtkDataObject *data_object, bool value)
bool HasBlockOpacities() const
Returns true if any block has an opacity set.
int GetBlockArrayId(vtkDataObject *data_object) const
bool HasBlockVisibilities() const
Returns true if any block has any block visibility is set.
bool HasBlockMaterials() const
Returns true if any block has an material set.
void RemoveBlockArrayId(vtkDataObject *data_object)
void RemoveBlockFieldDataTupleId(vtkDataObject *data_object)
bool HasBlockScalarRange(vtkDataObject *data_object) const
vtkIdType GetBlockFieldDataTupleId(vtkDataObject *data_object) const
void SetBlockOpacity(vtkDataObject *data_object, double opacity)
Set/get the opacity for the block with data_object.
void SetBlockUseLookupTableScalarRange(vtkDataObject *data_object, bool value)
void RemoveBlockArrayName(vtkDataObject *data_object)
void SetBlockColor(vtkDataObject *data_object, const double color[3])
Set/get the color for the block with data_object.
bool HasBlockArrayName(vtkDataObject *data_object) const
void SetBlockScalarMode(vtkDataObject *data_object, int value)
void SetBlockVisibility(vtkDataObject *data_object, bool visible)
Set/get the visibility for the block with data_object.
void RemoveBlockLookupTable(vtkDataObject *data_object)
bool GetBlockVisibility(vtkDataObject *data_object) const
Set/get the visibility for the block with data_object.
void SetBlockPickability(vtkDataObject *data_object, bool visible)
Set/get the pickability for the block with data_object.
void SetBlockArrayComponent(vtkDataObject *data_object, int value)
void RemoveBlockVisibilities()
Removes all block visibility flags.
bool HasBlockArrayId(vtkDataObject *data_object) const
bool HasBlockOpacity(vtkDataObject *data_object) const
Returns true if the block with data_object has an opacity set.
bool HasBlockPickability(vtkDataObject *data_object) const
Returns true if the block with the given data_object has a pickability set.
static vtkCompositeDataDisplayAttributes * New()
void RemoveBlockOpacities()
Removes all block opacities.
void RemoveBlockColor(vtkDataObject *data_object)
Removes the block color for the block with data_object.
void RemoveBlockScalarVisibility(vtkDataObject *data_object)
void GetBlockColor(vtkDataObject *data_object, double color[3]) const
Set/get the color for the block with data_object.
std::string GetBlockArrayName(vtkDataObject *data_object) const
void VisitVisibilities(std::function< bool(vtkDataObject *, bool)> visitor)
bool GetBlockScalarVisibility(vtkDataObject *data_object) const
void RemoveBlockInterpolateScalarsBeforeMapping(vtkDataObject *data_object)
void SetBlockArrayName(vtkDataObject *data_object, const std::string &value)
double GetBlockOpacity(vtkDataObject *data_object) const
Set/get the opacity for the block with data_object.
bool HasBlockInterpolateScalarsBeforeMapping(vtkDataObject *data_object) const
void SetBlockFieldDataTupleId(vtkDataObject *data_object, vtkIdType value)
bool HasBlockUseLookupTableScalarRange(vtkDataObject *data_object) const
bool HasBlockUseLookupTableScalarRanges() const
bool HasBlockColor(vtkDataObject *data_object) const
Returns true if the block with the given data_object has a color.
void SetBlockArrayAccessMode(vtkDataObject *data_object, int value)
bool GetBlockUseLookupTableScalarRange(vtkDataObject *data_object) const
void SetBlockLookupTable(vtkDataObject *data_object, vtkSmartPointer< vtkScalarsToColors > lut)
bool HasBlockInterpolateScalarsBeforeMappings() const
void RemoveBlockMaterial(vtkDataObject *data_object)
Removes the set material for the block with data_object.
const std::string & GetBlockMaterial(vtkDataObject *data_object) const
Set/get the material for the block with data_object.
void RemoveBlockUseLookupTableScalarRange(vtkDataObject *data_object)
void RemoveBlockScalarRange(vtkDataObject *data_object)
bool HasBlockLookupTable(vtkDataObject *data_object) const
void RemoveBlockOpacity(vtkDataObject *data_object)
Removes the set opacity for the block with data_object.
bool HasBlockVisibility(vtkDataObject *data_object) const
Returns true if the block with the given data_object has a visibility set.
int GetBlockColorMode(vtkDataObject *data_object) const
int GetBlockArrayAccessMode(vtkDataObject *data_object) const
void RemoveBlockMaterials()
Removes all block materialss.
vtkVector2d GetBlockScalarRange(vtkDataObject *data_object) const
bool HasBlockFieldDataTupleId(vtkDataObject *data_object) const
bool HasBlockPickabilities() const
Returns true if any block has any block pickability is set.
bool HasBlockArrayAccessMode(vtkDataObject *data_object) const
int GetBlockScalarMode(vtkDataObject *data_object) const
bool GetBlockInterpolateScalarsBeforeMapping(vtkDataObject *data_object) const
void SetBlockScalarRange(vtkDataObject *data_object, const vtkVector2d &value)
void RemoveBlockScalarMode(vtkDataObject *data_object)
void RemoveBlockColorMode(vtkDataObject *data_object)
bool HasBlockColors() const
Returns true if any block has any block color is set.
bool HasBlockScalarVisibility(vtkDataObject *data_object) const
void RemoveBlockPickabilities()
Removes all block pickability flags.
bool HasBlockScalarMode(vtkDataObject *data_object) const
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void RemoveBlockVisibility(vtkDataObject *data_object)
Removes the block visibility flag for the block with data_object.
static void ComputeVisibleBounds(vtkCompositeDataDisplayAttributes *cda, vtkDataObject *dobj, double bounds[6])
If the input dobj is a vtkCompositeDataSet, we will loop over the hierarchy recursively starting from...
static vtkDataObject * DataObjectFromIndex(unsigned int flat_index, vtkDataObject *parent_obj, unsigned int current_flat_index=0)
Get the DataObject corresponding to the node with index flat_index under parent_obj.
void SetBlockInterpolateScalarsBeforeMapping(vtkDataObject *data_object, bool value)
bool HasBlockColorMode(vtkDataObject *data_object) const
bool HasBlockMaterial(vtkDataObject *data_object) const
Returns true if the block with data_object has an material set.
int GetBlockArrayComponent(vtkDataObject *data_object) const
void RemoveBlockArrayComponent(vtkDataObject *data_object)
void SetBlockArrayId(vtkDataObject *data_object, int value)
void RemoveBlockPickability(vtkDataObject *data_object)
Removes the block pickability flag for the block with data_object.
vtkSmartPointer< vtkScalarsToColors > GetBlockLookupTable(vtkDataObject *data_object) const
void RemoveBlockArrayAccessMode(vtkDataObject *data_object)
bool HasBlockArrayComponent(vtkDataObject *data_object) const
vtkColor3d GetBlockColor(vtkDataObject *data_object) const
Set/get the color for the block with data_object.
void RemoveBlockColors()
Removes all block colors.
general representation of visualization data
a simple class to control print indentation
Definition vtkIndent.h:29
abstract base class for most VTK objects
Definition vtkObject.h:49
Superclass for mapping scalar values to colors.
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition vtkType.h:315