VTK
vtkPlot.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPlot.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 
32 #ifndef __vtkPlot_h
33 #define __vtkPlot_h
34 
35 #include "vtkChartsCoreModule.h" // For export macro
36 #include "vtkContextItem.h"
37 #include "vtkStdString.h" // Needed to hold TooltipLabelFormat ivar
38 #include "vtkSmartPointer.h" // Needed to hold SP ivars
39 #include "vtkContextPolygon.h" // For vtkContextPolygon
40 #include "vtkRect.h" // For vtkRectd ivar
41 
42 class vtkVariant;
43 class vtkTable;
44 class vtkIdTypeArray;
45 class vtkContextMapper2D;
46 class vtkPen;
47 class vtkBrush;
48 class vtkAxis;
49 class vtkStringArray;
50 
52 {
53 public:
55  virtual void PrintSelf(ostream &os, vtkIndent indent);
56 
58 
63  virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
64  int legendIndex);
66 
68 
76  virtual void SetTooltipLabelFormat(const vtkStdString &label);
77  virtual vtkStdString GetTooltipLabelFormat();
79 
81 
82  virtual void SetTooltipNotation(int notation);
83  virtual int GetTooltipNotation();
85 
87 
88  virtual void SetTooltipPrecision(int precision);
89  virtual int GetTooltipPrecision();
91 
92 //BTX
94 
96  virtual vtkStdString GetTooltipLabel(const vtkVector2d &plotPos,
97  vtkIdType seriesIndex,
98  vtkIdType segmentIndex);
100 
102 
105  virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
106  const vtkVector2f& tolerance,
109 
111  virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max);
112 
114 
115  virtual bool SelectPointsInPolygon(const vtkContextPolygon &polygon);
116 //ETX
118 
120 
121  virtual void SetColor(unsigned char r, unsigned char g, unsigned char b,
122  unsigned char a);
123  virtual void SetColor(double r, double g, double b);
124  virtual void GetColor(double rgb[3]);
125  void GetColor(unsigned char rgb[3]);
127 
129  virtual void SetWidth(float width);
130 
132  virtual float GetWidth();
133 
135 
137  void SetPen(vtkPen *pen);
138  vtkPen* GetPen();
140 
142 
143  void SetBrush(vtkBrush *brush);
144  vtkBrush* GetBrush();
146 
148  virtual void SetLabel(const vtkStdString &label);
149 
151  virtual vtkStdString GetLabel();
152 
155  virtual void SetLabels(vtkStringArray *labels);
156 
160  virtual vtkStringArray *GetLabels();
161 
163  virtual int GetNumberOfLabels();
164 
166  vtkStdString GetLabel(vtkIdType index);
167 
172  void SetIndexedLabels(vtkStringArray *labels);
173 
175  virtual vtkStringArray *GetIndexedLabels();
176 
178  vtkContextMapper2D* GetData();
179 
181 
184  vtkGetMacro(UseIndexForXSeries, bool);
186 
188 
191  vtkSetMacro(UseIndexForXSeries, bool);
193 
195 
197  virtual void SetInputData(vtkTable *table);
198  virtual void SetInputData(vtkTable *table, const vtkStdString &xColumn,
199  const vtkStdString &yColumn);
200  void SetInputData(vtkTable *table, vtkIdType xColumn, vtkIdType yColumn);
202 
204  virtual vtkTable* GetInput();
205 
209  virtual void SetInputArray(int index, const vtkStdString &name);
210 
211  virtual void SetSelection(vtkIdTypeArray *id);
212  vtkGetObjectMacro(Selection, vtkIdTypeArray);
213 
215 
216  vtkGetObjectMacro(XAxis, vtkAxis);
217  virtual void SetXAxis(vtkAxis* axis);
219 
221 
222  vtkGetObjectMacro(YAxis, vtkAxis);
223  virtual void SetYAxis(vtkAxis* axis);
225 
227 
232  void SetShiftScale(const vtkRectd &scaling);
233  vtkRectd GetShiftScale();
235 
237 
239  virtual void GetBounds(double bounds[4])
240  { bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0; }
242 
244 
258  virtual void GetUnscaledInputBounds(double bounds[4])
259  {
260  // Implemented here by calling GetBounds() to support plot
261  // subclasses that do no log-scaling or plot orientation.
262  return this->GetBounds(bounds);
263  }
265 
266 //BTX
268 
270  virtual void SetProperty(const vtkStdString &property, const vtkVariant &var);
271  virtual vtkVariant GetProperty(const vtkStdString &property);
272 //ETX
274 
275 //BTX
276 protected:
277  vtkPlot();
278  ~vtkPlot();
279 
281  vtkStdString GetNumber(double position, vtkAxis *axis);
282 
285 
288 
291 
294 
297 
302 
306 
309 
312 
315 
319 
323 
326 
329 
330 private:
331  vtkPlot(const vtkPlot &); // Not implemented.
332  void operator=(const vtkPlot &); // Not implemented.
333 
334 //ETX
335 };
336 
337 #endif //__vtkPlot_h
vtkAxis * XAxis
Definition: vtkPlot.h:311
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
GLboolean GLboolean GLboolean b
Definition: vtkgl.h:12312
GLuint index
Definition: vtkgl.h:11983
vtkRectd ShiftScale
Definition: vtkPlot.h:328
base class for items that are part of a vtkContextScene.
vtkSmartPointer< vtkStringArray > IndexedLabels
Definition: vtkPlot.h:296
vtkSmartPointer< vtkBrush > Brush
Definition: vtkPlot.h:287
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
int TooltipNotation
Definition: vtkPlot.h:324
virtual void GetBounds(double bounds[4])
Definition: vtkPlot.h:239
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:268
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: vtkgl.h:11332
GLdouble GLdouble GLdouble r
Definition: vtkgl.h:11610
int TooltipPrecision
Definition: vtkPlot.h:325
Abstract class for 2D context mappers.
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
vtkStdString TooltipDefaultLabelFormat
Definition: vtkPlot.h:322
vtkIdTypeArray * Selection
Definition: vtkPlot.h:308
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:56
GLuint const GLchar * name
Definition: vtkgl.h:11983
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:36
takes care of drawing 2D axes
Definition: vtkAxis.h:70
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkSmartPointer< vtkContextMapper2D > Data
Definition: vtkPlot.h:305
GLint GLint GLsizei width
Definition: vtkgl.h:11316
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:38
Abstract class for 2D plots.
Definition: vtkPlot.h:51
vtkSmartPointer< vtkStringArray > Labels
Definition: vtkPlot.h:290
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
GLboolean GLboolean GLboolean GLboolean a
Definition: vtkgl.h:12312
vtkSmartPointer< vtkStringArray > AutoLabels
Definition: vtkPlot.h:293
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:67
virtual void GetUnscaledInputBounds(double bounds[4])
Definition: vtkPlot.h:258
GLboolean GLboolean g
Definition: vtkgl.h:12312
vtkAxis * YAxis
Definition: vtkPlot.h:314
GLint location
Definition: vtkgl.h:12002
virtual void PrintSelf(ostream &os, vtkIndent indent)
vtkStdString TooltipLabelFormat
Definition: vtkPlot.h:318
vtkSmartPointer< vtkPen > Pen
Definition: vtkPlot.h:284
#define max(a, b)
GLenum GLint GLint * precision
Definition: vtkgl.h:14180
#define VTKCHARTSCORE_EXPORT
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69
bool UseIndexForXSeries
Definition: vtkPlot.h:301