DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
vesselmapobject.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 VESSELMAPOBJECT_H
22 #define VESSELMAPOBJECT_H
23 
24 #include <QObject>
25 
26 #include <mapobjects/mapobject.h>
29 
30 #include <QMapControl/GeometryPointShapeScaled.h>
31 
32 #include <QBrush>
33 
34 namespace qmapcontrol {
35  class RectWorldCoord;
36 }
37 
39 
40 class VesselMapObject : public QObject, public MapObject
41 {
42  Q_OBJECT
43 
44  class VesselGraphics : public qmapcontrol::GeometryPointShapeScaled {
45  static QBrush *color;
46  static QBrush *statHarbour, *statSteaming, *statFishing;
47 
48  VesselData *mVessel;
49  public:
50  VesselGraphics (VesselData *vessel);
51 
52  void updated();
53  protected:
54  virtual void drawShape(QPainter &painter, const qmapcontrol::RectWorldPx &rect);
55  };
56 
57 public:
58  VesselMapObject(MapObjectsController *controller, VesselData *vessel);
59 
60  std::shared_ptr<qmapcontrol::Geometry> getGeometryEntity() const {
61  return mGeometry;
62  }
63 
64  virtual bool showProperties();
65  virtual void updateProperties();
66 
67  void vesselUpdated();
68 
69  static QString vesselStateToString(int state);
70 
71 private slots:
72  void widgetClosed();
73 
74 private:
75  MapObjectsController *mController;
76 
77  VesselData *mVessel;
78  std::shared_ptr<VesselGraphics> mGeometry;
79 
80  NodeDetailsWidget *mWidget;
81 };
82 
83 #endif // VESSELMAPOBJECT_H
Definition: vesselmapobject.h:40
void vesselUpdated()
Definition: vesselmapobject.cpp:107
static QString vesselStateToString(int state)
Definition: vesselmapobject.cpp:61
std::shared_ptr< qmapcontrol::Geometry > getGeometryEntity() const
Definition: vesselmapobject.h:60
VesselMapObject(MapObjectsController *controller, VesselData *vessel)
Definition: vesselmapobject.cpp:38
virtual void updateProperties()
Definition: vesselmapobject.cpp:75
Definition: nodedetailswidget.h:30
Definition: mapobject.h:30
Definition: mapobjectscontroller.h:91
Definition: vesseldata.h:31
virtual bool showProperties()
Definition: vesselmapobject.cpp:48
Definition: csvspecspage.h:20