qmlui prototyping code added
[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 #include <QVector3D>
9
10 using namespace QtMobility;
11
12 class GeoMap : public QGraphicsGeoMap
13 {
14     Q_OBJECT
15
16     Q_PROPERTY(qreal angleToGpsLocation READ angleToGpsLocation NOTIFY positionChanged)
17     Q_PROPERTY(qreal distanceToGpsLocation READ distanceToGpsLocation NOTIFY positionChanged)
18     Q_PROPERTY(double centerLatitude READ centerLatitude WRITE setCenterLatitude NOTIFY positionChanged)
19     Q_PROPERTY(double centerLongitude READ centerLongitude WRITE setCenterLongitude NOTIFY positionChanged)
20     Q_PROPERTY(double gpsLocationLatitude READ gpsLocationLatitude NOTIFY gpsLocationChanged)
21     Q_PROPERTY(double gpsLocationLongitude READ gpsLocationLongitude NOTIFY gpsLocationChanged)
22
23 public:
24     GeoMap(QGraphicsItem* parent = 0);
25     virtual ~GeoMap();
26
27     qreal angleToGpsLocation() const;
28     qreal distanceToGpsLocation() const;
29
30     double centerLatitude() const;
31     void setCenterLatitude(const double latitude);
32     double centerLongitude() const;
33     void setCenterLongitude(const double longitude);
34     double gpsLocationLatitude() const;
35     double gpsLocationLongitude() const;
36
37 signals:
38     void positionChanged();
39     void screenCenterChanged();
40     void gpsLocationChanged();
41
42 public slots:
43     void goToGpsLocation();
44
45 private slots:
46     void positionUpdated(const QGeoPositionInfo& positionInfo);
47     void panned();
48
49 private:
50     QGeoPositionInfoSource *source;
51     QGeoCoordinate prevGpsLocation;
52     bool initialized;
53 };
54
55 #endif