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,
64  FUNCTIONALBAG};
66 
68 
74  enum {
75  PAN = 0,
79  SELECT_RECTANGLE = SELECT,
81  NOTIFY
82  };
84 
86 
87  enum EventIds {
88  UpdateRange = 1002
89  };
90 //ETX
92 
95  virtual bool Paint(vtkContext2D *painter) = 0;
96 
98  virtual vtkPlot* AddPlot(int type);
99 
102  virtual vtkIdType AddPlot(vtkPlot* plot);
103 
106  virtual bool RemovePlot(vtkIdType index);
107 
111  virtual bool RemovePlotInstance(vtkPlot* plot);
112 
114  virtual void ClearPlots();
115 
118  virtual vtkPlot* GetPlot(vtkIdType index);
119 
121  virtual vtkIdType GetNumberOfPlots();
122 
126  virtual vtkAxis* GetAxis(int axisIndex);
127 
129  virtual vtkIdType GetNumberOfAxes();
130 
134  virtual void RecalculateBounds();
135 
137 
142  enum {
144  SELECTION_PLOTS
145  };
147 
149 
154  virtual void SetSelectionMethod(int method);
155  virtual int GetSelectionMethod();
157 
159  virtual void SetAnnotationLink(vtkAnnotationLink *link);
160 
162 
163  vtkGetObjectMacro(AnnotationLink, vtkAnnotationLink);
165 
167 
168  vtkSetVector2Macro(Geometry, int);
169  vtkGetVector2Macro(Geometry, int);
171 
173 
174  vtkSetVector2Macro(Point1, int);
175  vtkGetVector2Macro(Point1, int);
177 
179 
180  vtkSetVector2Macro(Point2, int);
181  vtkGetVector2Macro(Point2, int);
183 
185 
186  virtual void SetShowLegend(bool visible);
187  virtual bool GetShowLegend();
189 
192  virtual vtkChartLegend * GetLegend();
193 
195 
196  virtual void SetTitle(const vtkStdString &title);
197  virtual vtkStdString GetTitle();
199 
201 
203  vtkGetObjectMacro(TitleProperties, vtkTextProperty);
205 
207 
208  void SetBottomBorder(int border);
209  void SetTopBorder(int border);
210  void SetLeftBorder(int border);
211  void SetRightBorder(int border);
213 
215  void SetBorders(int left, int bottom, int right, int top);
216 
220  void SetSize(const vtkRectf &rect);
221 
223  vtkRectf GetSize();
224 
226 
227  enum {
228  FILL_SCENE, // Attempt to fill the entire scene.
229  FILL_RECT, // Attempt to supply the supplied vtkRectf in Size.
230  AXES_TO_RECT // Put the corners of the axes on the vtkRectf in Size.
231  };
233 
235 
238  vtkSetMacro(LayoutStrategy, int);
239  vtkGetMacro(LayoutStrategy, int);
241 
243 
245  virtual void SetAutoSize(bool isAutoSized)
246  {
247  this->LayoutStrategy = isAutoSized ? vtkChart::FILL_SCENE :
249  }
250  virtual bool GetAutoSize()
251  {
252  return this->LayoutStrategy == vtkChart::FILL_SCENE ? true : false;
253  }
255 
257 
262  vtkSetMacro(RenderEmpty, bool);
263  vtkGetMacro(RenderEmpty, bool);
265 
273  virtual void SetActionToButton(int action, int button);
274 
278  virtual int GetActionToButton(int action);
279 
283  virtual void SetClickActionToButton(int action, int button);
284 
288  virtual int GetClickActionToButton(int action);
289 
291 
292  void SetBackgroundBrush(vtkBrush *brush);
293  vtkBrush* GetBackgroundBrush();
295 
297 
301  virtual void SetSelectionMode(int);
302  vtkGetMacro(SelectionMode, int);
304 
305 protected:
306  vtkChart();
307  ~vtkChart();
308 
310 
314  bool CalculatePlotTransform(vtkAxis *x, vtkAxis *y,
317 
319 
321  bool CalculateUnscaledPlotTransform(vtkAxis *x, vtkAxis *y,
324 
327  void AttachAxisRangeListener(vtkAxis*);
328 
329  void AxisRangeForwarderCallback(vtkObject*,unsigned long, void*);
330 
333 
335  int Geometry[2];
336 
338  int Point1[2];
339 
341  int Point2[2];
342 
345 
348 
351 
353  // The layout strategy to employ when fitting the chart into the space.
356 
359 
360  // The mode when the chart is doing selection.
362 
363  // How plot selections are handled, SELECTION_ROWS (default) or
364  // SELECTION_PLOTS - based on the plot that created the selection.
366 
368 
370  {
371  public:
372  MouseActions();
373  enum { MaxAction = 5 };
374  short& Pan() { return Data[0]; }
375  short& Zoom() { return Data[1]; }
376  short& ZoomAxis() { return Data[2]; }
377  short& Select() { return Data[3]; }
378  short& SelectPolygon() { return Data[4]; }
379  short& operator[](int index) { return Data[index]; }
380  short Data[MaxAction];
381  };
383  {
384  public:
386  short& Notify() { return Data[0]; }
387  short& Select() { return Data[1]; }
388  short& operator[](int index) { return Data[index]; }
389  short Data[2];
390  };
392 
395 
396 private:
397  vtkChart(const vtkChart &); // Not implemented.
398  void operator=(const vtkChart &); // Not implemented.
399 };
400 
401 #endif //__vtkChart_h
int SelectionMethod
Definition: vtkChart.h:365
MouseClickActions ActionsClick
Definition: vtkChart.h:394
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
GLuint GLenum GLenum transform
Definition: vtkgl.h:16451
vtkStdString Title
Definition: vtkChart.h:347
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
vtkTextProperty * TitleProperties
Definition: vtkChart.h:350
short & SelectPolygon()
Definition: vtkChart.h:378
abstract base class for most VTK objects
Definition: vtkObject.h:61
bool RenderEmpty
Definition: vtkChart.h:355
GLuint index
Definition: vtkgl.h:11983
vtkAnnotationLink * AnnotationLink
Definition: vtkChart.h:332
base class for items that are part of a vtkContextScene.
GLint GLint GLsizei GLsizei GLsizei GLint border
Definition: vtkgl.h:11316
virtual bool Paint(vtkContext2D *painter)
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
GLdouble GLdouble right
Definition: vtkgl.h:18180
int LayoutStrategy
Definition: vtkChart.h:354
int vtkIdType
Definition: vtkType.h:268
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
int SelectionMode
Definition: vtkChart.h:361
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:56
Factory class for drawing 2D charts.
Definition: vtkChart.h:49
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:36
takes care of drawing 2D axes
Definition: vtkAxis.h:70
Provides a 2D scene for vtkContextItem objects.
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkRectf Size
Definition: vtkChart.h:352
virtual void SetAutoSize(bool isAutoSized)
Definition: vtkChart.h:245
bool ShowLegend
Definition: vtkChart.h:344
GLdouble GLdouble GLdouble GLdouble top
Definition: vtkgl.h:18180
virtual bool GetAutoSize()
Definition: vtkChart.h:250
describes linear transformations via a 3x3 matrix
Abstract class for 2D plots.
Definition: vtkPlot.h:51
represent text properties.
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
GLint left
Definition: vtkgl.h:14367
short & operator[](int index)
Definition: vtkChart.h:379
#define vtkGetVector2Macro(name, type)
Definition: vtkSetGet.h:260
draw the chart legend
provide event-driven interface to the rendering window (defines trackball mode)
vtkSmartPointer< vtkBrush > BackgroundBrush
Definition: vtkChart.h:358
virtual void PrintSelf(ostream &os, vtkIndent indent)
GLint GLint bottom
Definition: vtkgl.h:14367
#define vtkSetVector2Macro(name, type)
Definition: vtkSetGet.h:244
#define VTKCHARTSCORE_EXPORT
short & operator[](int index)
Definition: vtkChart.h:388
MouseActions Actions
Definition: vtkChart.h:393
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69