3ab15ea9232d0920044e982de5076cec08a79617
[situare] / src / qmlui / geomap.h
1 #ifndef GEOMAP_H
2 #define GEOMAP_H
3
4 #include <QGraphicsGeoMap>
5 #include <QGeoPositionInfo>
6 #include <QGeoPositionInfoSource>
7 #include <QGeoCoordinate>
8
9 using namespace QtMobility;
10 class FriendModel;
11 class FilteredFriendModel;
12 class RouteModel;
13
14 class GeoMapPrivate;
15
16 class GeoMap : public QGraphicsGeoMap
17 {
18     Q_OBJECT
19
20     Q_PROPERTY(qreal angleToGpsLocation READ angleToGpsLocation NOTIFY positionChanged)
21     Q_PROPERTY(qreal distanceToGpsLocation READ distanceToGpsLocation NOTIFY positionChanged)
22     Q_PROPERTY(double centerLatitude READ centerLatitude WRITE setCenterLatitude NOTIFY positionChanged)
23     Q_PROPERTY(double centerLongitude READ centerLongitude WRITE setCenterLongitude NOTIFY positionChanged)
24     Q_PROPERTY(double gpsLocationLatitude READ gpsLocationLatitude NOTIFY gpsLocationChanged)
25     Q_PROPERTY(double gpsLocationLongitude READ gpsLocationLongitude NOTIFY gpsLocationChanged)
26
27 public:
28     GeoMap(QGraphicsItem* parent = 0);
29     virtual ~GeoMap();
30
31     qreal angleToGpsLocation() const;
32     qreal distanceToGpsLocation() const;
33
34     double centerLatitude() const;
35     void setCenterLatitude(const double latitude);
36     double centerLongitude() const;
37     void setCenterLongitude(const double longitude);
38     double gpsLocationLatitude() const;
39     double gpsLocationLongitude() const;
40
41     void setFriendModels(FriendModel* friendModel, FilteredFriendModel* friendFilterModel);
42     void setRouteModel(RouteModel* routeModel);
43
44 signals:
45     void positionChanged();
46     void screenCenterChanged();
47     void gpsLocationChanged();
48
49 public slots:
50     void goToGpsLocation();
51     void onClicked(qreal mouseX, qreal mouseY);
52
53 private slots:
54     void positionUpdated(const QGeoPositionInfo& positionInfo);
55     void panned();
56     void onFriendModelReset();
57     void onRouteModelReset();
58
59 private:
60     Q_DISABLE_COPY(GeoMap);
61     Q_DECLARE_PRIVATE(GeoMap);
62     QScopedPointer<GeoMapPrivate> d_ptr;
63
64     QGeoPositionInfoSource *source;
65     QGeoCoordinate prevGpsLocation;
66     bool initialized;
67 };
68
69 #endif