VTK
vtkChart.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkChart.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 
29 #ifndef vtkChart_h
30 #define vtkChart_h
31 
32 #include "vtkChartsCoreModule.h" // For export macro
33 #include "vtkContextItem.h"
34 #include "vtkRect.h" // For vtkRectf
35 #include "vtkStdString.h" // For vtkStdString ivars
36 #include "vtkSmartPointer.h" // For SP ivars
37 
38 class vtkTransform2D;
39 class vtkContextScene;
40 class vtkPlot;
41 class vtkAxis;
42 class vtkBrush;
43 class vtkTextProperty;
44 class vtkChartLegend;
45 
46 class vtkInteractorStyle;
47 class vtkAnnotationLink;
48 
50 {
51 public:
53  virtual void PrintSelf(ostream &os, vtkIndent indent);
54 
55 //BTX
57 
58  enum {
61  BAR,
63  BAG,
65  AREA};
67 
69 
75  enum {
76  PAN = 0,
80  SELECT_RECTANGLE = SELECT,
82  NOTIFY
83  };
85 
87 
88  enum EventIds {
89  UpdateRange = 1002
90  };
91 //ETX
93 
96  virtual bool Paint(vtkContext2D *painter) = 0;
97 
99  virtual vtkPlot* AddPlot(int type);
100 
103  virtual vtkIdType AddPlot(vtkPlot* plot);
104 
107  virtual bool RemovePlot(vtkIdType index);
108 
112  virtual bool RemovePlotInstance(vtkPlot* plot);
113 
115  virtual void ClearPlots();
116 
120 
123 
127  virtual vtkAxis* GetAxis(int axisIndex);
128 
131 
135  virtual void RecalculateBounds();
136 
138 
144  enum {
147  SELECTION_COLUMNS
148  };
150 
152 
158  virtual void SetSelectionMethod(int method);
159  virtual int GetSelectionMethod();
161 
164 
166 
169 
171 
172  vtkSetVector2Macro(Geometry, int);
173  vtkGetVector2Macro(Geometry, int);
175 
177 
178  vtkSetVector2Macro(Point1, int);
179  vtkGetVector2Macro(Point1, int);
181 
183 
184  vtkSetVector2Macro(Point2, int);
185  vtkGetVector2Macro(Point2, int);
187 
189 
190  virtual void SetShowLegend(bool visible);
191  virtual bool GetShowLegend();
193 
197 
199 
200  virtual void SetTitle(const vtkStdString &title);
203 
205 
209 
211 
213  void SetTopBorder(int border);
217 
219  void SetBorders(int left, int bottom, int right, int top);
220 
224  void SetSize(const vtkRectf &rect);
225 
228 
230 
231  enum {
232  FILL_SCENE, // Attempt to fill the entire scene.
233  FILL_RECT, // Attempt to supply the supplied vtkRectf in Size.
234  AXES_TO_RECT // Put the corners of the axes on the vtkRectf in Size.
235  };
237 
239 
242  vtkSetMacro(LayoutStrategy, int);
243  vtkGetMacro(LayoutStrategy, int);
245 
247 
249  virtual void SetAutoSize(bool isAutoSized)
250  {
251  this->LayoutStrategy = isAutoSized ? vtkChart::FILL_SCENE :
253  }
254  virtual bool GetAutoSize()
255  {
256  return this->LayoutStrategy == vtkChart::FILL_SCENE ? true : false;
257  }
259 
261 
266  vtkSetMacro(RenderEmpty, bool);
267  vtkGetMacro(RenderEmpty, bool);
269 
277  virtual void SetActionToButton(int action, int button);
278 
282  virtual int GetActionToButton(int action);
283 
287  virtual void SetClickActionToButton(int action, int button);
288 
292  virtual int GetClickActionToButton(int action);
293 
295 
299 
301 
305  virtual void SetSelectionMode(int);
306  vtkGetMacro(SelectionMode, int);
308 
309 protected:
312 
314 
321 
323 
328 
332 
333  void AxisRangeForwarderCallback(vtkObject*,unsigned long, void*);
334 
337 
339  int Geometry[2];
340 
342  int Point1[2];
343 
345  int Point2[2];
346 
349 
352 
355 
357  // The layout strategy to employ when fitting the chart into the space.
360 
363 
364  // The mode when the chart is doing selection.
366 
367  // How plot selections are handled, SELECTION_ROWS (default) or
368  // SELECTION_PLOTS - based on the plot that created the selection.
370 
372 
374  {
375  public:
377  enum { MaxAction = 5 };
378  short& Pan() { return Data[0]; }
379  short& Zoom() { return Data[1]; }
380  short& ZoomAxis() { return Data[2]; }
381  short& Select() { return Data[3]; }
382  short& SelectPolygon() { return Data[4]; }
383  short& operator[](int index) { return Data[index]; }
384  short Data[MaxAction];
385  };
387  {
388  public:
390  short& Notify() { return Data[0]; }
391  short& Select() { return Data[1]; }
392  short& operator[](int index) { return Data[index]; }
393  short Data[2];
394  };
396 
399 
400 private:
401  vtkChart(const vtkChart &); // Not implemented.
402  void operator=(const vtkChart &); // Not implemented.
403 };
404 
405 #endif //vtkChart_h
vtkChart
Factory class for drawing 2D charts.
Definition: vtkChart.h:50
vtkBrush
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:37
vtkChart::Actions
MouseActions Actions
Definition: vtkChart.h:397
vtkChart::MouseClickActions::operator[]
short & operator[](int index)
Definition: vtkChart.h:392
vtkChart::GetNumberOfPlots
virtual vtkIdType GetNumberOfPlots()
vtkChartsCoreModule.h
vtkStdString.h
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkChart::MouseActions
Definition: vtkChart.h:374
vtkChart::MouseActions::MouseActions
MouseActions()
vtkChart::RemovePlot
virtual bool RemovePlot(vtkIdType index)
vtkChart::MouseClickActions
Definition: vtkChart.h:387
vtkChart::MouseClickActions::Select
short & Select()
Definition: vtkChart.h:391
vtkSetVector2Macro
#define vtkSetVector2Macro(name, type)
Definition: vtkSetGet.h:254
vtkChart::SetLeftBorder
void SetLeftBorder(int border)
vtkChart::SetSelectionMethod
virtual void SetSelectionMethod(int method)
vtkChart::GetShowLegend
virtual bool GetShowLegend()
vtkChart::SetBorders
void SetBorders(int left, int bottom, int right, int top)
vtkGetVector2Macro
#define vtkGetVector2Macro(name, type)
Definition: vtkSetGet.h:270
vtkChart::GetBackgroundBrush
vtkBrush * GetBackgroundBrush()
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkChart::ZOOM_AXIS
@ ZOOM_AXIS
Definition: vtkChart.h:78
vtkTransform2D
describes linear transformations via a 3x3 matrix
Definition: vtkTransform2D.h:47
vtkChart::SetSelectionMode
virtual void SetSelectionMode(int)
vtkChart::ActionsClick
MouseClickActions ActionsClick
Definition: vtkChart.h:398
vtkChartLegend
draw the chart legend
Definition: vtkChartLegend.h:42
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkChart::RenderEmpty
bool RenderEmpty
Definition: vtkChart.h:359
vtkChart::AddPlot
virtual vtkIdType AddPlot(vtkPlot *plot)
vtkChart::~vtkChart
~vtkChart()
vtkSmartPointer< vtkBrush >
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkChart::SELECTION_PLOTS
@ SELECTION_PLOTS
Definition: vtkChart.h:146
vtkChart::CalculatePlotTransform
bool CalculatePlotTransform(vtkAxis *x, vtkAxis *y, vtkTransform2D *transform)
vtkChart::SELECT
@ SELECT
Definition: vtkChart.h:79
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkChart::POINTS
@ POINTS
Definition: vtkChart.h:60
vtkChart::BackgroundBrush
vtkSmartPointer< vtkBrush > BackgroundBrush
Definition: vtkChart.h:362
vtkChart::Paint
virtual bool Paint(vtkContext2D *painter)=0
vtkChart::SetAnnotationLink
virtual void SetAnnotationLink(vtkAnnotationLink *link)
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:57
vtkChart::AddPlot
virtual vtkPlot * AddPlot(int type)
vtkgl::left
GLint left
Definition: vtkgl.h:14367
vtkContextItem.h
vtkChart::BAG
@ BAG
Definition: vtkChart.h:63
vtkPlot
Abstract class for 2D plots.
Definition: vtkPlot.h:52
vtkgl::border
GLint GLint GLsizei GLsizei GLsizei GLint border
Definition: vtkgl.h:11316
vtkChart::GetClickActionToButton
virtual int GetClickActionToButton(int action)
vtkgl::bottom
GLint GLint bottom
Definition: vtkgl.h:14367
vtkChart::AnnotationLink
vtkAnnotationLink * AnnotationLink
Definition: vtkChart.h:336
vtkChart::GetTitle
virtual vtkStdString GetTitle()
vtkChart::SetBackgroundBrush
void SetBackgroundBrush(vtkBrush *brush)
vtkChart::FILL_SCENE
@ FILL_SCENE
Definition: vtkChart.h:232
vtkChart::CalculateUnscaledPlotTransform
bool CalculateUnscaledPlotTransform(vtkAxis *x, vtkAxis *y, vtkTransform2D *transform)
vtkChart::ShowLegend
bool ShowLegend
Definition: vtkChart.h:348
vtkChart::SELECTION_ROWS
@ SELECTION_ROWS
Definition: vtkChart.h:145
vtkChart::GetActionToButton
virtual int GetActionToButton(int action)
vtkX3D::title
@ title
Definition: vtkX3D.h:500
vtkgl::right
GLdouble GLdouble right
Definition: vtkgl.h:18180
vtkContextScene
Provides a 2D scene for vtkContextItem objects.
Definition: vtkContextScene.h:50
vtkChart::MouseClickActions::Notify
short & Notify()
Definition: vtkChart.h:390
vtkChart::SetSize
void SetSize(const vtkRectf &rect)
vtkChart::PrintSelf
virtual void PrintSelf(ostream &os, vtkIndent indent)
vtkChart::GetSize
vtkRectf GetSize()
vtkChart::SetClickActionToButton
virtual void SetClickActionToButton(int action, int button)
vtkChart::GetLegend
virtual vtkChartLegend * GetLegend()
vtkChart::MouseActions::operator[]
short & operator[](int index)
Definition: vtkChart.h:383
vtkChart::AttachAxisRangeListener
void AttachAxisRangeListener(vtkAxis *)
vtkRect.h
vtkChart::STACKED
@ STACKED
Definition: vtkChart.h:62
vtkChart::MouseClickActions::MouseClickActions
MouseClickActions()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkChart::RemovePlotInstance
virtual bool RemovePlotInstance(vtkPlot *plot)
vtkChart::FILL_RECT
@ FILL_RECT
Definition: vtkChart.h:233
vtkChart::GetPlot
virtual vtkPlot * GetPlot(vtkIdType index)
vtkSmartPointer.h
vtkChart::SetActionToButton
virtual void SetActionToButton(int action, int button)
vtkgl::top
GLdouble GLdouble GLdouble GLdouble top
Definition: vtkgl.h:18180
vtkChart::vtkChart
vtkChart()
vtkChart::SelectionMode
int SelectionMode
Definition: vtkChart.h:365
vtkChart::GetAutoSize
virtual bool GetAutoSize()
Definition: vtkChart.h:254
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkChart::Size
vtkRectf Size
Definition: vtkChart.h:356
vtkInteractorStyle
provide event-driven interface to the rendering window (defines trackball mode)
Definition: vtkInteractorStyle.h:136
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkContextItem
base class for items that are part of a vtkContextScene.
Definition: vtkContextItem.h:34
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkgl::index
GLuint index
Definition: vtkgl.h:11983
vtkChart::LINE
@ LINE
Definition: vtkChart.h:59
vtkChart::FUNCTIONALBAG
@ FUNCTIONALBAG
Definition: vtkChart.h:64
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkChart::EventIds
EventIds
Definition: vtkChart.h:88
vtkChart::MouseActions::Select
short & Select()
Definition: vtkChart.h:381
vtkChart::Title
vtkStdString Title
Definition: vtkChart.h:351
vtkChart::LayoutStrategy
int LayoutStrategy
Definition: vtkChart.h:358
vtkChart::SetAutoSize
virtual void SetAutoSize(bool isAutoSized)
Definition: vtkChart.h:249
vtkChart::BAR
@ BAR
Definition: vtkChart.h:61
vtkAxis
takes care of drawing 2D axes
Definition: vtkAxis.h:71
vtkChart::MouseActions::ZoomAxis
short & ZoomAxis()
Definition: vtkChart.h:380
vtkChart::GetSelectionMethod
virtual int GetSelectionMethod()
vtkChart::ClearPlots
virtual void ClearPlots()
vtkChart::ZOOM
@ ZOOM
Definition: vtkChart.h:77
vtkChart::RecalculateBounds
virtual void RecalculateBounds()
vtkChart::MouseActions::Pan
short & Pan()
Definition: vtkChart.h:378
vtkChart::MouseActions::SelectPolygon
short & SelectPolygon()
Definition: vtkChart.h:382
vtkChart::SetBottomBorder
void SetBottomBorder(int border)
vtkChart::TitleProperties
vtkTextProperty * TitleProperties
Definition: vtkChart.h:354
vtkChart::GetNumberOfAxes
virtual vtkIdType GetNumberOfAxes()
vtkChart::MouseActions::Zoom
short & Zoom()
Definition: vtkChart.h:379
vtkChart::SelectionMethod
int SelectionMethod
Definition: vtkChart.h:369
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:48
VTKCHARTSCORE_EXPORT
#define VTKCHARTSCORE_EXPORT
Definition: vtkChartsCoreModule.h:15
vtkgl::transform
GLuint GLenum GLenum transform
Definition: vtkgl.h:16451
vtkgl::type
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
vtkChart::GetAxis
virtual vtkAxis * GetAxis(int axisIndex)
vtkChart::SetTitle
virtual void SetTitle(const vtkStdString &title)
vtkChart::AxisRangeForwarderCallback
void AxisRangeForwarderCallback(vtkObject *, unsigned long, void *)
vtkChart::SELECT_POLYGON
@ SELECT_POLYGON
Definition: vtkChart.h:81
vtkRectf
Definition: vtkRect.h:97
vtkChart::SetTopBorder
void SetTopBorder(int border)
vtkChart::SetShowLegend
virtual void SetShowLegend(bool visible)
vtkChart::SetRightBorder
void SetRightBorder(int border)