VTK  9.7.20261119
vtkPlotRadViz.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
3
61
62#ifndef vtkPlotRadViz_h
63#define vtkPlotRadViz_h
64
65#include "vtkChartsCoreModule.h" // For export macro
66#include "vtkNew.h" // For vtkNew
67#include "vtkPen.h" // For SetSmartPointerMacro
68#include "vtkPlot.h" // For the base class
69#include "vtkPoints2D.h" // For GetSmartPointerMacro
70#include "vtkSetGet.h"
71#include "vtkSmartPointer.h"
72#include "vtkTextProperty.h" // For SetSmartPointerMacro
74#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
75
76#include <string> // For variable names
77
78VTK_ABI_NAMESPACE_BEGIN
79class vtkContext2D;
80class vtkColorSeries;
81class vtkDataObject;
82class vtkDataSet;
84class vtkDataArray;
85class vtkDoubleArray;
87class vtkPoints2D;
88class vtkStringArray;
89class vtkTextProperty;
91
92class VTKCHARTSCORE_EXPORT VTK_MARSHALAUTO vtkPlotRadViz : public vtkPlot
93{
94public:
95 vtkTypeMacro(vtkPlotRadViz, vtkPlot);
96 void PrintSelf(ostream& os, vtkIndent indent) override;
97
98 static vtkPlotRadViz* New();
99
100 virtual void SetInputDataSet(vtkDataSet* dataset);
106 void SetInputArray(int index, const vtkStdString& name) override;
116 bool Paint(vtkContext2D* painter) override;
117
119
139 void SetVariableVisibility(const std::string& name, bool visible);
140 void SetVariableVisibility(int index, bool visible);
141 void SetVariableVisibilityAll(bool visible);
142 bool GetVariableVisibility(const std::string& name);
143 bool GetVariableVisibility(int index);
148 bool GetVariablesVisibleByDefault() VTK_FUTURE_CONST;
150 std::vector<std::string> GetNameVisibilityExceptions() VTK_FUTURE_CONST;
151 void SetNameVisibilityExceptions(const std::vector<std::string>& names);
152 std::vector<int> GetIndexVisibilityExceptions() VTK_FUTURE_CONST;
153 void SetIndexVisibilityExceptions(const std::vector<int>& indices);
155 void SetVisibleVariableIndices(const std::vector<int>& indices);
159 void AddVisibleVariableIndex(int index);
161
163
168 void SetDimensions(int arg1, int arg2, int arg3, int arg4);
169 void SetDimensions(const int arg[4]);
170 vtkGetVector4Macro(Dimensions, int);
172
174
178 vtkSetMacro(ColorWheelSegmentCount, int);
179 vtkGetMacro(ColorWheelSegmentCount, int);
181
183
188 vtkSetMacro(ColorWheelRingCount, int);
189 vtkGetMacro(ColorWheelRingCount, int);
191
193
200
202
209
211
214 vtkSetMacro(ColorWheelVisibility, bool);
215 vtkGetMacro(ColorWheelVisibility, bool);
216 vtkBooleanMacro(ColorWheelVisibility, bool);
218
220
226 vtkSetMacro(ScalarVisibility, bool);
227 vtkGetMacro(ScalarVisibility, bool);
228 vtkBooleanMacro(ScalarVisibility, bool);
230
232
239 vtkSetClampMacro(MarkerOutlineWidth, double, 0.0, VTK_DOUBLE_MAX);
240 vtkGetMacro(MarkerOutlineWidth, double);
242
244
248 vtkSetSmartPointerMacro(VerticesPen, vtkPen);
249 vtkGetSmartPointerMacro(VerticesPen, vtkPen);
253 vtkGetSmartPointerMacro(Vertices, vtkPoints2D);
259 virtual void SetVerticesRotation(double rotation);
260 vtkGetMacro(VerticesRotation, double);
262
264
271 vtkSetMacro(VerticesClockwiseOrdering, bool);
272 vtkGetMacro(VerticesClockwiseOrdering, bool);
273 vtkBooleanMacro(VerticesClockwiseOrdering, bool);
275
277
284 vtkSetVector2Macro(LensCenter, double);
285 vtkGetVector2Macro(LensCenter, double);
286 virtual void SetLensRadius(double radius);
287 vtkGetMacro(LensRadius, double);
298 virtual void SetSceneLensCenter(const double* center);
306 virtual void SetSceneLensRadius(double radius);
315 vtkSetSmartPointerMacro(LensPen, vtkPen);
316 vtkGetSmartPointerMacro(LensPen, vtkPen);
323 vtkSetMacro(OutsideLensAlpha, double);
324 vtkGetMacro(OutsideLensAlpha, double);
328 vtkSetMacro(LensVisibility, bool);
329 vtkGetMacro(LensVisibility, bool);
330 vtkBooleanMacro(LensVisibility, bool);
332
334
343 vtkSetMacro(ActiveVertexIndex, int);
344 vtkGetMacro(ActiveVertexIndex, int);
349 vtkSetMacro(ActiveLensOutline, bool);
350 vtkGetMacro(ActiveLensOutline, bool);
356 vtkSetMacro(ActiveLensInterior, bool);
357 vtkGetMacro(ActiveLensInterior, bool);
359
363 const double* GetSceneCenter() const VTK_SIZEHINT(2);
367 double GetSceneRadius() const;
368
370
375 vtkSetSmartPointerMacro(LabelsProperties, vtkTextProperty);
376 vtkGetSmartPointerMacro(LabelsProperties, vtkTextProperty);
378
380
395 void SetPartitionIndices(const std::vector<int>& partitionIndices);
396 std::vector<int> GetPartitionIndices() VTK_FUTURE_CONST;
397 void SetPartitionOffsets(const std::vector<int>& partitionOffsets);
398 std::vector<int> GetPartitionOffsets() VTK_FUTURE_CONST;
400
402
410 void AddPartitionIndex(int index);
414
416
427 void SetCustomRange(const std::vector<double>& customRange);
428 std::vector<double> GetCustomRange() VTK_FUTURE_CONST;
430
431protected:
433 ~vtkPlotRadViz() override;
440 vtkContext2D* painter, vtkDataArray* points, vtkPen* pen, vtkDataArray* color = nullptr);
446 vtkContext2D* painter, vtkDataArray* points, vtkPen* pen, int activeIndex = -1);
448 void DrawLens(vtkContext2D* painter);
480 static std::pair<int, int> GetJustification(double xy[2]);
481 void ShiftLabelByPenWidth(double width, double transformedXy[2]);
483
493 static vtkDataArray* GetArray(vtkDataSetAttributes* attributes, const char* name);
495
496 int Dimensions[4] = { 0, 0, 0, 0 };
505 double MarkerOutlineWidth = 1.0;
514 vtkColor4ub ActiveColor = vtkColor4ub(255, 0, 0, 255); // red
524 bool ActiveLensOutline = false;
529 bool ActiveLensInterior = false;
533 double OutsideLensAlpha = 1.0;
537 bool LensVisibility = false;
541 double LensCenter[2] = { 0.0, 0.0 };
542 double LensRadius = 1.0;
546 double SceneLensCenter[2] = { 0.0, 0.0 };
547
549 double VerticesRotation = 0.0;
551
567 bool ScalarVisibility = false;
568
577
578private:
579 vtkPlotRadViz(const vtkPlotRadViz&) = delete;
580 void operator=(const vtkPlotRadViz&) = delete;
581
582 class vtkInternals;
583 vtkInternals* Internals;
584};
585
586VTK_ABI_NAMESPACE_END
587#endif // vtkPlotRadViz_h
offset[0]
Definition PyrCnBasis.h:96
stores a list of colors.
Class for drawing 2D primitives to a graphical context.
general representation of visualization data
represent and manipulate attribute data in a dataset
abstract class to specify dataset behavior
Definition vtkDataSet.h:165
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition vtkIndent.h:108
Maps multivariate data to color and opacity.
Allocate and hold a VTK object.
Definition vtkNew.h:168
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition vtkPen.h:79
const double * GetSceneCenter() const
Center of the plot in scene coordinates.
double MarkerOutlineWidth
Width of the black outline of the markers.
bool GetVariableVisibility(int index)
Variable visibility, by name or index.
void UpdateCenterAndRadius(vtkContext2D *painter)
Recomputes the plot circle's center and radius from Dimensions, shrinking the radius so that there is...
void SetVariablesVisibleByDefault(bool visible)
Variable visibility, by name or index.
vtkSmartPointer< vtkUnsignedCharArray > TransformColors(vtkDataArray *rgba)
vtkNew< vtkMultiVariateToRGBA > ComputeGBC
Persistent filter used to compute the GBC/RGBA values, and that also owns the variable visibility con...
virtual void SetSceneLensRadius(double radius)
Radius of the lens in scene coordinates, see SetSceneLensCenter, including why these functions are ex...
static vtkDataArray * GetArray(vtkDataSetAttributes *attributes, const char *name)
Returns the array 'name' of 'attributes' or throws std::runtime_error if the array is not found.
void DrawLabels(vtkContext2D *painter, vtkDataArray *vertices, vtkPen *pen)
void SetVariableVisibility(const std::string &name, bool visible)
Variable visibility, by name or index.
bool Paint(vtkContext2D *painter) override
Paint event for the item.
vtkSmartPointer< vtkDoubleArray > ApplyPenColor(vtkPen *pen, vtkDataArray *rgba)
Returns a per-point RGBA array using 'pen' color for RGB and 'rgba's A component for alpha.
bool ColorWheelVisibility
vtkSmartPointer< vtkStringArray > VisibleLabels
The label of each vertex: the labels set with SetLabels for the visible variables,...
void AddVisibleVariableIndex(int index)
Variable visibility, by name or index.
std::vector< std::string > GetNameVisibilityExceptions() VTK_FUTURE_CONST
Variable visibility, by name or index.
double SceneLensCenter[2]
Storage for GetSceneLensCenter().
std::vector< int > GetVisibleVariableIndices()
Variable visibility, by name or index.
void ResetVisibleVariableIndices()
Variable visibility, by name or index.
vtkSmartPointer< vtkPen > LensPen
Controls how the lens circle outline is drawn.
void UpdateFilterInput()
Updates the producer of the plot input, then passes the input and the array selection of the plot to ...
void SetVariableVisibilityAll(bool visible)
Variable visibility, by name or index.
void SetVisibleVariableIndices(const std::vector< int > &indices)
Variable visibility, by name or index.
void SetVariableVisibility(int index, bool visible)
Variable visibility, by name or index.
bool ActiveLensOutline
Set to true when the mouse is over the lens outline or when the lens is resized and set to false othe...
bool GetVariableVisibility(const std::string &name)
Variable visibility, by name or index.
std::vector< int > GetPartitionIndices() VTK_FUTURE_CONST
Variables can be partitioned into several groups.
bool GetVariablesVisibleByDefault() VTK_FUTURE_CONST
Variable visibility, by name or index.
static vtkPlotRadViz * New()
void ComputeVisibleLabels()
Computes VisibleLabels from the visible variables.
void SetCustomRange(const std::vector< double > &customRange)
Custom ranges used as the global min/max when normalizing scalars, instead of the range computed from...
vtkSmartPointer< vtkPen > VerticesPen
Controls how the vertices are drawn.
void ShiftLabelByPenWidth(double width, double transformedXy[2])
void SetDimensions(int arg1, int arg2, int arg3, int arg4)
Set/Get the bounding box of the plot.
void SetPartitionOffsets(const std::vector< int > &partitionOffsets)
Variables can be partitioned into several groups.
vtkStringArray * GetLabels() override
Returns the labels set with SetLabels(), or nullptr.
double GetSceneLensRadius()
Center and radius of the lens in GBC space (the unit circle centered at the origin,...
double LensCenter[2]
The lens in GBC space.
void SetVisibleVariables(vtkStringArray *names)
Variable visibility, by name or index.
double VerticesRotation
int ActiveVertexIndex
The index of the active vertex (mouse over it or rotating the vertices by dragging that vertex),...
static int GetColorWheelStartAngle()
Angle in degrees at which the starting color (red) is placed on the color wheel.
bool LensVisibility
Show the lens if true.
std::tuple< vtkDataArray *, vtkDataArray *, vtkDataArray * > GetVerticesGbcRgba(vtkDataObject *output)
Returns the arrays named 'vertices', 'gbc' and 'rgba' from a table or dataset, or throws std::runtime...
void AddPartitionOffset(int offset)
Element-wise, ClientServer-wrappable equivalents of SetPartitionIndices() and SetPartitionOffsets().
vtkColor4ub ActiveColor
Pen used for active vertex, active lens circle or active lens center.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::vector< int > GetIndexVisibilityExceptions() VTK_FUTURE_CONST
Variable visibility, by name or index.
static bool GetColorWheelClockwiseOrdering()
Colors are laid out in clockwise order if true, counter-clockwise otherwise.
void SetInputArray(int index, const vtkStdString &name) override
Selects the array 'name' of a dataset input for index 0, searching the point data then the cell data,...
std::vector< int > GetPartitionOffsets() VTK_FUTURE_CONST
Variables can be partitioned into several groups.
void SetPartitionIndices(const std::vector< int > &partitionIndices)
Variables can be partitioned into several groups.
bool VerticesClockwiseOrdering
void AddPartitionIndex(int index)
Element-wise, ClientServer-wrappable equivalents of SetPartitionIndices() and SetPartitionOffsets().
void SetNameVisibilityExceptions(const std::vector< std::string > &names)
Variable visibility, by name or index.
vtkStringArray * GetVisibleVariables()
Variable visibility, by name or index.
void ClearPartitionOffsets()
Element-wise, ClientServer-wrappable equivalents of SetPartitionIndices() and SetPartitionOffsets().
vtkSmartPointer< vtkPoints2D > Vertices
vtkSmartPointer< vtkPoints2D > DrawColoredMarkers(vtkContext2D *painter, vtkDataArray *points, vtkPen *pen, vtkDataArray *color=nullptr)
Draw the points using the 'pen' attributes and 'color' instead of the 'pen' color.
void SetIndexVisibilityExceptions(const std::vector< int > &indices)
Variable visibility, by name or index.
vtkSmartPointer< vtkPoints2D > TransformPoints(vtkDataArray *points)
void ClearPartitionIndices()
Element-wise, ClientServer-wrappable equivalents of SetPartitionIndices() and SetPartitionOffsets().
void DrawColorWheel(vtkContext2D *painter)
virtual void SetVerticesRotation(double rotation)
Angle in degrees to rotate the vertices encoding the multivariate attributes.
double GetSceneRadius() const
Radius of the plot in scene coordinates.
double * GetSceneLensCenter()
Center and radius of the lens in GBC space (the unit circle centered at the origin,...
vtkSmartPointer< vtkTextProperty > LabelsProperties
The text properties associated with the vertex labels.
vtkSmartPointer< vtkPoints2D > DrawMarkers(vtkContext2D *painter, vtkDataArray *points, vtkPen *pen, int activeIndex=-1)
Draw the points using the 'pen' 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...
static std::pair< int, int > GetJustification(double xy[2])
Returns the horizontal and vertical text justification for xy coordinates.
void DrawLens(vtkContext2D *painter)
virtual void SetLensRadius(double radius)
Center and radius of the lens in GBC space (the unit circle centered at the origin,...
virtual void SetSceneLensCenter(const double *center)
Center of the lens in scene coordinates.
double OutsideLensAlpha
Alpha cap for points outside the lens.
virtual void SetInputDataSet(vtkDataSet *dataset)
bool ActiveLensInterior
Set to true when the mouse is over the lens interior or when the lens is dragged and set to false oth...
represent and manipulate 2D points
Definition vtkPoints2D.h:28
Hold a reference to a vtkObjectBase instance.
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
Wrapper around std::string to keep symbols short.
a vtkAbstractArray subclass for strings
represent text properties.
dynamic, self-adjusting array of unsigned char
std::pair< boost::graph_traits< vtkGraph * >::vertex_iterator, boost::graph_traits< vtkGraph * >::vertex_iterator > vertices(vtkGraph *g)
#define vtkDataArray
#define VTK_DOUBLE_MAX
Definition vtkType.h:205
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)