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  virtual void PrintSelf(ostream &os, vtkIndent indent);
58 
62  static vtkPlotPoints *New();
63 
69  virtual void Update();
70 
74  virtual bool Paint(vtkContext2D *painter);
75 
82  virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
83  int legendIndex);
84 
88  virtual void GetBounds(double bounds[4]);
89 
93  virtual void GetUnscaledInputBounds(double bounds[4]);
94 
96 
102 
107  virtual void CreateDefaultLookupTable();
108 
110 
113  vtkSetMacro(ScalarVisibility,int);
114  vtkGetMacro(ScalarVisibility,int);
115  vtkBooleanMacro(ScalarVisibility,int);
117 
119 
124  void SelectColorArray(vtkIdType arrayNum);
125  void SelectColorArray(const vtkStdString& arrayName);
127 
132 
139  const vtkVector2f& tolerance,
141 
145  virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max);
146 
150  virtual bool SelectPointsInPolygon(const vtkContextPolygon &polygon);
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:
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 
269 
271 
274  int MarkerStyle;
275  float MarkerSize;
277 
278  bool LogX, LogY;
279 
281 
284  vtkScalarsToColors *LookupTable;
286  int ScalarVisibility;
287  vtkStdString ColorArrayName;
289 
293  double UnscaledInputBounds[4];
294 
295 private:
296  vtkPlotPoints(const vtkPlotPoints &) VTK_DELETE_FUNCTION;
297  void operator=(const vtkPlotPoints &) VTK_DELETE_FUNCTION;
298 
299 // #define VTK_COLOR_MODE_DEFAULT 0
300 // #define VTK_COLOR_MODE_MAP_SCALARS 1
301 
302 };
303 
304 #endif //vtkPlotPoints_h
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:39
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
dynamic, self-adjusting array of vtkIdType
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
a simple class to control print indentation
Definition: vtkIndent.h:40
Allocate and hold a VTK object.
Definition: vtkNew.h:68
Class for drawing an points given two columns from a vtkTable.
Definition: vtkPlotPoints.h:54
virtual void CreateDefaultLookupTable()
Create default lookup table.
virtual void GetBounds(double bounds[4])
Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
virtual vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location)
Function to query a plot for the nearest point to the specified coordinate.
void SelectColorArray(const vtkStdString &arrayName)
virtual void GetUnscaledInputBounds(double bounds[4])
Get the non-log-scaled bounds on chart inputs for this plot as (Xmin, Xmax, Ymin, Ymax).
virtual bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max)
Select all points in the specified rectangle.
virtual bool Paint(vtkContext2D *painter)
Paint event for the XY plot, called whenever the chart needs to be drawn.
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf &rect, int legendIndex)
Paint legend event for the XY plot, called whenever the legend needs the plot items symbol/mark/line ...
void SetLookupTable(vtkScalarsToColors *lut)
Specify a lookup table for the mapper to use.
void SelectColorArray(vtkIdType arrayNum)
When ScalarMode is set to UsePointFieldData or UseCellFieldData, you can specify which array to use f...
virtual bool SelectPointsInPolygon(const vtkContextPolygon &polygon)
Select all points in the specified polygon.
vtkScalarsToColors * GetLookupTable()
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
static vtkPlotPoints * New()
Creates a 2D Chart object.
vtkStdString GetColorArrayName()
Get the array name to color by.
Abstract class for 2D plots.
Definition: vtkPlot.h:53
represent and manipulate 2D points
Definition: vtkPoints2D.h:37
Superclass for mapping scalar values to colors.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:49
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:69
record modification and/or execution time
Definition: vtkTimeStamp.h:36
dynamic, self-adjusting array of unsigned char
@ point
Definition: vtkX3D.h:236
@ location
Definition: vtkX3D.h:406
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkTimeStamp BuildTime
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
@ VTK_MARKER_DIAMOND
@ VTK_MARKER_SQUARE
@ VTK_MARKER_PLUS
@ VTK_MARKER_CROSS
@ VTK_MARKER_CIRCLE
@ VTK_MARKER_NONE
int vtkIdType
Definition: vtkType.h:287
#define max(a, b)