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 #include <QVTKWidget.h>
31 
32 class vtkChartXY;
33 class vtkContextScene;
34 class vtkPlot;
35 
37 class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKChartView : public QVTKWidget
38 {
39  Q_OBJECT
41  Q_PROPERTY(QString title READ title WRITE setTitle)
42 
43 public:
44  typedef QVTKWidget Superclass;
45  ctkVTKChartView(QWidget* parent = 0);
46  virtual ~ctkVTKChartView();
47 
50  Q_INVOKABLE virtual void addPlot(vtkPlot* plot);
51 
54  Q_INVOKABLE virtual void removePlot(vtkPlot* plot);
55 
58  Q_INVOKABLE vtkIdType plotIndex(vtkPlot* plot);
59 
62  Q_INVOKABLE vtkChartXY* chart()const;
63  Q_INVOKABLE vtkContextScene* scene()const;
64 
66  QString title()const;
67  void setTitle(const QString& title);
68 
73  void chartExtent(double bounds[8])const;
74 
79  void chartBounds(double bounds[8])const;
80  void setChartUserBounds(double* bounds);
81  void chartUserBounds(double* bounds)const;
82 
83 
84 public Q_SLOTS:
85 
87  void removeAllPlots();
88 
90  virtual void setAxesToChartBounds();
91  virtual void boundAxesToChartBounds();
92 
93 Q_SIGNALS:
94  void plotAdded(vtkPlot* plot);
95  void plotRemoved(vtkPlot* plot);
97  void boundsChanged();
99  void extentChanged();
100 
101 protected:
102  QScopedPointer<ctkVTKChartViewPrivate> d_ptr;
103 
104  virtual void mouseDoubleClickEvent(QMouseEvent* event);
105  virtual void onChartUpdated();
106  void chartBoundsToPlotBounds(double bounds[8], double plotBounds[4])const;
107 
108 private:
109  Q_DECLARE_PRIVATE(ctkVTKChartView);
110  Q_DISABLE_COPY(ctkVTKChartView);
111 };
112 
113 #endif
QVTKWidget Superclass
#define QVTK_OBJECT
Define VTK/Qt event/slot connection utility methods. It is a convenient macro that declares and defin...
Definition: ctkVTKObject.h:222
QScopedPointer< ctkVTKChartViewPrivate > d_ptr