VTK  9.2.6
vtkPlotPoints.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPlotPoints.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
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 class vtkCharArray;
44 class vtkContext2D;
45 class vtkTable;
46 class vtkPoints2D;
47 class vtkFloatArray;
48 class vtkStdString;
49 class vtkImageData;
50 class vtkScalarsToColors;
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;
133 
137  bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max) override;
138 
142  bool SelectPointsInPolygon(const vtkContextPolygon& polygon) override;
143 
147  enum
148  {
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 protected:
192  vtkPlotPoints();
193  ~vtkPlotPoints() override;
194 
198  bool GetDataArrays(vtkTable* table, vtkDataArray* array[2]);
199 
203  virtual bool CacheRequiresUpdate() override;
204 
208  void CalculateUnscaledInputBounds();
209 
214  void CalculateLogSeries();
215 
221  void FindBadPoints();
222 
226  void CalculateBounds(double bounds[4]);
227 
231  void CreateSortedPoints();
232 
234 
240 
242 
245  class VectorPIMPL;
246  VectorPIMPL* Sorted;
248 
254 
260 
265 
267 
271  float MarkerSize;
273 
274  bool LogX, LogY;
275 
277 
285 
289  double UnscaledInputBounds[4];
290 
291 private:
292  vtkPlotPoints(const vtkPlotPoints&) = delete;
293  void operator=(const vtkPlotPoints&) = delete;
294 };
295 
296 #endif // vtkPlotPoints_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
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:53
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
virtual void GetBounds(double bounds[4])
Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
Definition: vtkPlot.h:352
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:332
int vtkTypeBool
Definition: vtkABI.h:69
Superclass for mapping scalar values to colors.
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:51
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:57
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:39
vtkStdString ValidPointMaskName
Name of the valid point mask array.
represent and manipulate 2D points
Definition: vtkPoints2D.h:36
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
virtual bool UpdateCache()
Update the internal cache.
Definition: vtkPlot.h:414
Abstract class for 2D plots.
Definition: vtkPlot.h:53
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:73
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:378
vtkPoints2D * Points
Store a well packed set of XY coordinates for this data series.
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...