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 
150  void SetSelectionPen(vtkPen *pen);
151  vtkPen* GetSelectionPen();
153 
155 
157  void SetSelectionBrush(vtkBrush *brush);
158  vtkBrush* GetSelectionBrush();
160 
162  virtual void SetLabel(const vtkStdString &label);
163 
165  virtual vtkStdString GetLabel();
166 
169  virtual void SetLabels(vtkStringArray *labels);
170 
174  virtual vtkStringArray *GetLabels();
175 
177  virtual int GetNumberOfLabels();
178 
180  vtkStdString GetLabel(vtkIdType index);
181 
186  void SetIndexedLabels(vtkStringArray *labels);
187 
189  virtual vtkStringArray *GetIndexedLabels();
190 
192  vtkContextMapper2D* GetData();
193 
195 
198  vtkGetMacro(UseIndexForXSeries, bool);
200 
202 
205  vtkSetMacro(UseIndexForXSeries, bool);
207 
209 
211  virtual void SetInputData(vtkTable *table);
212  virtual void SetInputData(vtkTable *table, const vtkStdString &xColumn,
213  const vtkStdString &yColumn);
214  void SetInputData(vtkTable *table, vtkIdType xColumn, vtkIdType yColumn);
216 
218  virtual vtkTable* GetInput();
219 
223  virtual void SetInputArray(int index, const vtkStdString &name);
224 
225  virtual void SetSelection(vtkIdTypeArray *id);
226  vtkGetObjectMacro(Selection, vtkIdTypeArray);
227 
229 
230  vtkGetObjectMacro(XAxis, vtkAxis);
231  virtual void SetXAxis(vtkAxis* axis);
233 
235 
236  vtkGetObjectMacro(YAxis, vtkAxis);
237  virtual void SetYAxis(vtkAxis* axis);
239 
241 
246  void SetShiftScale(const vtkRectd &scaling);
247  vtkRectd GetShiftScale();
249 
251 
253  virtual void GetBounds(double bounds[4])
254  { bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0; }
256 
258 
272  virtual void GetUnscaledInputBounds(double bounds[4])
273  {
274  // Implemented here by calling GetBounds() to support plot
275  // subclasses that do no log-scaling or plot orientation.
276  return this->GetBounds(bounds);
277  }
279 
280 //BTX
282 
284  virtual void SetProperty(const vtkStdString &property, const vtkVariant &var);
285  virtual vtkVariant GetProperty(const vtkStdString &property);
286 //ETX
288 
289 //BTX
290 protected:
291  vtkPlot();
292  ~vtkPlot();
293 
295  vtkStdString GetNumber(double position, vtkAxis *axis);
296 
299 
302 
306 
310 
313 
316 
319 
324 
328 
331 
334 
337 
341 
345 
348 
351 
352 private:
353  vtkPlot(const vtkPlot &); // Not implemented.
354  void operator=(const vtkPlot &); // Not implemented.
355 
356 //ETX
357 };
358 
359 #endif //vtkPlot_h
vtkAxis * XAxis
Definition: vtkPlot.h:333
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:350
base class for items that are part of a vtkContextScene.
vtkSmartPointer< vtkStringArray > IndexedLabels
Definition: vtkPlot.h:318
vtkSmartPointer< vtkBrush > Brush
Definition: vtkPlot.h:301
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
int TooltipNotation
Definition: vtkPlot.h:346
virtual void GetBounds(double bounds[4])
Definition: vtkPlot.h:253
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:281
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: vtkgl.h:11332
GLdouble GLdouble GLdouble r
Definition: vtkgl.h:11610
int TooltipPrecision
Definition: vtkPlot.h:347
Abstract class for 2D context mappers.
vtkSmartPointer< vtkPen > SelectionPen
Definition: vtkPlot.h:305
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:632
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
vtkStdString TooltipDefaultLabelFormat
Definition: vtkPlot.h:344
vtkIdTypeArray * Selection
Definition: vtkPlot.h:330
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< vtkBrush > SelectionBrush
Definition: vtkPlot.h:309
vtkSmartPointer< vtkContextMapper2D > Data
Definition: vtkPlot.h:327
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:312
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
GLboolean GLboolean GLboolean GLboolean a
Definition: vtkgl.h:12312
vtkSmartPointer< vtkStringArray > AutoLabels
Definition: vtkPlot.h:315
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:67
virtual void GetUnscaledInputBounds(double bounds[4])
Definition: vtkPlot.h:272
GLboolean GLboolean g
Definition: vtkgl.h:12312
vtkAxis * YAxis
Definition: vtkPlot.h:336
GLint location
Definition: vtkgl.h:12002
virtual void PrintSelf(ostream &os, vtkIndent indent)
vtkStdString TooltipLabelFormat
Definition: vtkPlot.h:340
vtkSmartPointer< vtkPen > Pen
Definition: vtkPlot.h:298
#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:323