VTK: Charts/Core/vtkPlotPoints.h Source File

| VTK 9.3.1

vtkPlotPoints.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
33 #ifndef vtkPlotPoints_h
34 #define vtkPlotPoints_h
35
36 #include "vtkChartsCoreModule.h" // For export macro
37 #include "vtkNew.h" // For ivars
38 #include "vtkPlot.h"
39 #include "vtkRenderingCoreEnums.h" // For marker enum
40 #include "vtkScalarsToColors.h" // For VTK_COLOR_MODE_DEFAULT and _MAP_SCALARS
41 #include "vtkStdString.h" // For color array name
42
43 VTK_ABI_NAMESPACE_BEGIN
44 class vtkCharArray;
45 class vtkContext2D;
46 class vtkTable;
47 class vtkPoints2D;
48 class vtkFloatArray;
49 class vtkImageData;
50 class vtkScalarsToColors;
51 class vtkUnsignedCharArray;
52
53 class VTKCHARTSCORE_EXPORT vtkPlotPoints : public vtkPlot
54 {
55 public:
56 vtkTypeMacro(vtkPlotPoints, vtkPlot);
57 void PrintSelf(ostream& os, vtkIndent indent) override;
58
62 static vtkPlotPoints* New();
63
67 bool Paint(vtkContext2D* painter) override;
68
75 bool PaintLegend(vtkContext2D* painter, const vtkRectf& rect, int legendIndex) override;
76
80 void GetBounds(double bounds[4]) override;
81
85 void GetUnscaledInputBounds(double bounds[4]) override;
86
88
91 void SetLookupTable(vtkScalarsToColors* lut);
92 vtkScalarsToColors* GetLookupTable();
94
99 virtual void CreateDefaultLookupTable();
100
102
105 vtkSetMacro(ScalarVisibility, vtkTypeBool);
106 vtkGetMacro(ScalarVisibility, vtkTypeBool);
107 vtkBooleanMacro(ScalarVisibility, vtkTypeBool);
109
111
116 void SelectColorArray(vtkIdType arrayNum);
117 void SelectColorArray(const vtkStdString& arrayName);
119
123 vtkStdString GetColorArrayName();
124
130 vtkIdType GetNearestPoint(const vtkVector2f& point, const vtkVector2f& tolerance,
131 vtkVector2f* location, vtkIdType* segmentId) override;
132 using vtkPlot::GetNearestPoint;
133
137 bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max) override;
138
142 bool SelectPointsInPolygon(const vtkContextPolygon& polygon) override;
143
147 enum
148 {
149 NONE = VTK_MARKER_NONE,
150 CROSS = VTK_MARKER_CROSS,
151 PLUS = VTK_MARKER_PLUS,
152 SQUARE = VTK_MARKER_SQUARE,
153 CIRCLE = VTK_MARKER_CIRCLE,
154 DIAMOND = VTK_MARKER_DIAMOND
155 };
156
158
162 vtkGetMacro(MarkerStyle, int);
163 vtkSetMacro(MarkerStyle, int);
165
167
171 vtkGetMacro(MarkerSize, float);
172 vtkSetMacro(MarkerSize, float);
174
176
179 vtkGetMacro(ValidPointMaskName, vtkStdString);
180 vtkSetMacro(ValidPointMaskName, vtkStdString);
182
189 bool UpdateCache() override;
190
191 void ReleaseGraphicsCache() override;
192
193 protected:
194 vtkPlotPoints();
195 ~vtkPlotPoints() override;
196
200 bool GetDataArrays(vtkTable* table, vtkDataArray* array[2]);
201
205 bool CacheRequiresUpdate() override;
206
210 void CalculateUnscaledInputBounds();
211
216 void CalculateLogSeries();
217
223 void FindBadPoints();
224
228 void CalculateBounds(double bounds[4]);
229
233 void CreateSortedPoints();
234
236
239 vtkPoints2D* Points;
240 vtkNew<vtkFloatArray> SelectedPoints;
242
244
247 class VectorPIMPL;
248 VectorPIMPL* Sorted;
250
255 vtkIdTypeArray* BadPoints;
256
261 vtkCharArray* ValidPointMask;
262
266 vtkStdString ValidPointMaskName;
267
269
272 int MarkerStyle;
273 float MarkerSize;
275
276 bool LogX, LogY;
277
279
282 vtkScalarsToColors* LookupTable;
283 vtkUnsignedCharArray* Colors;
284 vtkTypeBool ScalarVisibility;
285 vtkStdString ColorArrayName;
287
291 double UnscaledInputBounds[4];
292
293 private:
294 vtkPlotPoints(const vtkPlotPoints&) = delete;
295 void operator=(const vtkPlotPoints&) = delete;
296 };
297
298 VTK_ABI_NAMESPACE_END
299 #endif // vtkPlotPoints_h
vtkCharArray
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:50
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:59
vtkContextPolygon
Definition: vtkContextPolygon.h:16
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:40
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:37
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkNew< vtkFloatArray >
vtkPlotPoints
Class for drawing an points given two columns from a vtkTable.
Definition: vtkPlotPoints.h:54
vtkPlotPoints::CalculateLogSeries
void CalculateLogSeries()
Handle calculating the log of the x or y series if necessary.
vtkPlotPoints::MarkerStyle
int MarkerStyle
The marker style that should be used.
Definition: vtkPlotPoints.h:272
vtkPlotPoints::CreateDefaultLookupTable
virtual void CreateDefaultLookupTable()
Create default lookup table.
vtkPlotPoints::GetUnscaledInputBounds
void GetUnscaledInputBounds(double bounds[4]) override
Get the non-log-scaled bounds on chart inputs for this plot as (Xmin, Xmax, Ymin, Ymax).
vtkPlotPoints::SelectColorArray
void SelectColorArray(const vtkStdString &arrayName)
When ScalarMode is set to UsePointFieldData or UseCellFieldData, you can specify which array to use f...
vtkPlotPoints::CalculateUnscaledInputBounds
void CalculateUnscaledInputBounds()
Calculate the unscaled input bounds from the input arrays.
vtkPlotPoints::MarkerSize
float MarkerSize
The marker style that should be used.
Definition: vtkPlotPoints.h:273
vtkPlotPoints::ReleaseGraphicsCache
void ReleaseGraphicsCache() override
Release cache entries created by this context item.
vtkPlotPoints::FindBadPoints
void FindBadPoints()
Find all of the "bad points" in the series.
vtkPlotPoints::GetDataArrays
bool GetDataArrays(vtkTable *table, vtkDataArray *array[2])
Populate the data arrays ready to operate on input data.
vtkPlotPoints::PaintLegend
bool PaintLegend(vtkContext2D *painter, const vtkRectf &rect, int legendIndex) override
Paint legend event for the XY plot, called whenever the legend needs the plot items symbol/mark/line ...
vtkPlotPoints::ScalarVisibility
vtkTypeBool ScalarVisibility
Lookup Table for coloring points by scalar value.
Definition: vtkPlotPoints.h:284
vtkPlotPoints::ColorArrayName
vtkStdString ColorArrayName
Lookup Table for coloring points by scalar value.
Definition: vtkPlotPoints.h:285
vtkPlotPoints::UpdateCache
bool UpdateCache() override
Update the internal cache.
vtkPlotPoints::vtkPlotPoints
vtkPlotPoints()
vtkPlotPoints::GetBounds
void GetBounds(double bounds[4]) override
Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
vtkPlotPoints::~vtkPlotPoints
~vtkPlotPoints() override
vtkPlotPoints::SetLookupTable
void SetLookupTable(vtkScalarsToColors *lut)
Specify a lookup table for the mapper to use.
vtkPlotPoints::LogX
bool LogX
Definition: vtkPlotPoints.h:276
vtkPlotPoints::BadPoints
vtkIdTypeArray * BadPoints
An array containing the indices of all the "bad points", meaning any x, y pair that has an infinity,...
Definition: vtkPlotPoints.h:255
vtkPlotPoints::SelectPoints
bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max) override
Select all points in the specified rectangle.
vtkPlotPoints::SelectColorArray
void SelectColorArray(vtkIdType arrayNum)
When ScalarMode is set to UsePointFieldData or UseCellFieldData, you can specify which array to use f...
vtkPlotPoints::Colors
vtkUnsignedCharArray * Colors
Lookup Table for coloring points by scalar value.
Definition: vtkPlotPoints.h:283
vtkPlotPoints::CacheRequiresUpdate
bool CacheRequiresUpdate() override
Test if the internal cache requires an update.
vtkPlotPoints::Points
vtkPoints2D * Points
Store a well packed set of XY coordinates for this data series.
Definition: vtkPlotPoints.h:239
vtkPlotPoints::Sorted
VectorPIMPL * Sorted
Definition: vtkPlotPoints.h:247
vtkPlotPoints::ValidPointMaskName
vtkStdString ValidPointMaskName
Name of the valid point mask array.
Definition: vtkPlotPoints.h:266
vtkPlotPoints::GetLookupTable
vtkScalarsToColors * GetLookupTable()
Specify a lookup table for the mapper to use.
vtkPlotPoints::Paint
bool Paint(vtkContext2D *painter) override
Paint event for the XY plot, called whenever the chart needs to be drawn.
vtkPlotPoints::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPlotPoints::CalculateBounds
void CalculateBounds(double bounds[4])
Calculate the bounds of the plot, ignoring the bad points.
vtkPlotPoints::SelectPointsInPolygon
bool SelectPointsInPolygon(const vtkContextPolygon &polygon) override
Select all points in the specified polygon.
vtkPlotPoints::SelectedPoints
vtkNew< vtkFloatArray > SelectedPoints
Store a well packed set of XY coordinates for this data series.
Definition: vtkPlotPoints.h:240
vtkPlotPoints::CreateSortedPoints
void CreateSortedPoints()
Create the sorted point list if necessary.
vtkPlotPoints::New
static vtkPlotPoints * New()
Creates a 2D Chart object.
vtkPlotPoints::ValidPointMask
vtkCharArray * ValidPointMask
Array which marks valid points in the array.
Definition: vtkPlotPoints.h:261
vtkPlotPoints::GetColorArrayName
vtkStdString GetColorArrayName()
Get the array name to color by.
vtkPlotPoints::GetNearestPoint
vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location, vtkIdType *segmentId) override
Function to query a plot for the nearest point to the specified coordinate.
vtkPlotPoints::LookupTable
vtkScalarsToColors * LookupTable
Lookup Table for coloring points by scalar value.
Definition: vtkPlotPoints.h:282
vtkPlot
Abstract class for 2D plots.
Definition: vtkPlot.h:53
vtkPlot::GetNearestPoint
virtual vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location, vtkIdType *segmentId)
Function to query a plot for the nearest point to the specified coordinate.
vtkPoints2D
represent and manipulate 2D points
Definition: vtkPoints2D.h:26
vtkRectf
Definition: vtkRect.h:328
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:65
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:68
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:40
vtkVector2f
Definition: vtkVector.h:463
vtkX3D::point
@ point
Definition: vtkX3D.h:236
vtkX3D::location
@ location
Definition: vtkX3D.h:406
vtk::detail::iarrays::NONE
@ NONE
Definition: vtkImplicitArrayTraits.h:239
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkNew.h
vtkPlot.h
vtkRenderingCoreEnums.h
VTK_MARKER_DIAMOND
@ VTK_MARKER_DIAMOND
Definition: vtkRenderingCoreEnums.h:18
VTK_MARKER_SQUARE
@ VTK_MARKER_SQUARE
Definition: vtkRenderingCoreEnums.h:16
VTK_MARKER_PLUS
@ VTK_MARKER_PLUS
Definition: vtkRenderingCoreEnums.h:15
VTK_MARKER_CROSS
@ VTK_MARKER_CROSS
Definition: vtkRenderingCoreEnums.h:14
VTK_MARKER_CIRCLE
@ VTK_MARKER_CIRCLE
Definition: vtkRenderingCoreEnums.h:17
VTK_MARKER_NONE
@ VTK_MARKER_NONE
Definition: vtkRenderingCoreEnums.h:13
vtkScalarsToColors.h
vtkStdString.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:19