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:
54  vtkTypeMacro(vtkPlot, vtkContextItem);
55  virtual void PrintSelf(ostream &os, vtkIndent indent);
56 
58 
61  vtkSetMacro(LegendVisibility, bool);
62  vtkGetMacro(LegendVisibility, bool);
63  vtkBooleanMacro(LegendVisibility, bool);
65 
67 
72  virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
73  int legendIndex);
75 
77 
85  virtual void SetTooltipLabelFormat(const vtkStdString &label);
86  virtual vtkStdString GetTooltipLabelFormat();
88 
90 
91  virtual void SetTooltipNotation(int notation);
92  virtual int GetTooltipNotation();
94 
96 
97  virtual void SetTooltipPrecision(int precision);
98  virtual int GetTooltipPrecision();
100 
101 //BTX
103 
105  virtual vtkStdString GetTooltipLabel(const vtkVector2d &plotPos,
106  vtkIdType seriesIndex,
107  vtkIdType segmentIndex);
109 
111 
114  virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
115  const vtkVector2f& tolerance,
118 
120  virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max);
121 
123 
124  virtual bool SelectPointsInPolygon(const vtkContextPolygon &polygon);
125 //ETX
127 
129 
130  virtual void SetColor(unsigned char r, unsigned char g, unsigned char b,
131  unsigned char a);
132  virtual void SetColor(double r, double g, double b);
133  virtual void GetColor(double rgb[3]);
134  void GetColor(unsigned char rgb[3]);
136 
138  virtual void SetWidth(float width);
139 
141  virtual float GetWidth();
142 
144 
146  void SetPen(vtkPen *pen);
147  vtkPen* GetPen();
149 
151 
152  void SetBrush(vtkBrush *brush);
153  vtkBrush* GetBrush();
155 
157 
159  void SetSelectionPen(vtkPen *pen);
160  vtkPen* GetSelectionPen();
162 
164 
166  void SetSelectionBrush(vtkBrush *brush);
167  vtkBrush* GetSelectionBrush();
169 
171  virtual void SetLabel(const vtkStdString &label);
172 
174  virtual vtkStdString GetLabel();
175 
178  virtual void SetLabels(vtkStringArray *labels);
179 
183  virtual vtkStringArray *GetLabels();
184 
186  virtual int GetNumberOfLabels();
187 
189  vtkStdString GetLabel(vtkIdType index);
190 
195  void SetIndexedLabels(vtkStringArray *labels);
196 
198  virtual vtkStringArray *GetIndexedLabels();
199 
201  vtkContextMapper2D* GetData();
202 
204 
207  vtkGetMacro(UseIndexForXSeries, bool);
209 
211 
214  vtkSetMacro(UseIndexForXSeries, bool);
216 
218 
220  virtual void SetInputData(vtkTable *table);
221  virtual void SetInputData(vtkTable *table, const vtkStdString &xColumn,
222  const vtkStdString &yColumn);
223  void SetInputData(vtkTable *table, vtkIdType xColumn, vtkIdType yColumn);
225 
227  virtual vtkTable* GetInput();
228 
232  virtual void SetInputArray(int index, const vtkStdString &name);
233 
235 
239  vtkSetMacro(Selectable,bool);
240  vtkGetMacro(Selectable,bool);
241  vtkBooleanMacro(Selectable,bool);
243 
245 
247  virtual void SetSelection(vtkIdTypeArray *id);
248  vtkGetObjectMacro(Selection, vtkIdTypeArray);
250 
252 
253  vtkGetObjectMacro(XAxis, vtkAxis);
254  virtual void SetXAxis(vtkAxis* axis);
256 
258 
259  vtkGetObjectMacro(YAxis, vtkAxis);
260  virtual void SetYAxis(vtkAxis* axis);
262 
264 
269  void SetShiftScale(const vtkRectd &scaling);
270  vtkRectd GetShiftScale();
272 
274 
276  virtual void GetBounds(double bounds[4])
277  { bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0; }
279 
281 
295  virtual void GetUnscaledInputBounds(double bounds[4])
296  {
297  // Implemented here by calling GetBounds() to support plot
298  // subclasses that do no log-scaling or plot orientation.
299  return this->GetBounds(bounds);
300  }
302 
307  virtual void UpdateCache() {}
308 
309 //BTX
311 
313  virtual void SetProperty(const vtkStdString &property, const vtkVariant &var);
314  virtual vtkVariant GetProperty(const vtkStdString &property);
315 //ETX
317 
318 //BTX
319 protected:
320  vtkPlot();
321  ~vtkPlot();
322 
324  vtkStdString GetNumber(double position, vtkAxis *axis);
325 
328 
331 
335 
339 
342 
345 
348 
353 
357 
360 
363 
366 
369 
373 
377 
380 
383 
385 
386 private:
387  vtkPlot(const vtkPlot &); // Not implemented.
388  void operator=(const vtkPlot &); // Not implemented.
389 
390 //ETX
391 };
392 
393 #endif //vtkPlot_h
vtkAxis * XAxis
Definition: vtkPlot.h:365
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
virtual void UpdateCache()
Definition: vtkPlot.h:307
vtkRectd ShiftScale
Definition: vtkPlot.h:382
base class for items that are part of a vtkContextScene.
vtkSmartPointer< vtkStringArray > IndexedLabels
Definition: vtkPlot.h:347
vtkSmartPointer< vtkBrush > Brush
Definition: vtkPlot.h:330
int TooltipNotation
Definition: vtkPlot.h:378
virtual void GetBounds(double bounds[4])
Definition: vtkPlot.h:276
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:275
bool Selectable
Definition: vtkPlot.h:359
int TooltipPrecision
Definition: vtkPlot.h:379
Abstract class for 2D context mappers.
vtkSmartPointer< vtkPen > SelectionPen
Definition: vtkPlot.h:334
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
vtkStdString TooltipDefaultLabelFormat
Definition: vtkPlot.h:376
vtkIdTypeArray * Selection
Definition: vtkPlot.h:362
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:56
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:338
vtkSmartPointer< vtkContextMapper2D > Data
Definition: vtkPlot.h:356
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:341
vtkSmartPointer< vtkStringArray > AutoLabels
Definition: vtkPlot.h:344
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:67
virtual void GetUnscaledInputBounds(double bounds[4])
Definition: vtkPlot.h:295
vtkAxis * YAxis
Definition: vtkPlot.h:368
virtual void PrintSelf(ostream &os, vtkIndent indent)
bool LegendVisibility
Definition: vtkPlot.h:384
vtkStdString TooltipLabelFormat
Definition: vtkPlot.h:372
vtkSmartPointer< vtkPen > Pen
Definition: vtkPlot.h:327
#define max(a, b)
#define VTKCHARTSCORE_EXPORT
bool UseIndexForXSeries
Definition: vtkPlot.h:352