1 | // %flair:license{
|
---|
2 | // This file is part of the Flair framework distributed under the
|
---|
3 | // CECILL-C License, Version 1.0.
|
---|
4 | // %flair:license}
|
---|
5 | /****************************************************************************
|
---|
6 | **
|
---|
7 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
8 | ** All rights reserved.
|
---|
9 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
10 | **
|
---|
11 | ** This file is part of the documentation of Qt. It was originally
|
---|
12 | ** published as part of Qt Quarterly.
|
---|
13 | **
|
---|
14 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
15 | ** Commercial Usage
|
---|
16 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
17 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
18 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
19 | ** a written agreement between you and Nokia.
|
---|
20 | **
|
---|
21 | ** GNU Lesser General Public License Usage
|
---|
22 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
23 | ** General Public License version 2.1 as published by the Free Software
|
---|
24 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
25 | ** packaging of this file. Please review the following information to
|
---|
26 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
27 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
28 | **
|
---|
29 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
30 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
31 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
32 | **
|
---|
33 | ** GNU General Public License Usage
|
---|
34 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
35 | ** General Public License version 3.0 as published by the Free Software
|
---|
36 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
37 | ** packaging of this file. Please review the following information to
|
---|
38 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
39 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
40 | **
|
---|
41 | ** If you have questions regarding the use of this file, please contact
|
---|
42 | ** Nokia at qt-info@nokia.com.
|
---|
43 | ** $QT_END_LICENSE$
|
---|
44 | **
|
---|
45 | ****************************************************************************/
|
---|
46 |
|
---|
47 | #ifndef MAPWIDGET_H
|
---|
48 | #define MAPWIDGET_H
|
---|
49 |
|
---|
50 | #include <QGraphicsView>
|
---|
51 | #include <QGraphicsGeoMap>
|
---|
52 |
|
---|
53 | class QGraphicsScene;
|
---|
54 | class Map;
|
---|
55 | class Landmark;
|
---|
56 |
|
---|
57 | using namespace QtMobility;
|
---|
58 |
|
---|
59 | class MapWidget : public QGraphicsView {
|
---|
60 | Q_OBJECT
|
---|
61 |
|
---|
62 | public:
|
---|
63 | MapWidget(Map *map, QWidget *parent = 0);
|
---|
64 | void setMap(QtMobility::QGraphicsGeoMap *geoMap);
|
---|
65 | QGraphicsScene *scene() const;
|
---|
66 | bool IsUptodate(void);
|
---|
67 | void SetUptodate(void);
|
---|
68 | void Reset(void);
|
---|
69 | QList<Landmark *> *Landmarks(void);
|
---|
70 | bool LandmarkToSend(int index);
|
---|
71 | void AddLandmark(const QGeoCoordinate &coordinate);
|
---|
72 | void RemoveLandmarks(void);
|
---|
73 | void AddLandmarks(QGraphicsGeoMap *geoMap);
|
---|
74 | void AddPoint(QString name);
|
---|
75 |
|
---|
76 | signals:
|
---|
77 | void positionChanged(const QGeoCoordinate &coordinate);
|
---|
78 |
|
---|
79 | protected:
|
---|
80 | void mousePressEvent(QMouseEvent *event);
|
---|
81 | void mouseMoveEvent(QMouseEvent *event);
|
---|
82 | void mouseReleaseEvent(QMouseEvent *event);
|
---|
83 | void resizeEvent(QResizeEvent *event);
|
---|
84 | void wheelEvent(QWheelEvent *event);
|
---|
85 | void mouseDoubleClickEvent(QMouseEvent *event);
|
---|
86 |
|
---|
87 | private slots:
|
---|
88 | void initDrag();
|
---|
89 |
|
---|
90 | private:
|
---|
91 | QGraphicsGeoMap *geoMap;
|
---|
92 | bool dragging;
|
---|
93 | QPoint dragStartPosition;
|
---|
94 | bool pressed;
|
---|
95 | bool is_uptodate;
|
---|
96 |
|
---|
97 | QGraphicsScene *m_scene;
|
---|
98 | QList<Landmark *> *landmarks;
|
---|
99 | QList<Landmark *> *landmarks_old;
|
---|
100 | QList<QString> points;
|
---|
101 | Landmark *landmark_match;
|
---|
102 | Map *map;
|
---|
103 | };
|
---|
104 |
|
---|
105 | #endif
|
---|