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 
239 
241 
244  class VectorPIMPL;
245  VectorPIMPL* Sorted;
247 
253 
259 
264 
269 
271 
275  float MarkerSize;
277 
278  bool LogX, LogY;
279 
281 
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
Definition: vtkRenderingCoreEnums.h:23
vtkPoints2D
represent and manipulate 2D points
Definition: vtkPoints2D.h:36
vtkStdString.h
VTK_MARKER_CIRCLE
Definition: vtkRenderingCoreEnums.h:26
VTK_MARKER_DIAMOND
Definition: vtkRenderingCoreEnums.h:27
vtkPlot.h
vtkPlotPoints::ValidPointMask
vtkCharArray * ValidPointMask
Array which marks valid points in the array.
Definition: vtkPlotPoints.h:258
vtkPlotPoints::MarkerStyle
int MarkerStyle
The marker style that should be used.
Definition: vtkPlotPoints.h:274
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:68
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:41
vtkPlotPoints::Points
vtkPoints2D * Points
Store a well packed set of XY coordinates for this data series.
Definition: vtkPlotPoints.h:236
vtkPlotPoints::BadPoints
vtkIdTypeArray * BadPoints
An array containing the indices of all the "bad points", meaning any x, y pair that has an infinity,...
Definition: vtkPlotPoints.h:252
vtkPlotPoints::ScalarVisibility
vtkTypeBool ScalarVisibility
Definition: vtkPlotPoints.h:286
VTK_MARKER_NONE
Definition: vtkRenderingCoreEnums.h:22
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkPlot
Abstract class for 2D plots.
Definition: vtkPlot.h:52
vtkRenderingCoreEnums.h
vtkPlotPoints::LookupTable
vtkScalarsToColors * LookupTable
Lookup Table for coloring points by scalar value.
Definition: vtkPlotPoints.h:284
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:38
vtkPlotPoints::SelectedPoints
vtkNew< vtkFloatArray > SelectedPoints
Definition: vtkPlotPoints.h:237
vtkX3D::point
Definition: vtkX3D.h:236
vtkPlot::SelectPoints
virtual bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max)
Select all points in the specified rectangle.
vtkPlotPoints::MarkerSize
float MarkerSize
Definition: vtkPlotPoints.h:275
VTK_MARKER_PLUS
Definition: vtkRenderingCoreEnums.h:24
vtkPlot::GetNearestPoint
virtual vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location)
Function to query a plot for the nearest point to the specified coordinate.
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkScalarsToColors.h
vtkNew< vtkFloatArray >
vtkContextPolygon
Definition: vtkContextPolygon.h:26
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:66
vtkPlot::PaintLegend
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...
vtkPlotPoints::LogY
bool LogY
Definition: vtkPlotPoints.h:278
vtkPlotPoints::Sorted
VectorPIMPL * Sorted
Definition: vtkPlotPoints.h:244
vtkPlotPoints
Class for drawing an points given two columns from a vtkTable.
Definition: vtkPlotPoints.h:53
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:41
vtkNew.h
vtkAbstractContextItem::Paint
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
vtkPlotPoints::BuildTime
vtkTimeStamp BuildTime
The point cache is marked dirty until it has been initialized.
Definition: vtkPlotPoints.h:268
vtkPlot::GetUnscaledInputBounds
virtual void GetUnscaledInputBounds(double bounds[4])
Provide un-log-scaled bounds for the plot inputs.
Definition: vtkPlot.h:363
vtkPlotPoints::Colors
vtkUnsignedCharArray * Colors
Definition: vtkPlotPoints.h:285
vtkX3D::location
Definition: vtkX3D.h:406
vtkPlotPoints::ValidPointMaskName
vtkStdString ValidPointMaskName
Name of the valid point mask array.
Definition: vtkPlotPoints.h:263
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
vtkPlot::SelectPointsInPolygon
virtual bool SelectPointsInPolygon(const vtkContextPolygon &polygon)
Select all points in the specified polygon.
vtkPlot::GetBounds
virtual void GetBounds(double bounds[4])
Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
Definition: vtkPlot.h:336
vtkPlot::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRectf
Definition: vtkRect.h:332
vtkVector2f
Definition: vtkVector.h:418
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkAbstractContextItem::Update
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
vtkPlotPoints::ColorArrayName
vtkStdString ColorArrayName
Definition: vtkPlotPoints.h:287