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 
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);
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 
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);
149 
151 
152  void SetBrush(vtkBrush *brush);
155 
157 
162 
164 
169 
171  virtual void SetLabel(const vtkStdString &label);
172 
175 
178  virtual void SetLabels(vtkStringArray *labels);
179 
184 
186  virtual int GetNumberOfLabels();
187 
190 
196 
199 
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);
250 
252 
254  virtual void SetXAxis(vtkAxis* axis);
256 
258 
260  virtual void SetYAxis(vtkAxis* axis);
262 
264 
269  void SetShiftScale(const vtkRectd &scaling);
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:
322 
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
vtkBrush
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:37
vtkPlot::AutoLabels
vtkSmartPointer< vtkStringArray > AutoLabels
Definition: vtkPlot.h:344
vtkPlot::GetTooltipLabel
virtual vtkStdString GetTooltipLabel(const vtkVector2d &plotPos, vtkIdType seriesIndex, vtkIdType segmentIndex)
vtkPlot::GetTooltipPrecision
virtual int GetTooltipPrecision()
vtkPlot::SetSelectionPen
void SetSelectionPen(vtkPen *pen)
vtkChartsCoreModule.h
vtkStdString.h
vtkPlot::TooltipLabelFormat
vtkStdString TooltipLabelFormat
Definition: vtkPlot.h:372
vtkPlot::IndexedLabels
vtkSmartPointer< vtkStringArray > IndexedLabels
Definition: vtkPlot.h:347
vtkContextPolygon.h
vtkPlot::SetInputData
void SetInputData(vtkTable *table, vtkIdType xColumn, vtkIdType yColumn)
vtkPlot::Brush
vtkSmartPointer< vtkBrush > Brush
Definition: vtkPlot.h:330
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkPlot::TooltipNotation
int TooltipNotation
Definition: vtkPlot.h:378
vtkgl::b
GLboolean GLboolean GLboolean b
Definition: vtkgl.h:12312
vtkContextMapper2D
Abstract class for 2D context mappers.
Definition: vtkContextMapper2D.h:37
vtkPlot::GetWidth
virtual float GetWidth()
vtkPlot::SetWidth
virtual void SetWidth(float width)
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:68
vtkPlot::GetIndexedLabels
virtual vtkStringArray * GetIndexedLabels()
vtkPlot::LegendVisibility
bool LegendVisibility
Definition: vtkPlot.h:384
vtkPlot::Data
vtkSmartPointer< vtkContextMapper2D > Data
Definition: vtkPlot.h:356
vtkPlot::SetLabels
virtual void SetLabels(vtkStringArray *labels)
vtkPlot::TooltipPrecision
int TooltipPrecision
Definition: vtkPlot.h:379
vtkPlot::SetIndexedLabels
void SetIndexedLabels(vtkStringArray *labels)
vtkPlot::GetBrush
vtkBrush * GetBrush()
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkPlot::SetInputData
virtual void SetInputData(vtkTable *table)
vtkPlot::GetLabel
vtkStdString GetLabel(vtkIdType index)
vtkSmartPointer< vtkPen >
vtkPlot::GetSelectionBrush
vtkBrush * GetSelectionBrush()
vtkPlot::SetSelection
virtual void SetSelection(vtkIdTypeArray *id)
vtkPlot::GetShiftScale
vtkRectd GetShiftScale()
vtkPlot::SetColor
virtual void SetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
vtkPlot::Selectable
bool Selectable
Definition: vtkPlot.h:359
vtkgl::table
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: vtkgl.h:11332
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:57
vtkContextItem.h
vtkPlot::GetTooltipNotation
virtual int GetTooltipNotation()
vtkPlot
Abstract class for 2D plots.
Definition: vtkPlot.h:52
vtkPlot::Labels
vtkSmartPointer< vtkStringArray > Labels
Definition: vtkPlot.h:341
vtkPlot::GetInput
virtual vtkTable * GetInput()
vtkRectd
Definition: vtkRect.h:106
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:30
vtkgl::precision
GLenum GLint GLint * precision
Definition: vtkgl.h:14180
vtkPlot::SetColor
virtual void SetColor(double r, double g, double b)
vtkVector2d
Definition: vtkVector.h:287
vtkX3D::position
@ position
Definition: vtkX3D.h:261
vtkgl::name
GLuint const GLchar * name
Definition: vtkgl.h:11983
vtkX3D::point
@ point
Definition: vtkX3D.h:236
vtkPlot::SetPen
void SetPen(vtkPen *pen)
vtkPlot::SelectPoints
virtual bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max)
vtkPlot::SetYAxis
virtual void SetYAxis(vtkAxis *axis)
vtkPlot::UpdateCache
virtual void UpdateCache()
Definition: vtkPlot.h:307
vtkPlot::UseIndexForXSeries
bool UseIndexForXSeries
Definition: vtkPlot.h:352
vtkPlot::vtkPlot
vtkPlot()
vtkRect.h
vtkPlot::SetSelectionBrush
void SetSelectionBrush(vtkBrush *brush)
vtkPlot::GetNearestPoint
virtual vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkPlot::SelectionBrush
vtkSmartPointer< vtkBrush > SelectionBrush
Definition: vtkPlot.h:338
vtkPlot::TooltipDefaultLabelFormat
vtkStdString TooltipDefaultLabelFormat
Definition: vtkPlot.h:376
vtkPlot::SetLabel
virtual void SetLabel(const vtkStdString &label)
vtkPlot::SetXAxis
virtual void SetXAxis(vtkAxis *axis)
vtkSmartPointer.h
vtkVariant
A atomic type representing the union of many types.
Definition: vtkVariant.h:79
vtkPlot::GetProperty
virtual vtkVariant GetProperty(const vtkStdString &property)
vtkPlot::Pen
vtkSmartPointer< vtkPen > Pen
Definition: vtkPlot.h:327
vtkContextPolygon
Definition: vtkContextPolygon.h:27
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkPlot::PaintLegend
virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf &rect, int legendIndex)
vtkPlot::SelectionPen
vtkSmartPointer< vtkPen > SelectionPen
Definition: vtkPlot.h:334
vtkgl::a
GLboolean GLboolean GLboolean GLboolean a
Definition: vtkgl.h:12312
vtkPlot::GetSelectionPen
vtkPen * GetSelectionPen()
vtkPlot::Selection
vtkIdTypeArray * Selection
Definition: vtkPlot.h:362
vtkPlot::SetTooltipNotation
virtual void SetTooltipNotation(int notation)
vtkPlot::GetNumberOfLabels
virtual int GetNumberOfLabels()
vtkPlot::XAxis
vtkAxis * XAxis
Definition: vtkPlot.h:365
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkgl::width
GLint GLint GLsizei width
Definition: vtkgl.h:11316
vtkContextItem
base class for items that are part of a vtkContextScene.
Definition: vtkContextItem.h:34
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkPlot::SetBrush
void SetBrush(vtkBrush *brush)
vtkPlot::GetPen
vtkPen * GetPen()
vtkgl::index
GLuint index
Definition: vtkgl.h:11983
vtkgl::r
GLdouble GLdouble GLdouble r
Definition: vtkgl.h:11610
vtkPlot::SetInputArray
virtual void SetInputArray(int index, const vtkStdString &name)
vtkPlot::SetProperty
virtual void SetProperty(const vtkStdString &property, const vtkVariant &var)
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:49
vtkgl::g
GLboolean GLboolean g
Definition: vtkgl.h:12312
vtkPlot::GetLabels
virtual vtkStringArray * GetLabels()
vtkPlot::GetUnscaledInputBounds
virtual void GetUnscaledInputBounds(double bounds[4])
Definition: vtkPlot.h:295
vtkPlot::PrintSelf
virtual void PrintSelf(ostream &os, vtkIndent indent)
vtkgl::location
GLint location
Definition: vtkgl.h:12002
vtkAxis
takes care of drawing 2D axes
Definition: vtkAxis.h:71
vtkPlot::SetShiftScale
void SetShiftScale(const vtkRectd &scaling)
vtkPlot::SetTooltipLabelFormat
virtual void SetTooltipLabelFormat(const vtkStdString &label)
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:45
vtkPlot::ShiftScale
vtkRectd ShiftScale
Definition: vtkPlot.h:382
vtkPlot::GetColor
void GetColor(unsigned char rgb[3])
vtkPlot::~vtkPlot
~vtkPlot()
vtkPen
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:39
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:48
vtkPlot::GetLabel
virtual vtkStdString GetLabel()
VTKCHARTSCORE_EXPORT
#define VTKCHARTSCORE_EXPORT
Definition: vtkChartsCoreModule.h:15
vtkPlot::SelectPointsInPolygon
virtual bool SelectPointsInPolygon(const vtkContextPolygon &polygon)
vtkPlot::GetBounds
virtual void GetBounds(double bounds[4])
Definition: vtkPlot.h:276
vtkPlot::GetData
vtkContextMapper2D * GetData()
vtkPlot::GetColor
virtual void GetColor(double rgb[3])
vtkRectf
Definition: vtkRect.h:97
vtkPlot::SetTooltipPrecision
virtual void SetTooltipPrecision(int precision)
vtkVector2f
Definition: vtkVector.h:277
vtkPlot::SetInputData
virtual void SetInputData(vtkTable *table, const vtkStdString &xColumn, const vtkStdString &yColumn)
vtkPlot::YAxis
vtkAxis * YAxis
Definition: vtkPlot.h:368
vtkPlot::GetTooltipLabelFormat
virtual vtkStdString GetTooltipLabelFormat()
vtkPlot::GetNumber
vtkStdString GetNumber(double position, vtkAxis *axis)