VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
41 class vtkVariant;
42 class vtkTable;
43 class vtkIdTypeArray;
44 class vtkContextMapper2D;
45 class vtkPen;
46 class vtkBrush;
47 class vtkAxis;
48 class vtkVector2f;
49 class vtkRectf;
50 class vtkStringArray;
51 
52 class VTKCHARTSCORE_EXPORT vtkPlot : public vtkContextItem
53 {
54 public:
55  vtkTypeMacro(vtkPlot, vtkContextItem);
56  virtual void PrintSelf(ostream &os, vtkIndent indent);
57 
59 
64  virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
65  int legendIndex);
67 
69 
77  virtual void SetTooltipLabelFormat(const vtkStdString &label);
78  virtual vtkStdString GetTooltipLabelFormat();
80 
82 
83  virtual void SetTooltipNotation(int notation);
84  virtual int GetTooltipNotation();
86 
88 
89  virtual void SetTooltipPrecision(int precision);
90  virtual int GetTooltipPrecision();
92 
93 //BTX
95 
97  virtual vtkStdString GetTooltipLabel(const vtkVector2f &plotPos,
98  vtkIdType seriesIndex,
99  vtkIdType segmentIndex);
101 
103 
106  virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
107  const vtkVector2f& tolerance,
108  vtkVector2f* location);
110 
112  virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max);
113 
115 
116  virtual bool SelectPointsInPolygon(const vtkContextPolygon &polygon);
117 //ETX
119 
121 
122  virtual void SetColor(unsigned char r, unsigned char g, unsigned char b,
123  unsigned char a);
124  virtual void SetColor(double r, double g, double b);
125  virtual void GetColor(double rgb[3]);
126  void GetColor(unsigned char rgb[3]);
128 
130  virtual void SetWidth(float width);
131 
133  virtual float GetWidth();
134 
136 
138  void SetPen(vtkPen *pen);
139  vtkPen* GetPen();
141 
143 
144  void SetBrush(vtkBrush *brush);
145  vtkBrush* GetBrush();
147 
149  virtual void SetLabel(const vtkStdString &label);
150 
152  virtual vtkStdString GetLabel();
153 
156  virtual void SetLabels(vtkStringArray *labels);
157 
161  virtual vtkStringArray *GetLabels();
162 
164  virtual int GetNumberOfLabels();
165 
167  vtkStdString GetLabel(vtkIdType index);
168 
173  void SetIndexedLabels(vtkStringArray *labels);
174 
176  virtual vtkStringArray *GetIndexedLabels();
177 
179  vtkContextMapper2D* GetData();
180 
182 
185  vtkGetMacro(UseIndexForXSeries, bool);
187 
189 
192  vtkSetMacro(UseIndexForXSeries, bool);
194 
196 
198  virtual void SetInputData(vtkTable *table);
199  virtual void SetInputData(vtkTable *table, const vtkStdString &xColumn,
200  const vtkStdString &yColumn);
201  void SetInputData(vtkTable *table, vtkIdType xColumn, vtkIdType yColumn);
203 
205  virtual vtkTable* GetInput();
206 
210  virtual void SetInputArray(int index, const vtkStdString &name);
211 
212  virtual void SetSelection(vtkIdTypeArray *id);
213  vtkGetObjectMacro(Selection, vtkIdTypeArray);
214 
216 
217  vtkGetObjectMacro(XAxis, vtkAxis);
218  virtual void SetXAxis(vtkAxis* axis);
220 
222 
223  vtkGetObjectMacro(YAxis, vtkAxis);
224  virtual void SetYAxis(vtkAxis* axis);
226 
228 
230  virtual void GetBounds(double bounds[4])
231  { bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0; }
233 
235 
249  virtual void GetUnscaledInputBounds(double bounds[4])
250  {
251  // Implemented here by calling GetBounds() to support plot
252  // subclasses that do no log-scaling or plot orientation.
253  return this->GetBounds(bounds);
254  }
256 
257 //BTX
259 
261  virtual void SetProperty(const vtkStdString &property, const vtkVariant &var);
262  virtual vtkVariant GetProperty(const vtkStdString &property);
263 //ETX
265 
266 //BTX
267 protected:
268  vtkPlot();
269  ~vtkPlot();
270 
272  vtkStdString GetNumber(double position, vtkAxis *axis);
273 
276 
279 
282 
285 
288 
293 
297 
300 
303 
306 
310 
314 
317 
318 private:
319  vtkPlot(const vtkPlot &); // Not implemented.
320  void operator=(const vtkPlot &); // Not implemented.
321 
322 //ETX
323 };
324 
325 #endif //__vtkPlot_h
vtkAxis * XAxis
Definition: vtkPlot.h:302
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
vtkSmartPointer< vtkStringArray > IndexedLabels
Definition: vtkPlot.h:287
vtkSmartPointer< vtkBrush > Brush
Definition: vtkPlot.h:278
int TooltipNotation
Definition: vtkPlot.h:315
virtual void GetBounds(double bounds[4])
Definition: vtkPlot.h:230
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:268
int TooltipPrecision
Definition: vtkPlot.h:316
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
vtkStdString TooltipDefaultLabelFormat
Definition: vtkPlot.h:313
vtkIdTypeArray * Selection
Definition: vtkPlot.h:299
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:296
Abstract class for 2D plots.
Definition: vtkPlot.h:52
vtkSmartPointer< vtkStringArray > Labels
Definition: vtkPlot.h:281
vtkSmartPointer< vtkStringArray > AutoLabels
Definition: vtkPlot.h:284
virtual void GetUnscaledInputBounds(double bounds[4])
Definition: vtkPlot.h:249
vtkAxis * YAxis
Definition: vtkPlot.h:305
vtkStdString TooltipLabelFormat
Definition: vtkPlot.h:309
vtkSmartPointer< vtkPen > Pen
Definition: vtkPlot.h:275
bool UseIndexForXSeries
Definition: vtkPlot.h:292