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 "vtkContextItem.h"
36 #include "vtkStdString.h" // Needed to hold TooltipLabelFormat ivar
37 #include "vtkSmartPointer.h" // Needed to hold SP ivars
38 
39 class vtkVariant;
40 class vtkTable;
41 class vtkIdTypeArray;
42 class vtkContextMapper2D;
43 class vtkPen;
44 class vtkBrush;
45 class vtkAxis;
46 class vtkVector2f;
47 class vtkRectf;
48 class vtkStringArray;
49 
51 {
52 public:
53  vtkTypeMacro(vtkPlot, vtkContextItem);
54  virtual void PrintSelf(ostream &os, vtkIndent indent);
55 
57 
62  virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
63  int legendIndex);
65 
67 
75  virtual void SetTooltipLabelFormat(const vtkStdString &label);
76  virtual vtkStdString GetTooltipLabelFormat();
78 
79 //BTX
81 
83  virtual vtkStdString GetTooltipLabel(const vtkVector2f &plotPos,
84  vtkIdType seriesIndex,
85  vtkIdType segmentIndex);
87 
89 
92  virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
93  const vtkVector2f& tolerance,
94  vtkVector2f* location);
96 
98 
99  virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max);
100 //ETX
102 
104 
105  virtual void SetColor(unsigned char r, unsigned char g, unsigned char b,
106  unsigned char a);
107  virtual void SetColor(double r, double g, double b);
108  virtual void GetColor(double rgb[3]);
109  void GetColor(unsigned char rgb[3]);
111 
113  virtual void SetWidth(float width);
114 
116  virtual float GetWidth();
117 
119 
121  vtkGetObjectMacro(Pen, vtkPen);
123 
125 
127  vtkGetObjectMacro(Brush, vtkBrush);
129 
131  virtual void SetLabel(const vtkStdString &label);
132 
134  virtual vtkStdString GetLabel();
135 
138  virtual void SetLabels(vtkStringArray *labels);
139 
143  virtual vtkStringArray *GetLabels();
144 
146  virtual int GetNumberOfLabels();
147 
149  vtkStdString GetLabel(vtkIdType index);
150 
155  void SetIndexedLabels(vtkStringArray *labels);
156 
158  virtual vtkStringArray *GetIndexedLabels();
159 
161 
162  vtkGetObjectMacro(Data, vtkContextMapper2D);
164 
166 
169  vtkGetMacro(UseIndexForXSeries, bool);
171 
173 
176  vtkSetMacro(UseIndexForXSeries, bool);
178 
180 
182  virtual void SetInput(vtkTable *table);
183  virtual void SetInput(vtkTable *table, const vtkStdString &xColumn,
184  const vtkStdString &yColumn);
185  void SetInput(vtkTable *table, vtkIdType xColumn, vtkIdType yColumn);
187 
189  virtual vtkTable* GetInput();
190 
194  virtual void SetInputArray(int index, const vtkStdString &name);
195 
196  virtual void SetSelection(vtkIdTypeArray *id);
197  vtkGetObjectMacro(Selection, vtkIdTypeArray);
198 
200 
201  vtkGetObjectMacro(XAxis, vtkAxis);
202  virtual void SetXAxis(vtkAxis* axis);
204 
206 
207  vtkGetObjectMacro(YAxis, vtkAxis);
208  virtual void SetYAxis(vtkAxis* axis);
210 
212 
213  virtual void GetBounds(double bounds[4])
214  { bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0; }
216 
217 //BTX
219 
221  virtual void SetProperty(const vtkStdString &property, const vtkVariant &var);
222  virtual vtkVariant GetProperty(const vtkStdString &property);
223 //ETX
225 
226 //BTX
227 protected:
228  vtkPlot();
229  ~vtkPlot();
230 
232  vtkStdString GetNumber(double position, vtkAxis *axis);
233 
236 
239 
242 
245 
248 
253 
257 
260 
263 
266 
270 
274 
275 private:
276  vtkPlot(const vtkPlot &); // Not implemented.
277  void operator=(const vtkPlot &); // Not implemented.
278 
279 //ETX
280 };
281 
282 #endif //__vtkPlot_h
vtkAxis * XAxis
Definition: vtkPlot.h:262
#define VTK_CHARTS_EXPORT
Wrapper around vtkstd::string to keep symbols short.
Definition: vtkStdString.h:45
base class for items that are part of a vtkContextScene.
vtkPen * Pen
Definition: vtkPlot.h:235
vtkSmartPointer< vtkStringArray > IndexedLabels
Definition: vtkPlot.h:247
vtkContextMapper2D * Data
Definition: vtkPlot.h:256
virtual void GetBounds(double bounds[4])
Definition: vtkPlot.h:213
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:255
Abstract class for 2D context mappers.
vtkBrush * Brush
Definition: vtkPlot.h:238
A atomic type representing the union of many types.
Definition: vtkVariant.h:72
vtkStdString TooltipDefaultLabelFormat
Definition: vtkPlot.h:273
vtkIdTypeArray * Selection
Definition: vtkPlot.h:259
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:54
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:35
takes care of drawing 2D axes
Definition: vtkAxis.h:44
a simple class to control print indentation
Definition: vtkIndent.h:37
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:37
Abstract class for 2D plots.
Definition: vtkPlot.h:50
vtkSmartPointer< vtkStringArray > Labels
Definition: vtkPlot.h:241
vtkSmartPointer< vtkStringArray > AutoLabels
Definition: vtkPlot.h:244
vtkAxis * YAxis
Definition: vtkPlot.h:265
virtual void PrintSelf(ostream &os, vtkIndent indent)
vtkStdString TooltipLabelFormat
Definition: vtkPlot.h:269
bool UseIndexForXSeries
Definition: vtkPlot.h:252