Friend filtering redone
[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
13 class GeoMapPrivate;
14
15 class GeoMap : public QGraphicsGeoMap
16 {
17     Q_OBJECT
18
19     Q_PROPERTY(qreal angleToGpsLocation READ angleToGpsLocation NOTIFY positionChanged)
20     Q_PROPERTY(qreal distanceToGpsLocation READ distanceToGpsLocation NOTIFY positionChanged)
21     Q_PROPERTY(double centerLatitude READ centerLatitude WRITE setCenterLatitude NOTIFY positionChanged)
22     Q_PROPERTY(double centerLongitude READ centerLongitude WRITE setCenterLongitude NOTIFY positionChanged)
23     Q_PROPERTY(double gpsLocationLatitude READ gpsLocationLatitude NOTIFY gpsLocationChanged)
24     Q_PROPERTY(double gpsLocationLongitude READ gpsLocationLongitude NOTIFY gpsLocationChanged)
25
26 public:
27     GeoMap(QGraphicsItem* parent = 0);
28     virtual ~GeoMap();
29
30     qreal angleToGpsLocation() const;
31     qreal distanceToGpsLocation() const;
32
33     double centerLatitude() const;
34     void setCenterLatitude(const double latitude);
35     double centerLongitude() const;
36     void setCenterLongitude(const double longitude);
37     double gpsLocationLatitude() const;
38     double gpsLocationLongitude() const;
39
40     void setFriendModels(FriendModel* friendModel, FilteredFriendModel* friendFilterModel);
41
42 signals:
43     void positionChanged();
44     void screenCenterChanged();
45     void gpsLocationChanged();
46
47 public slots:
48     void goToGpsLocation();
49     void onClicked(qreal mouseX, qreal mouseY);
50
51 private slots:
52     void positionUpdated(const QGeoPositionInfo& positionInfo);
53     void panned();
54     void onFriendModelReset();
55
56 private:
57     Q_DISABLE_COPY(GeoMap);
58     Q_DECLARE_PRIVATE(GeoMap);
59     QScopedPointer<GeoMapPrivate> d_ptr;
60
61     QGeoPositionInfoSource *source;
62     QGeoCoordinate prevGpsLocation;
63     bool initialized;
64 };
65
66 #endif