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 
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 
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 {
161  DIAMOND = VTK_MARKER_DIAMOND
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:
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
VTK_MARKER_CROSS
@ VTK_MARKER_CROSS
Definition: vtkRenderingCoreEnums.h:23
vtkPoints2D
represent and manipulate 2D points
Definition: vtkPoints2D.h:37
vtkStdString.h
VTK_MARKER_CIRCLE
@ VTK_MARKER_CIRCLE
Definition: vtkRenderingCoreEnums.h:26
VTK_MARKER_DIAMOND
@ VTK_MARKER_DIAMOND
Definition: vtkRenderingCoreEnums.h:27
vtkPlot.h
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
vtkPlotPoints::New
static vtkPlotPoints * New()
Creates a 2D Chart object.
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:69
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkPlotPoints::PaintLegend
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 ...
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:42
VTK_MARKER_NONE
@ VTK_MARKER_NONE
Definition: vtkRenderingCoreEnums.h:22
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:59
vtkPlotPoints::GetUnscaledInputBounds
void GetUnscaledInputBounds(double bounds[4]) override
Get the non-log-scaled bounds on chart inputs for this plot as (Xmin, Xmax, Ymin, Ymax).
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkPlot
Abstract class for 2D plots.
Definition: vtkPlot.h:53
vtkPlotPoints::SelectColorArray
void SelectColorArray(vtkIdType arrayNum)
When ScalarMode is set to UsePointFieldData or UseCellFieldData, you can specify which array to use f...
vtkRenderingCoreEnums.h
VTK_MARKER_SQUARE
@ VTK_MARKER_SQUARE
Definition: vtkRenderingCoreEnums.h:25
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkCharArray
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:39
vtkX3D::point
@ point
Definition: vtkX3D.h:236
vtkPlotPoints::SelectPoints
bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max) override
Select all points in the specified rectangle.
vtkPlotPoints::SelectPointsInPolygon
bool SelectPointsInPolygon(const vtkContextPolygon &polygon) override
Select all points in the specified polygon.
vtkPlotPoints::GetBounds
void GetBounds(double bounds[4]) override
Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
vtkPlotPoints::SetLookupTable
void SetLookupTable(vtkScalarsToColors *lut)
Specify a lookup table for the mapper to use.
vtkPlotPoints::Paint
bool Paint(vtkContext2D *painter) override
Paint event for the XY plot, called whenever the chart needs to be drawn.
VTK_MARKER_PLUS
@ VTK_MARKER_PLUS
Definition: vtkRenderingCoreEnums.h:24
vtkPlotPoints::GetLookupTable
vtkScalarsToColors * GetLookupTable()
vtkPlotPoints::GetColorArrayName
vtkStdString GetColorArrayName()
Get the array name to color by.
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkScalarsToColors.h
vtkPlotPoints::SelectColorArray
void SelectColorArray(const vtkStdString &arrayName)
vtkNew
Allocate and hold a VTK object.
Definition: vtkNew.h:59
vtkContextPolygon
Definition: vtkContextPolygon.h:27
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:67
vtkPlotPoints::GetNearestPoint
vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location) override
Function to query a plot for the nearest point to the specified coordinate.
vtkPlotPoints
Class for drawing an points given two columns from a vtkTable.
Definition: vtkPlotPoints.h:54
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:42
vtkNew.h
vtkX3D::location
@ location
Definition: vtkX3D.h:406
vtkPlotPoints::CreateDefaultLookupTable
virtual void CreateDefaultLookupTable()
Create default lookup table.
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:41
vtkPlotPoints::Update
void Update() override
Perform any updates to the item that may be necessary before rendering.
vtkRectf
Definition: vtkRect.h:333
vtkVector2f
Definition: vtkVector.h:419
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPlotPoints::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.