VTK
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 "vtkPlot.h"
38 #include "vtkScalarsToColors.h" // For VTK_COLOR_MODE_DEFAULT and _MAP_SCALARS
39 #include "vtkStdString.h" // For color array name
40 #include "vtkNew.h" // For ivars
41 #include "vtkRenderingCoreEnums.h" // For marker enum
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 
69  void Update() override;
70 
74  bool Paint(vtkContext2D *painter) override;
75 
82  bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
83  int legendIndex) override;
84 
88  void GetBounds(double bounds[4]) override;
89 
93  void GetUnscaledInputBounds(double bounds[4]) override;
94 
96 
99  void SetLookupTable(vtkScalarsToColors *lut);
100  vtkScalarsToColors *GetLookupTable();
102 
107  virtual void CreateDefaultLookupTable();
108 
110 
113  vtkSetMacro(ScalarVisibility,vtkTypeBool);
114  vtkGetMacro(ScalarVisibility,vtkTypeBool);
115  vtkBooleanMacro(ScalarVisibility,vtkTypeBool);
117 
119 
124  void SelectColorArray(vtkIdType arrayNum);
125  void SelectColorArray(const vtkStdString& arrayName);
127 
131  vtkStdString GetColorArrayName();
132 
139  const vtkVector2f& tolerance,
140  vtkVector2f* location) override;
141 
145  bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max) override;
146 
150  bool SelectPointsInPolygon(const vtkContextPolygon &polygon) override;
151 
155  enum {
162  };
163 
165 
169  vtkGetMacro(MarkerStyle, int);
170  vtkSetMacro(MarkerStyle, int);
172 
174 
178  vtkGetMacro(MarkerSize, float);
179  vtkSetMacro(MarkerSize, float);
181 
183 
186  vtkGetMacro(ValidPointMaskName, vtkStdString)
187  vtkSetMacro(ValidPointMaskName, vtkStdString)
189 
190 protected:
191  vtkPlotPoints();
192  ~vtkPlotPoints() override;
193 
197  bool GetDataArrays(vtkTable *table, vtkDataArray *array[2]);
198 
202  bool UpdateTableCache(vtkTable *table);
203 
207  void CalculateUnscaledInputBounds();
208 
213  void CalculateLogSeries();
214 
220  void FindBadPoints();
221 
225  void CalculateBounds(double bounds[4]);
226 
230  void CreateSortedPoints();
231 
233 
236  vtkPoints2D *Points;
237  vtkNew<vtkFloatArray> SelectedPoints;
239 
241 
244  class VectorPIMPL;
245  VectorPIMPL* Sorted;
247 
252  vtkIdTypeArray* BadPoints;
253 
258  vtkCharArray* ValidPointMask;
259 
263  vtkStdString ValidPointMaskName;
264 
268  vtkTimeStamp BuildTime;
269 
271 
274  int MarkerStyle;
275  float MarkerSize;
277 
278  bool LogX, LogY;
279 
281 
284  vtkScalarsToColors *LookupTable;
286  vtkTypeBool ScalarVisibility;
287  vtkStdString ColorArrayName;
289 
293  double UnscaledInputBounds[4];
294 
295 private:
296  vtkPlotPoints(const vtkPlotPoints &) = delete;
297  void operator=(const vtkPlotPoints &) = delete;
298 
299 };
300 
301 #endif //vtkPlotPoints_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
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.
Class for drawing an points given two columns from a vtkTable.
Definition: vtkPlotPoints.h:53
record modification and/or execution time
Definition: vtkTimeStamp.h:35
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:336
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:347
int vtkTypeBool
Definition: vtkABI.h:69
Superclass for mapping scalar values to colors.
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:38
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
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
represent and manipulate 2D points
Definition: vtkPoints2D.h:36
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
Abstract class for 2D plots.
Definition: vtkPlot.h:52
dynamic, self-adjusting array of unsigned char
virtual vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location)
Function to query a plot for the nearest point to the specified coordinate.
virtual bool SelectPointsInPolygon(const vtkContextPolygon &polygon)
Select all points in the specified polygon.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:68
virtual void GetUnscaledInputBounds(double bounds[4])
Provide un-log-scaled bounds for the plot inputs.
Definition: vtkPlot.h:363
Allocate and hold a VTK object.
Definition: vtkNew.h:58
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
#define max(a, b)