CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkVTKChartView.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkVTKChartView_h
22 #define __ctkVTKChartView_h
23 
24 // CTK includes
25 #include <ctkVTKObject.h>
26 #include "ctkVisualizationVTKWidgetsExport.h"
27 class ctkVTKChartViewPrivate;
28 
29 // VTK includes
30 #if CTK_USE_QVTKOPENGLWIDGET
31 #include <QVTKOpenGLWidget.h>
32 #else
33 #include <QVTKWidget.h>
34 #endif
35 
36 class vtkChartXY;
37 class vtkContextScene;
38 class vtkPlot;
39 
41 #if CTK_USE_QVTKOPENGLWIDGET
42 class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKChartView : public QVTKOpenGLWidget
43 #else
44 class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKChartView : public QVTKWidget
45 #endif
46 {
47  Q_OBJECT
49  Q_PROPERTY(QString title READ title WRITE setTitle)
50 
51 public:
52 #if CTK_USE_QVTKOPENGLWIDGET
53  typedef QVTKOpenGLWidget Superclass;
54 #else
55  typedef QVTKWidget Superclass;
56 #endif
57  ctkVTKChartView(QWidget* parent = 0);
58  virtual ~ctkVTKChartView();
59 
62  Q_INVOKABLE virtual void addPlot(vtkPlot* plot);
63 
66  Q_INVOKABLE virtual void removePlot(vtkPlot* plot);
67 
70  Q_INVOKABLE vtkIdType plotIndex(vtkPlot* plot);
71 
74  Q_INVOKABLE vtkChartXY* chart()const;
75  Q_INVOKABLE vtkContextScene* scene()const;
76 
78  QString title()const;
79  void setTitle(const QString& title);
80 
85  void chartExtent(double bounds[8])const;
86 
91  void chartBounds(double bounds[8])const;
92  void setChartUserBounds(double* bounds);
93  void chartUserBounds(double* bounds)const;
94 
95 
96 public Q_SLOTS:
97 
99  void removeAllPlots();
100 
102  virtual void setAxesToChartBounds();
103  virtual void boundAxesToChartBounds();
104 
105 Q_SIGNALS:
106  void plotAdded(vtkPlot* plot);
107  void plotRemoved(vtkPlot* plot);
109  void boundsChanged();
111  void extentChanged();
112 
113 protected:
114  QScopedPointer<ctkVTKChartViewPrivate> d_ptr;
115 
116  virtual void mouseDoubleClickEvent(QMouseEvent* event);
117  virtual void onChartUpdated();
118  void chartBoundsToPlotBounds(double bounds[8], double plotBounds[4])const;
119 
120 private:
121  Q_DECLARE_PRIVATE(ctkVTKChartView);
122  Q_DISABLE_COPY(ctkVTKChartView);
123 };
124 
125 #endif
void setChartUserBounds(double *bounds)
void plotRemoved(vtkPlot *plot)
void chartBounds(double bounds[8]) const
Q_INVOKABLE vtkChartXY * chart() const
virtual Q_INVOKABLE void addPlot(vtkPlot *plot)
void chartExtent(double bounds[8]) const
void setTitle(const QString &title)
Q_INVOKABLE vtkIdType plotIndex(vtkPlot *plot)
void chartUserBounds(double *bounds) const
virtual ~ctkVTKChartView()
virtual void boundAxesToChartBounds()
QVTKWidget Superclass
void extentChanged()
Fired anytime an axis is modified.
void removeAllPlots()
Remove all the plots from the chart.
#define QVTK_OBJECT
Define VTK/Qt event/slot connection utility methods. It is a convenient macro that declares and defin...
Definition: ctkVTKObject.h:222
void chartBoundsToPlotBounds(double bounds[8], double plotBounds[4]) const
virtual void mouseDoubleClickEvent(QMouseEvent *event)
virtual void setAxesToChartBounds()
virtual void onChartUpdated()
Q_INVOKABLE vtkContextScene * scene() const
QString title() const
Title that appears inside the view.
QScopedPointer< ctkVTKChartViewPrivate > d_ptr
virtual Q_INVOKABLE void removePlot(vtkPlot *plot)
ctkVTKChartView(QWidget *parent=0)
void boundsChanged()
Fired anytime the bound of a plot modifies the overal bounds.
void plotAdded(vtkPlot *plot)