DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
dteditorwindow.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 #ifndef DTEDITORWINDOW_H
22 #define DTEDITORWINDOW_H
23 
24 #include <QMainWindow>
25 #include <memory>
26 #include <dtree/decisiontree.h>
27 #include <dtgraphicsscene.h>
28 #include <commands/command.h>
29 #include <memory>
30 #include <QStack>
31 
32 namespace Ui {
33 class DtEditorWindow;
34 }
35 
36 class DtEditorWindow : public QMainWindow
37 {
38  Q_OBJECT
39 
40 public:
41  explicit DtEditorWindow(QWidget *parent = 0);
43 
44  void updateGui();
45 
46 protected:
47  void save(QString filename);
48  void open(QString filename);
49  void updateTitleBar();
51  void createScene(std::shared_ptr<dtree::DecisionTree> tree);
52 
53  void undo();
54  void redo();
55  void execute(std::shared_ptr<Command> command);
56  void clearUndoRedoStacks();
57  void updateUndoGuiStatus();
58 
59  void closeEvent(QCloseEvent *event);
60 
61 private slots:
62  void on_action_Add_Node_triggered();
63  void evt_scene_node_added(GraphNodeItem *);
64  void evt_scene_selection_changed();
65  void on_nodepropVariable_currentIndexChanged(int index);
66  void on_actionSave_as_triggered();
67  void on_action_Open_triggered();
68  void on_nodeValue_valueChanged(double value);
69  void on_action_Save_triggered();
70  void on_treeType_currentIndexChanged(int index);
71  void on_action_Delete_Nodes_triggered();
72  void on_actionUndo_triggered();
73  void on_actionRedo_triggered();
74 
75  void on_actionQuit_triggered();
76 
77  void on_actionMappings_triggered();
78 
79 private:
81 
82  std::shared_ptr<dtree::DecisionTree> mTree;
83  DtGraphicsScene *mScene;
84 
85  QStack<std::shared_ptr<Command>> mUndoList, mRedoList;
86  QString mFilename;
87 };
88 
89 #endif // DTEDITORWINDOW_H
void updateUndoGuiStatus()
Definition: dteditorwindow.cpp:126
Definition: dteditorwindow.h:36
void clearUndoRedoStacks()
Definition: dteditorwindow.cpp:119
Definition: dtgraphicsscene.h:37
Definition: dteditorwindow.h:32
void undo()
Definition: dteditorwindow.cpp:88
void redo()
Definition: dteditorwindow.cpp:99
DtEditorWindow(QWidget *parent=0)
Definition: dteditorwindow.cpp:42
void open(QString filename)
Definition: dteditorwindow.cpp:150
Definition: ui_dteditorwindow.h:270
void save(QString filename)
Definition: dteditorwindow.cpp:132
void execute(std::shared_ptr< Command > command)
Definition: dteditorwindow.cpp:110
std::pair< box, unsigned > value
Definition: diffusion.cpp:30
void updateTitleBar()
Definition: dteditorwindow.cpp:189
void closeEvent(QCloseEvent *event)
Definition: dteditorwindow.cpp:207
void updateGui()
Definition: dteditorwindow.cpp:199
bool checkForDTreeBeforeSaving()
Definition: dteditorwindow.cpp:374
void createScene(std::shared_ptr< dtree::DecisionTree > tree)
Definition: dteditorwindow.cpp:76
~DtEditorWindow()
Definition: dteditorwindow.cpp:71
Definition: graphnodeitem.h:36