DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
graphinteractioncontroller.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // DISPLACE: DYNAMIC INDIVIDUAL VESSEL-BASED SPATIAL PLANNING
3 // AND EFFORT DISPLACEMENT
4 // Copyright (c) 2012-2019 Francois Bastardie <fba@aqua.dtu.dk>
5 
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 
16 // You should have received a copy of the GNU General Public License along
17 // with this program; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // --------------------------------------------------------------------------
20 
21 /* --------------------------------------------------------------------------
22  * DISPLACE: DYNAMIC INDIVIDUAL VESSEL-BASED SPATIAL PLANNING
23  * AND EFFORT DISPLACEMENT
24  * Copyright (c) 2012, 2013, 2014 Francois Bastardie <fba@aqua.dtu.dk>
25  *
26  * This program is free software; you can redistribute it and/or modify
27  * it under the terms of the GNU General Public License as published by
28  * the Free Software Foundation; either version 2 of the License, or
29  * (at your option) any later version.
30  *
31  * This program is distributed in the hope that it will be useful,
32  * but WITHOUT ANY WARRANTY; without even the implied warranty of
33  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34  * GNU General Public License for more details.
35  *
36  * You should have received a copy of the GNU General Public License along
37  * with this program; if not, write to the Free Software Foundation, Inc.,
38  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
39  * --------------------------------------------------------------------------
40  */
41 #ifndef GRAPHINTERACTIONCONTROLLER_H
42 #define GRAPHINTERACTIONCONTROLLER_H
43 
44 #include <QObject>
45 #include <qcustomplot.h>
46 #include <functional>
47 
48 class GraphInteractionController : public QObject
49 {
50  Q_OBJECT
51 
52  QCustomPlot *mPlot;
53 public:
54  explicit GraphInteractionController(QCustomPlot *plot, QObject *parent = 0);
55 
56  enum class PopupMenuLocation { Plot, Legend };
57  using OnPopupMenuBuilt = std::function<void(PopupMenuLocation location, QMenu *menu)>;
58 
60 signals:
61 
62 public slots:
63  void selectionChanged();
64  void mousePress();
65  void mouseWheel();
66  void contextMenuRequest(QPoint pos);
67  void moveLegend();
68 
69 private:
70  OnPopupMenuBuilt mOnPopupMenuBuilt = nullptr;
71 };
72 
73 #endif // GRAPHINTERACTIONCONTROLLER_H
void selectionChanged()
Definition: graphinteractioncontroller.cpp:47
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition: qcustomplot.h:3582
std::function< void(PopupMenuLocation location, QMenu *menu)> OnPopupMenuBuilt
Definition: graphinteractioncontroller.h:57
void moveLegend()
Definition: graphinteractioncontroller.cpp:102
void mousePress()
Definition: graphinteractioncontroller.cpp:52
PopupMenuLocation
Definition: graphinteractioncontroller.h:56
void contextMenuRequest(QPoint pos)
Definition: graphinteractioncontroller.cpp:79
void mouseWheel()
Definition: graphinteractioncontroller.cpp:66
void setOnPopupMenuBuiltCallback(OnPopupMenuBuilt callback)
Definition: graphinteractioncontroller.cpp:42
Definition: graphinteractioncontroller.h:48
GraphInteractionController(QCustomPlot *plot, QObject *parent=0)
Definition: graphinteractioncontroller.cpp:25