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 
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
vtkPoints2D
represent and manipulate 2D points
Definition: vtkPoints2D.h:33
vtkStdString.h
VTK_MARKER_DIAMOND
Definition: vtkRenderingCoreEnums.h:27
VTK_MARKER_CIRCLE
Definition: vtkRenderingCoreEnums.h:26
vtkPlot.h
vtkPlotPoints::ValidPointMask
vtkCharArray * ValidPointMask
Array which marks valid points in the array.
Definition: vtkPlotPoints.h:263
vtkPlotPoints::MarkerStyle
int MarkerStyle
The marker style that should be used.
Definition: vtkPlotPoints.h:279
vtkIdType
int vtkIdType
Definition: vtkType.h:343
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:62
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:32
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:35
vtkPlotPoints::Points
vtkPoints2D * Points
Store a well packed set of XY coordinates for this data series.
Definition: vtkPlotPoints.h:241
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:257
vtkPlotPoints::ScalarVisibility
vtkTypeBool ScalarVisibility
Definition: vtkPlotPoints.h:291
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkPlot
Abstract class for 2D plots.
Definition: vtkPlot.h:46
vtkRenderingCoreEnums.h
vtkPlotPoints::LookupTable
vtkScalarsToColors * LookupTable
Lookup Table for coloring points by scalar value.
Definition: vtkPlotPoints.h:289
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkCharArray
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:35
vtkPlotPoints::SelectedPoints
vtkNew< vtkFloatArray > SelectedPoints
Definition: vtkPlotPoints.h:242
vtkPlot::GetNearestPoint
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.
vtkX3D::point
Definition: vtkX3D.h:242
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:280
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkScalarsToColors.h
vtkNew< vtkFloatArray >
vtkContextPolygon
Definition: vtkContextPolygon.h:26
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:59
VTK_MARKER_SQUARE
Definition: vtkRenderingCoreEnums.h:25
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...
VTK_MARKER_NONE
Definition: vtkRenderingCoreEnums.h:22
vtkPlotPoints::LogY
bool LogY
Definition: vtkPlotPoints.h:283
VTK_MARKER_PLUS
Definition: vtkRenderingCoreEnums.h:24
vtkPlotPoints::Sorted
VectorPIMPL * Sorted
Definition: vtkPlotPoints.h:249
vtkPlotPoints
Class for drawing an points given two columns from a vtkTable.
Definition: vtkPlotPoints.h:50
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:35
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:273
vtkPlot::GetUnscaledInputBounds
virtual void GetUnscaledInputBounds(double bounds[4])
Provide un-log-scaled bounds for the plot inputs.
Definition: vtkPlot.h:369
VTK_MARKER_CROSS
Definition: vtkRenderingCoreEnums.h:23
vtkPlotPoints::Colors
vtkUnsignedCharArray * Colors
Definition: vtkPlotPoints.h:290
vtkX3D::location
Definition: vtkX3D.h:412
vtkPlotPoints::ValidPointMaskName
vtkStdString ValidPointMaskName
Name of the valid point mask array.
Definition: vtkPlotPoints.h:268
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
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:343
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:326
vtkVector2f
Definition: vtkVector.h:432
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:292