VTK  9.7.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 
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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
34 
35 VTK_ABI_NAMESPACE_BEGIN
36 class vtkCharArray;
37 class vtkContext2D;
38 class vtkTable;
39 class vtkPoints2D;
40 class vtkFloatArray;
41 class vtkImageData;
42 class vtkScalarsToColors;
44 
45 class VTKCHARTSCORE_EXPORT VTK_MARSHALAUTO vtkPlotPoints : public vtkPlot
46 {
47 public:
48  vtkTypeMacro(vtkPlotPoints, vtkPlot);
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
54  static vtkPlotPoints* New();
55 
59  bool Paint(vtkContext2D* painter) override;
60 
67  bool PaintLegend(vtkContext2D* painter, const vtkRectf& rect, int legendIndex) override;
68 
72  void GetBounds(double bounds[4]) override;
73 
77  void GetUnscaledInputBounds(double bounds[4]) override;
78 
80 
83  void SetLookupTable(vtkScalarsToColors* lut);
84  vtkScalarsToColors* GetLookupTable();
86 
91  virtual void CreateDefaultLookupTable();
92 
94 
97  vtkSetMacro(ScalarVisibility, vtkTypeBool);
98  vtkGetMacro(ScalarVisibility, vtkTypeBool);
99  vtkBooleanMacro(ScalarVisibility, vtkTypeBool);
101 
103 
108  void SelectColorArray(vtkIdType arrayNum);
109  void SelectColorArray(const vtkStdString& arrayName);
111 
115  vtkStdString GetColorArrayName();
116 
122  vtkIdType GetNearestPoint(const vtkVector2f& point, const vtkVector2f& tolerance,
123  vtkVector2f* location, vtkIdType* segmentId) override;
125 
129  bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max) override;
130 
134  bool SelectPointsInPolygon(const vtkContextPolygon& polygon) override;
135 
139  enum
140  {
147  };
148 
150 
154  vtkGetMacro(MarkerStyle, int);
155  vtkSetMacro(MarkerStyle, int);
157 
159 
163  vtkGetMacro(MarkerSize, float);
164  vtkSetMacro(MarkerSize, float);
166 
168 
171  vtkGetMacro(ValidPointMaskName, vtkStdString);
172  vtkSetMacro(ValidPointMaskName, vtkStdString);
174 
181  bool UpdateCache() override;
182 
183  void ReleaseGraphicsCache() override;
184 
185 protected:
186  vtkPlotPoints();
187  ~vtkPlotPoints() override;
188 
192  bool GetDataArrays(vtkTable* table, vtkDataArray* array[2]);
193 
197  bool CacheRequiresUpdate() override;
198 
202  void CalculateUnscaledInputBounds();
203 
208  void CalculateLogSeries();
209 
215  void FindBadPoints();
216 
220  void CalculateBounds(double bounds[4]);
221 
225  void CreateSortedPoints();
226 
228 
234 
236 
239  class VectorPIMPL;
240  VectorPIMPL* Sorted;
242 
248 
254 
259 
261 
265  float MarkerSize;
267 
268  bool LogX, LogY;
269 
271 
279 
283  double UnscaledInputBounds[4];
284 
285 private:
286  vtkPlotPoints(const vtkPlotPoints&) = delete;
287  void operator=(const vtkPlotPoints&) = delete;
288 };
289 
290 VTK_ABI_NAMESPACE_END
291 #endif // vtkPlotPoints_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:27
vtkCharArray * ValidPointMask
Array which marks valid points in the array.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf &rect, int legendIndex)
Paint legend event for the plot, called whenever the legend needs the plot items symbol/mark/line dra...
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
vtkTypeBool ScalarVisibility
Lookup Table for coloring points by scalar value.
Class for drawing an points given two columns from a vtkTable.
Definition: vtkPlotPoints.h:45
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:31
virtual void GetBounds(double bounds[4])
Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
Definition: vtkPlot.h:393
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.
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:363
int vtkTypeBool
Definition: vtkABI.h:64
Superclass for mapping scalar values to colors.
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:44
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:49
vtkStdString ColorArrayName
Lookup Table for coloring points by scalar value.
virtual bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max)
Select all points in the specified rectangle.
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkStdString ValidPointMaskName
Name of the valid point mask array.
represent and manipulate 2D points
Definition: vtkPoints2D.h:27
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
virtual bool UpdateCache()
Update the internal cache.
Definition: vtkPlot.h:455
virtual void ReleaseGraphicsCache()
Release cache entries created by this context item.
Abstract class for 2D plots.
Definition: vtkPlot.h:43
vtkUnsignedCharArray * Colors
Lookup Table for coloring points by scalar value.
dynamic, self-adjusting array of unsigned char
int MarkerStyle
The marker style that should be used.
virtual bool SelectPointsInPolygon(const vtkContextPolygon &polygon)
Select all points in the specified polygon.
virtual bool CacheRequiresUpdate()
Test if the internal cache requires an update.
vtkScalarsToColors * LookupTable
Lookup Table for coloring points by scalar value.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:59
vtkNew< vtkFloatArray > SelectedPoints
Store a well packed set of XY coordinates for this data series.
virtual void GetUnscaledInputBounds(double bounds[4])
Provide un-log-scaled bounds for the plot inputs.
Definition: vtkPlot.h:419
vtkPoints2D * Points
Store a well packed set of XY coordinates for this data series.
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
float MarkerSize
The marker style that should be used.
VectorPIMPL * Sorted
#define max(a, b)
vtkIdTypeArray * BadPoints
An array containing the indices of all the "bad points", meaning any x, y pair that has an infinity...