DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
nodemapobject.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, 2013, 2014 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 NODEMAPOBJECT_H
22 #define NODEMAPOBJECT_H
23 
24 #include <mapobjects/mapobject.h>
25 #include <modelobjects/nodedata.h>
27 
28 #include <QObject>
29 
30 namespace qmapcontrol {
31  class RectWorldCoord;
32 }
33 
35 class NodeDetailsWidget;
36 
37 class NodeMapObject : public QObject, public MapObject
38 {
39  Q_OBJECT
40 
41  MapObjectsController *mController;
42 public:
43  /* Note to developers: When adding "Roles", add a proper creation case into Constructor.
44  * Also check MapObjectsController::createMapObjectsFromModel for proper layer creation.
45  * And MapObjectsController should define a proper Output Layer type (OutLayerId)
46  *
47  * */
48  enum Role {
78  };
79 
80  NodeMapObject(MapObjectsController *controller, int indx, Role role, std::shared_ptr<NodeData> node);
81 
82  std::shared_ptr<qmapcontrol::Geometry> getGeometryEntity() const {
83  return mGeometry;
84  }
85 
86  virtual bool showProperties();
87  virtual void updateProperties();
88 
89  bool selected() const { return mGeometry->selected(); }
90  std::shared_ptr<NodeData> node() const { return mNode; }
91 
92  Role getRole() const { return mRole; }
93 
94 protected:
95  QString updateStatText(QString prefix);
96  QList<int> getInterestingList() const;
97 
98 private slots:
99  void toolButtonClicked();
100  void widgetClosed();
101 
102 private:
103  std::shared_ptr<NodeData> mNode;
104  Role mRole;
105  std::shared_ptr<NodeGraphics> mGeometry;
106  NodeDetailsWidget *mWidget;
107 };
108 
109 #endif // NODEMAPOBJECT_H
Definition: nodemapobject.h:72
NodeMapObject(MapObjectsController *controller, int indx, Role role, std::shared_ptr< NodeData > node)
Definition: nodemapobject.cpp:34
Definition: nodemapobject.h:55
Definition: nodemapobject.h:75
Definition: nodemapobject.h:37
Definition: nodemapobject.h:65
Definition: nodemapobject.h:64
Definition: nodemapobject.h:49
bool selected() const
Definition: nodemapobject.h:89
Definition: nodemapobject.h:67
Definition: nodemapobject.h:57
Definition: nodedetailswidget.h:30
Definition: nodemapobject.h:63
Definition: mapobject.h:30
Role
Definition: nodemapobject.h:48
Definition: nodemapobject.h:66
Definition: nodemapobject.h:50
virtual void updateProperties()
Definition: nodemapobject.cpp:206
Role getRole() const
Definition: nodemapobject.h:92
virtual bool showProperties()
Definition: nodemapobject.cpp:196
Definition: nodemapobject.h:51
QString updateStatText(QString prefix)
Definition: nodemapobject.cpp:395
Definition: nodemapobject.h:70
Definition: nodemapobject.h:76
QList< int > getInterestingList() const
Definition: nodemapobject.cpp:445
Definition: mapobjectscontroller.h:91
std::shared_ptr< NodeData > node() const
Definition: nodemapobject.h:90
Definition: nodemapobject.h:60
Definition: nodemapobject.h:69
Definition: nodemapobject.h:74
Definition: nodemapobject.h:61
Definition: nodemapobject.h:71
Definition: nodemapobject.h:73
Definition: nodemapobject.h:52
Definition: nodemapobject.h:53
Definition: nodemapobject.h:77
Definition: nodemapobject.h:62
Definition: nodemapobject.h:68
std::shared_ptr< qmapcontrol::Geometry > getGeometryEntity() const
Definition: nodemapobject.h:82
Definition: csvspecspage.h:20
Definition: nodemapobject.h:59