VTK  9.0.1
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 
30 #ifndef vtkPlotPoints_h
31 #define vtkPlotPoints_h
32 
33 #include "vtkChartsCoreModule.h" // For export macro
34 #include "vtkNew.h" // For ivars
35 #include "vtkPlot.h"
36 #include "vtkRenderingCoreEnums.h" // For marker enum
37 #include "vtkScalarsToColors.h" // For VTK_COLOR_MODE_DEFAULT and _MAP_SCALARS
38 #include "vtkStdString.h" // For color array name
39 
40 class vtkCharArray;
41 class vtkContext2D;
42 class vtkTable;
43 class vtkPoints2D;
44 class vtkFloatArray;
45 class vtkStdString;
46 class vtkImageData;
47 class vtkScalarsToColors;
49 
50 class VTKCHARTSCORE_EXPORT vtkPlotPoints : public vtkPlot
51 {
52 public:
53  vtkTypeMacro(vtkPlotPoints, vtkPlot);
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
59  static vtkPlotPoints* New();
60 
66  void Update() override;
67 
71  bool Paint(vtkContext2D* painter) override;
72 
79  bool PaintLegend(vtkContext2D* painter, const vtkRectf& rect, int legendIndex) override;
80 
84  void GetBounds(double bounds[4]) override;
85 
89  void GetUnscaledInputBounds(double bounds[4]) override;
90 
92 
95  void SetLookupTable(vtkScalarsToColors* lut);
96  vtkScalarsToColors* GetLookupTable();
98 
103  virtual void CreateDefaultLookupTable();
104 
106 
109  vtkSetMacro(ScalarVisibility, vtkTypeBool);
110  vtkGetMacro(ScalarVisibility, vtkTypeBool);
111  vtkBooleanMacro(ScalarVisibility, vtkTypeBool);
113 
115 
120  void SelectColorArray(vtkIdType arrayNum);
121  void SelectColorArray(const vtkStdString& arrayName);
123 
127  vtkStdString GetColorArrayName();
128 
134  vtkIdType GetNearestPoint(const vtkVector2f& point, const vtkVector2f& tolerance,
136 #ifndef VTK_LEGACY_REMOVE
137  vtkIdType* segmentId) override;
138 #else
139  vtkIdType* segmentId = nullptr) override;
140 #endif // VTK_LEGACY_REMOVE
141 
142 #ifndef VTK_LEGACY_REMOVE
144 #endif // VTK_LEGACY_REMOVE
145 
149  bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max) override;
150 
154  bool SelectPointsInPolygon(const vtkContextPolygon& polygon) override;
155 
159  enum
160  {
167  };
168 
170 
174  vtkGetMacro(MarkerStyle, int);
175  vtkSetMacro(MarkerStyle, int);
177 
179 
183  vtkGetMacro(MarkerSize, float);
184  vtkSetMacro(MarkerSize, float);
186 
188 
191  vtkGetMacro(ValidPointMaskName, vtkStdString);
192  vtkSetMacro(ValidPointMaskName, vtkStdString);
194 
195 protected:
196  vtkPlotPoints();
197  ~vtkPlotPoints() override;
198 
202  bool GetDataArrays(vtkTable* table, vtkDataArray* array[2]);
203 
207  bool UpdateTableCache(vtkTable* table);
208 
212  void CalculateUnscaledInputBounds();
213 
218  void CalculateLogSeries();
219 
225  void FindBadPoints();
226 
230  void CalculateBounds(double bounds[4]);
231 
235  void CreateSortedPoints();
236 
238 
244 
246 
249  class VectorPIMPL;
250  VectorPIMPL* Sorted;
252 
258 
264 
269 
274 
276 
280  float MarkerSize;
282 
283  bool LogX, LogY;
284 
286 
294 
298  double UnscaledInputBounds[4];
299 
300 private:
301  vtkPlotPoints(const vtkPlotPoints&) = delete;
302  void operator=(const vtkPlotPoints&) = delete;
303 };
304 
305 #endif // vtkPlotPoints_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
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:50
record modification and/or execution time
Definition: vtkTimeStamp.h:32
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
virtual void GetBounds(double bounds[4])
Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
Definition: vtkPlot.h:343
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:338
int vtkTypeBool
Definition: vtkABI.h:69
Superclass for mapping scalar values to colors.
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:35
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
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:33
vtkStdString ValidPointMaskName
Name of the valid point mask array.
represent and manipulate 2D points
Definition: vtkPoints2D.h:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
Abstract class for 2D plots.
Definition: vtkPlot.h:46
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.
vtkScalarsToColors * LookupTable
Lookup Table for coloring points by scalar value.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:62
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:369
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...
vtkTimeStamp BuildTime
The point cache is marked dirty until it has been initialized.
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
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...