VTK  9.7.20261119
vtkMultiVariateToRGBA.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
49
50#ifndef vtkMultiVariateToRGBA_h
51#define vtkMultiVariateToRGBA_h
52
54#include "vtkFiltersParallelModule.h" // For export macro
55#include "vtkNew.h" // For vtkNew
56#include "vtkSmartPointer.h" // For vtkSmartPointer
57#include "vtkTimeStamp.h" // For vtkTimeStamp
58#include "vtkWeakPointer.h" // For vtkWeakPointer
59#include <array> // For std::array
60#include <set> // For variable visibility
61#include <string> // For column names
62#include <vector> // For components partition
63
64VTK_ABI_NAMESPACE_BEGIN
65class vtkDoubleArray;
68class vtkStringArray;
69
70class VTKFILTERSPARALLEL_EXPORT vtkMultiVariateToRGBA : public vtkDataObjectAlgorithm
71{
72public:
75 void PrintSelf(ostream& os, vtkIndent indent) override;
76
78
102 vtkSetMacro(StoreGBC, bool);
103 vtkGetMacro(StoreGBC, bool);
104 vtkSetMacro(StoreVertices, bool);
105 vtkGetMacro(StoreVertices, bool);
106 vtkSetMacro(StoreRGBA, bool);
107 vtkGetMacro(StoreRGBA, bool);
108 vtkSetMacro(StoreA, bool);
109 vtkGetMacro(StoreA, bool);
111
117 virtual void SetVerticesRotation(double rotation);
118 vtkGetMacro(VerticesRotation, double);
119
121
128 vtkSetMacro(VerticesClockwiseOrdering, bool);
129 vtkGetMacro(VerticesClockwiseOrdering, bool);
130 vtkBooleanMacro(VerticesClockwiseOrdering, bool);
132
134
140 void SetLensCenter(const double* center);
141 virtual void SetLensCenter(double centerX, double centerY);
142 vtkGetVector2Macro(LensCenter, double);
147 virtual void SetLensRadius(double radius);
148 vtkGetMacro(LensRadius, double);
154 virtual void SetOutsideLensAlpha(double alpha);
155 vtkGetMacro(OutsideLensAlpha, double);
160 virtual void SetInvertLens(bool invert);
161 vtkGetMacro(InvertLens, bool);
162 vtkBooleanMacro(InvertLens, bool);
168 static double GetLensRadius(
169 double lensRadius, double radius, const double* lensCenter, const double* center);
170 static std::array<double, 2> GetLensCenter(
171 double lensRadius, double radius, const double* lensCenter, const double* center);
173
175
181 static void HSLToRGB(double h, double s, double l, double rgb[3]);
182 static constexpr double ColorLightness = 0.55;
184
186
194 static constexpr int GetColorWheelStartAngle() { return 90; }
195 static constexpr bool GetColorWheelClockwiseOrdering() { return true; }
197
199
205
207
224 void SetCustomRange(const std::vector<double>& customRange);
225 std::vector<double> GetCustomRange() VTK_FUTURE_CONST;
227
229
235 void AddCustomRange(double min, double max);
237
248 std::vector<double> GetRange() VTK_FUTURE_CONST;
249
251
272 void SetPartitionIndices(const std::vector<int>& partitionIndices);
273 std::vector<int> GetPartitionIndices() VTK_FUTURE_CONST;
274 void SetPartitionOffsets(const std::vector<int>& partitionOffsets);
275 std::vector<int> GetPartitionOffsets() VTK_FUTURE_CONST;
277
279
287 void AddPartitionIndex(int index);
291
293
315 void SetVariableVisibility(const std::string& name, bool visible);
316 void SetVariableVisibility(int index, bool visible);
323 void SetVariableVisibilityAll(bool visible);
329 bool GetVariableVisibility(const std::string& name);
330 bool GetVariableVisibility(int index);
347 void SetVisibleVariableIndices(const std::vector<int>& indices);
368 void AddVisibleVariableIndex(int index);
379 vtkGetMacro(VariablesVisibleByDefault, bool);
380 vtkSetMacro(VariablesVisibleByDefault, bool);
381 std::vector<std::string> GetNameVisibilityExceptions() VTK_FUTURE_CONST;
382 void SetNameVisibilityExceptions(const std::vector<std::string>& names);
383 std::vector<int> GetIndexVisibilityExceptions() VTK_FUTURE_CONST;
384 void SetIndexVisibilityExceptions(const std::vector<int>& indices);
386
388
393 vtkSetClampMacro(OutputScalarType, int, VTK_FLOAT, VTK_DOUBLE);
394 vtkGetMacro(OutputScalarType, int);
396
400 void Modified() override;
401
402protected:
405
409 bool StoreGBC = false;
410 bool StoreVertices = false;
411 bool StoreRGBA = true;
412 bool StoreA = false;
413 std::vector<int> PartitionIndices;
414 std::vector<int> PartitionOffsets;
418 double LensCenter[2] = { 0.0, 0.0 };
419 double LensRadius = 1.0;
423 double OutsideLensAlpha = 0.0;
424 bool InvertLens = false;
431 std::vector<double> CustomRange;
437 std::vector<double> Range;
447 std::set<std::string> NameVisibilityExceptions;
456
458 vtkInformationVector* outputVector) override;
460
461private:
463 void operator=(const vtkMultiVariateToRGBA&) = delete;
475 std::pair<vtkDataSetAttributes*, vtkSmartPointer<vtkDataArray>> GetAttributesAndScalars(
476 vtkDataObject* input, vtkInformationVector** inputVector);
482 vtkSmartPointer<vtkDataArray> GetVisibleComponentsArray(vtkDataArray* array);
487 bool IsVariableVisible(int index, const std::string& name, bool numeric = true) const;
491 bool IsNumericVariable(int index);
495 vtkSmartPointer<vtkStringArray> VisibleVariablesCache;
496
498
502 void LensModified();
503 bool InLensModified = false;
504 vtkTimeStamp NonLensModifiedTime;
506 // before the lens; CachedRGB is null for StoreA
509 vtkSmartPointer<vtkDoubleArray> CachedVertices;
511 // association of the attributes that received the cached arrays
512 int CachedAssociation = 0;
513 vtkTimeStamp CacheTime;
515
520};
521
522VTK_ABI_NAMESPACE_END
523#endif
offset[0]
Definition PyrCnBasis.h:96
general representation of visualization data
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Multiprocessing communication superclass.
void ClearPartitionIndices()
Element-wise, ClientServer-wrappable equivalents of SetPartitionIndices() and SetPartitionOffsets().
void AddVisibleVariableIndex(int index)
Variable visibility.
virtual vtkStringArray * GetVisibleVariables()
Get the names of the visible variables of the current input, in their natural order.
std::vector< int > PartitionIndices
virtual void SetLensCenter(double centerX, double centerY)
Clamp the lens circle (lensCenter, lensRadius) so that it intersects the reference circle (center,...
void SetVariableVisibility(const std::string &name, bool visible)
Variable visibility.
void SetPartitionOffsets(const std::vector< int > &partitionOffsets)
Variables can be partitioned into several groups.
vtkMultiProcessController * Controller
void SetIndexVisibilityExceptions(const std::vector< int > &indices)
Variable visibility.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool StartVisibleIndexList
True after ResetVisibleVariableIndices() or on a new filter, until the next visibility setter: the ne...
std::vector< double > CustomRange
Custom ranges used as the global min/max when normalizing scalars, interleaved as [min0,...
static void HSLToRGB(double h, double s, double l, double rgb[3])
Convert hue, saturation and lightness (all in [0, 1]) to red, green and blue (in [0,...
void Modified() override
Overridden to tell lens-only changes apart from all other changes.
static double GetLensRadius(double lensRadius, double radius, const double *lensCenter, const double *center)
Clamp the lens circle (lensCenter, lensRadius) so that it intersects the reference circle (center,...
bool GetVariableVisibility(const std::string &name)
Get the visibility of a variable of the current input, by name or index.
static std::array< double, 2 > GetLensCenter(double lensRadius, double radius, const double *lensCenter, const double *center)
Clamp the lens circle (lensCenter, lensRadius) so that it intersects the reference circle (center,...
void ClearPartitionOffsets()
Element-wise, ClientServer-wrappable equivalents of SetPartitionIndices() and SetPartitionOffsets().
virtual void SetVisibleVariables(vtkStringArray *names)
Set the list of visible variables by name: every variable not in this list is hidden.
std::vector< double > GetRange() VTK_FUTURE_CONST
The global [min, max] range actually used to normalize each partition group during the last RequestDa...
void SetVisibleVariableIndices(const std::vector< int > &indices)
Set the list of visible variables by index: every variable not in this list is hidden.
void SetLensCenter(const double *center)
Center of the lens in GBC space (unit circle centered at the origin).
static constexpr int GetColorWheelStartAngle()
Describe the color wheel that matches the computed colors.
static constexpr bool GetColorWheelClockwiseOrdering()
Describe the color wheel that matches the computed colors.
void ClearCustomRange()
Element-wise, ClientServer-wrappable equivalents of SetCustomRange().
static vtkMultiVariateToRGBA * New()
std::vector< int > GetPartitionIndices() VTK_FUTURE_CONST
Variables can be partitioned into several groups.
virtual void SetVerticesRotation(double rotation)
Angle in degrees to rotate the vertices encoding the multivariate attributes.
std::vector< double > GetCustomRange() VTK_FUTURE_CONST
Custom ranges used as the global min/max when normalizing scalars, instead of the range computed from...
void SetCustomRange(const std::vector< double > &customRange)
Custom ranges used as the global min/max when normalizing scalars, instead of the range computed from...
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
std::vector< int > GetVisibleVariableIndices()
Get the indices of the visible variables of the current input, in increasing order.
std::vector< double > Range
The global [min, max] range actually used to normalize each partition group during the last RequestDa...
void SetNameVisibilityExceptions(const std::vector< std::string > &names)
Variable visibility.
void ResetVisibleVariableIndices()
Build the list of visible variables by index, for the ParaView server manager XML,...
virtual void SetLensRadius(double radius)
Radius of the lens in GBC space (unit circle centered at the origin).
int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
void AddCustomRange(double min, double max)
Element-wise, ClientServer-wrappable equivalents of SetCustomRange().
double LensCenter[2]
Where the lens is drawn and its radius.
virtual void SetOutsideLensAlpha(double alpha)
Alpha (opacity) cap for points outside the lens.
void AddPartitionOffset(int offset)
Element-wise, ClientServer-wrappable equivalents of SetPartitionIndices() and SetPartitionOffsets().
std::vector< int > GetPartitionOffsets() VTK_FUTURE_CONST
Variables can be partitioned into several groups.
void SetVariableVisibilityAll(bool visible)
Set the visibility of all variables, including the ones of inputs set later.
std::vector< int > PartitionOffsets
std::vector< int > GetIndexVisibilityExceptions() VTK_FUTURE_CONST
Variable visibility.
std::set< std::string > NameVisibilityExceptions
virtual void SetInvertLens(bool invert)
Swap inside and outside: cap the alpha of the points inside the lens instead.
std::vector< std::string > GetNameVisibilityExceptions() VTK_FUTURE_CONST
Variable visibility.
std::set< int > IndexVisibilityExceptions
virtual void SetController(vtkMultiProcessController *)
Set and get the controller.
void AddPartitionIndex(int index)
Element-wise, ClientServer-wrappable equivalents of SetPartitionIndices() and SetPartitionOffsets().
vtkSmartPointer< vtkStringArray > GetAllVariableNames()
Returns the names of every variable of the current input, visible or not, in their natural order.
void SetPartitionIndices(const std::vector< int > &partitionIndices)
Variables can be partitioned into several groups.
double OutsideLensAlpha
Alpha cap for points outside the lens.
static constexpr double ColorLightness
Convert hue, saturation and lightness (all in [0, 1]) to red, green and blue (in [0,...
bool VariablesVisibleByDefault
Variable visibility: a variable is visible when VariablesVisibleByDefault is true,...
Computes the portion of a dataset which is inside a selection.
Hold a reference to a vtkObjectBase instance.
a vtkAbstractArray subclass for strings
record modification and/or execution time
a weak reference to a vtkObject.
#define vtkDataArray
#define VTK_DOUBLE
Definition vtkType.h:44
#define VTK_FLOAT
Definition vtkType.h:43
#define max(a, b)