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 | ~MapWidget();
|
---|
65 | void setMap(QtMobility::QGraphicsGeoMap *geoMap);
|
---|
66 | QGraphicsScene *scene() const;
|
---|
67 | bool IsUptodate(void);
|
---|
68 | void SetUptodate(void);
|
---|
69 | void Reset(void);
|
---|
70 | QList<Landmark *> *Landmarks(void);
|
---|
71 | bool LandmarkToSend(int index);
|
---|
72 | void AddLandmark(const QGeoCoordinate &coordinate);
|
---|
73 | void RemoveLandmarks(void);
|
---|
74 | void AddLandmarks(QGraphicsGeoMap *geoMap);
|
---|
75 | void AddPoint(QString name);
|
---|
76 |
|
---|
77 | signals:
|
---|
78 | void positionChanged(const QGeoCoordinate &coordinate);
|
---|
79 |
|
---|
80 | protected:
|
---|
81 | void mousePressEvent(QMouseEvent *event);
|
---|
82 | void mouseMoveEvent(QMouseEvent *event);
|
---|
83 | void mouseReleaseEvent(QMouseEvent *event);
|
---|
84 | void resizeEvent(QResizeEvent *event);
|
---|
85 | void wheelEvent(QWheelEvent *event);
|
---|
86 | void mouseDoubleClickEvent(QMouseEvent *event);
|
---|
87 |
|
---|
88 | private slots:
|
---|
89 | void initDrag();
|
---|
90 |
|
---|
91 | private:
|
---|
92 | QGraphicsGeoMap *geoMap;
|
---|
93 | bool dragging;
|
---|
94 | QPoint dragStartPosition;
|
---|
95 | bool pressed;
|
---|
96 | bool is_uptodate;
|
---|
97 |
|
---|
98 | QGraphicsScene *m_scene;
|
---|
99 | QList<Landmark *> *landmarks;
|
---|
100 | QList<Landmark *> *landmarks_old;
|
---|
101 | QList<QString> points;
|
---|
102 | Landmark *landmark_match;
|
---|
103 | Map *map;
|
---|
104 | };
|
---|
105 |
|
---|
106 | #endif
|
---|