VTK  9.3.0
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 
24 #ifndef vtkPlotPoints_h
25 #define vtkPlotPoints_h
26 
27 #include "vtkChartsCoreModule.h" // For export macro
28 #include "vtkNew.h" // For ivars
29 #include "vtkPlot.h"
30 #include "vtkRenderingCoreEnums.h" // For marker enum
31 #include "vtkScalarsToColors.h" // For VTK_COLOR_MODE_DEFAULT and _MAP_SCALARS
32 #include "vtkStdString.h" // For color array name
33 
34 VTK_ABI_NAMESPACE_BEGIN
35 class vtkCharArray;
36 class vtkContext2D;
37 class vtkTable;
38 class vtkPoints2D;
39 class vtkFloatArray;
40 class vtkImageData;
41 class vtkScalarsToColors;
43 
44 class VTKCHARTSCORE_EXPORT vtkPlotPoints : public vtkPlot
45 {
46 public:
47  vtkTypeMacro(vtkPlotPoints, vtkPlot);
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
53  static vtkPlotPoints* New();
54 
58  bool Paint(vtkContext2D* painter) override;
59 
66  bool PaintLegend(vtkContext2D* painter, const vtkRectf& rect, int legendIndex) override;
67 
71  void GetBounds(double bounds[4]) override;
72 
76  void GetUnscaledInputBounds(double bounds[4]) override;
77 
79 
85 
90  virtual void CreateDefaultLookupTable();
91 
93 
96  vtkSetMacro(ScalarVisibility, vtkTypeBool);
97  vtkGetMacro(ScalarVisibility, vtkTypeBool);
98  vtkBooleanMacro(ScalarVisibility, vtkTypeBool);
100 
102 
107  void SelectColorArray(vtkIdType arrayNum);
108  void SelectColorArray(const vtkStdString& arrayName);
110 
115 
122  vtkVector2f* location, vtkIdType* segmentId) override;
124 
128  bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max) override;
129 
133  bool SelectPointsInPolygon(const vtkContextPolygon& polygon) override;
134 
138  enum
139  {
145  DIAMOND = VTK_MARKER_DIAMOND
146  };
147 
149 
153  vtkGetMacro(MarkerStyle, int);
154  vtkSetMacro(MarkerStyle, int);
156 
158 
162  vtkGetMacro(MarkerSize, float);
163  vtkSetMacro(MarkerSize, float);
165 
167 
170  vtkGetMacro(ValidPointMaskName, vtkStdString);
171  vtkSetMacro(ValidPointMaskName, vtkStdString);
173 
180  bool UpdateCache() override;
181 
182  void ReleaseGraphicsCache() override;
183 
184 protected:
186  ~vtkPlotPoints() override;
187 
191  bool GetDataArrays(vtkTable* table, vtkDataArray* array[2]);
192 
196  bool CacheRequiresUpdate() override;
197 
202 
208 
215 
219  void CalculateBounds(double bounds[4]);
220 
225 
227 
233 
235 
238  class VectorPIMPL;
239  VectorPIMPL* Sorted;
241 
247 
253 
258 
260 
264  float MarkerSize;
266 
267  bool LogX, LogY;
268 
270 
278 
282  double UnscaledInputBounds[4];
283 
284 private:
285  vtkPlotPoints(const vtkPlotPoints&) = delete;
286  void operator=(const vtkPlotPoints&) = delete;
287 };
288 
289 VTK_ABI_NAMESPACE_END
290 #endif // vtkPlotPoints_h
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:41
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:50
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:45
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:31
dynamic, self-adjusting array of vtkIdType
topologically and geometrically regular array of data
Definition: vtkImageData.h:43
a simple class to control print indentation
Definition: vtkIndent.h:29
Class for drawing an points given two columns from a vtkTable.
Definition: vtkPlotPoints.h:45
void CalculateLogSeries()
Handle calculating the log of the x or y series if necessary.
int MarkerStyle
The marker style that should be used.
virtual void CreateDefaultLookupTable()
Create default lookup table.
void GetUnscaledInputBounds(double bounds[4]) override
Get the non-log-scaled bounds on chart inputs for this plot as (Xmin, Xmax, Ymin, Ymax).
void SelectColorArray(const vtkStdString &arrayName)
When ScalarMode is set to UsePointFieldData or UseCellFieldData, you can specify which array to use f...
void CalculateUnscaledInputBounds()
Calculate the unscaled input bounds from the input arrays.
float MarkerSize
The marker style that should be used.
void ReleaseGraphicsCache() override
Release cache entries created by this context item.
void FindBadPoints()
Find all of the "bad points" in the series.
bool GetDataArrays(vtkTable *table, vtkDataArray *array[2])
Populate the data arrays ready to operate on input data.
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 ...
vtkTypeBool ScalarVisibility
Lookup Table for coloring points by scalar value.
vtkStdString ColorArrayName
Lookup Table for coloring points by scalar value.
bool UpdateCache() override
Update the internal cache.
void GetBounds(double bounds[4]) override
Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
~vtkPlotPoints() override
void SetLookupTable(vtkScalarsToColors *lut)
Specify a lookup table for the mapper to use.
vtkIdTypeArray * BadPoints
An array containing the indices of all the "bad points", meaning any x, y pair that has an infinity,...
bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max) override
Select all points in the specified rectangle.
void SelectColorArray(vtkIdType arrayNum)
When ScalarMode is set to UsePointFieldData or UseCellFieldData, you can specify which array to use f...
vtkUnsignedCharArray * Colors
Lookup Table for coloring points by scalar value.
bool CacheRequiresUpdate() override
Test if the internal cache requires an update.
vtkPoints2D * Points
Store a well packed set of XY coordinates for this data series.
VectorPIMPL * Sorted
vtkStdString ValidPointMaskName
Name of the valid point mask array.
vtkScalarsToColors * GetLookupTable()
Specify a lookup table for the mapper to use.
bool Paint(vtkContext2D *painter) override
Paint event for the XY plot, called whenever the chart needs to be drawn.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void CalculateBounds(double bounds[4])
Calculate the bounds of the plot, ignoring the bad points.
bool SelectPointsInPolygon(const vtkContextPolygon &polygon) override
Select all points in the specified polygon.
vtkNew< vtkFloatArray > SelectedPoints
Store a well packed set of XY coordinates for this data series.
void CreateSortedPoints()
Create the sorted point list if necessary.
static vtkPlotPoints * New()
Creates a 2D Chart object.
vtkCharArray * ValidPointMask
Array which marks valid points in the array.
vtkStdString GetColorArrayName()
Get the array name to color by.
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.
vtkScalarsToColors * LookupTable
Lookup Table for coloring points by scalar value.
Abstract class for 2D plots.
Definition: vtkPlot.h:44
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.
represent and manipulate 2D points
Definition: vtkPoints2D.h:26
Superclass for mapping scalar values to colors.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:29
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:59
dynamic, self-adjusting array of unsigned char
@ point
Definition: vtkX3D.h:236
@ location
Definition: vtkX3D.h:406
int vtkTypeBool
Definition: vtkABI.h:64
@ VTK_MARKER_DIAMOND
@ VTK_MARKER_SQUARE
@ VTK_MARKER_PLUS
@ VTK_MARKER_CROSS
@ VTK_MARKER_CIRCLE
@ VTK_MARKER_NONE
int vtkIdType
Definition: vtkType.h:315
#define max(a, b)