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>
27 #include "ctkVisualizationVTKWidgetsExport.h"
28 class ctkVTKChartViewPrivate;
29 
30 // VTK includes
31 class vtkChartXY;
32 class vtkContextScene;
33 class vtkPlot;
34 
36 class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKChartView : public ctkVTKOpenGLNativeWidget
37 {
38  Q_OBJECT
40  Q_PROPERTY(QString title READ title WRITE setTitle)
41 
42 public:
44  ctkVTKChartView(QWidget* parent = 0);
45  virtual ~ctkVTKChartView();
46 
49  Q_INVOKABLE virtual void addPlot(vtkPlot* plot);
50 
53  Q_INVOKABLE virtual void removePlot(vtkPlot* plot);
54 
57  Q_INVOKABLE vtkIdType plotIndex(vtkPlot* plot);
58 
61  Q_INVOKABLE vtkChartXY* chart()const;
62  Q_INVOKABLE vtkContextScene* scene()const;
63 
65  QString title()const;
66  void setTitle(const QString& title);
67 
72  void chartExtent(double bounds[8])const;
73  void setChartUserExtent(double* userExtent);
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 
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
void setTitle(const QString &title)
void chartBounds(double bounds[8]) const
void plotRemoved(vtkPlot *plot)
void setChartUserBounds(double *bounds)
void extentChanged()
Fired anytime an axis is modified.
virtual void boundAxesToChartBounds()
Q_INVOKABLE vtkContextScene * scene() const
void boundsChanged()
Fired anytime the bound of a plot modifies the overall bounds.
virtual Q_INVOKABLE void addPlot(vtkPlot *plot)
ctkVTKOpenGLNativeWidget Superclass
QString title() const
Title that appears inside the view.
void removeAllPlots()
Remove all the plots from the chart.
virtual void mouseDoubleClickEvent(QMouseEvent *event)
virtual void onChartUpdated()
void plotAdded(vtkPlot *plot)
Q_INVOKABLE vtkIdType plotIndex(vtkPlot *plot)
virtual void setAxesToChartBounds()
Q_INVOKABLE vtkChartXY * chart() const
virtual Q_INVOKABLE void removePlot(vtkPlot *plot)
void chartExtent(double bounds[8]) const
ctkVTKChartView(QWidget *parent=0)
void setChartUserExtent(double *userExtent)
void chartUserBounds(double *bounds) const
virtual ~ctkVTKChartView()
void chartBoundsToPlotBounds(double bounds[8], double plotBounds[4]) const
QScopedPointer< ctkVTKChartViewPrivate > d_ptr
#define QVTK_OBJECT
Define VTK/Qt event/slot connection utility methods. It is a convenient macro that declares and defin...
Definition: ctkVTKObject.h:222