1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
5 **
6 ** This file is part of the QtLocation module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL3$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** information use the contact form at http://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPLv3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or later as published by the Free
28 ** Software Foundation and appearing in the file LICENSE.GPL included in
29 ** the packaging of this file. Please review the following information to
30 ** ensure the GNU General Public License version 2.0 requirements will be
31 ** met: http://www.gnu.org/licenses/gpl-2.0.html.
32 **
33 ** $QT_END_LICENSE$
34 **
35 ****************************************************************************/
36 #ifndef QGEOMAP_P_P_H
37 #define QGEOMAP_P_P_H
38 
39 //
40 //  W A R N I N G
41 //  -------------
42 //
43 // This file is not part of the Qt API.  It exists purely as an
44 // implementation detail.  This header file may change from version to
45 // version without notice, or even be removed.
46 //
47 // We mean it.
48 //
49 
50 #include <QtLocation/private/qlocationglobal_p.h>
51 #include <QtLocation/private/qgeocameradata_p.h>
52 #include <QtLocation/private/qgeomaptype_p.h>
53 #include <QtLocation/private/qgeoprojection_p.h>
54 #include <QtLocation/private/qgeomap_p.h>
55 #include <QtLocation/private/qgeocameracapabilities_p.h>
56 #include <QtCore/private/qobject_p.h>
57 #include <QtCore/QSize>
58 #include <QtCore/QList>
59 #include "qgeomap_p.h"
60 
61 
62 QT_BEGIN_NAMESPACE
63 
64 class QGeoMappingManagerEngine;
65 class QGeoMap;
66 class QGeoMapController;
67 class QGeoMapParameter;
68 class QDeclarativeGeoMapItemBase;
69 class QGeoMapObjectPrivate;
70 
71 class Q_LOCATION_PRIVATE_EXPORT QGeoMapPrivate :  public QObjectPrivate
72 {
73     Q_DECLARE_PUBLIC(QGeoMap)
74 public:
75     QGeoMapPrivate(QGeoMappingManagerEngine *engine, QGeoProjection *geoProjection);
76     virtual ~QGeoMapPrivate();
77 
78     const QGeoProjection *geoProjection() const;
79     void setCameraCapabilities(const QGeoCameraCapabilities &cameraCapabilities);
80     const QGeoCameraCapabilities &cameraCapabilities() const;
81 
82     static const QGeoMapPrivate *get(const QGeoMap &map);
83     virtual QGeoMapObjectPrivate *createMapObjectImplementation(QGeoMapObject *obj);
84 
85 protected:
86     /* Hooks into the actual map implementations */
87     virtual void addParameter(QGeoMapParameter *param);
88     virtual void removeParameter(QGeoMapParameter *param);
89 
90     virtual QGeoMap::ItemTypes supportedMapItemTypes() const;
91     virtual void addMapItem(QDeclarativeGeoMapItemBase *item);
92     virtual void removeMapItem(QDeclarativeGeoMapItemBase *item);
93 
94     virtual QList<QGeoMapObject *> mapObjects() const;
95 
96     virtual void changeViewportSize(const QSize &size) = 0; // called by QGeoMap::setSize()
97     virtual void changeCameraData(const QGeoCameraData &oldCameraData) = 0; // called by QGeoMap::setCameraData()
98     virtual void changeActiveMapType(const QGeoMapType mapType) = 0; // called by QGeoMap::setActiveMapType()
99 
100     virtual double mapWidth() const;
101     virtual double mapHeight() const;
102 
103     virtual void setCopyrightVisible(bool visible);
104     virtual bool copyrightVisible() const;
105     virtual double maximumCenterLatitudeAtZoom(const QGeoCameraData &cameraData) const;
106     virtual double minimumCenterLatitudeAtZoom(const QGeoCameraData &cameraData) const;
107 
108     virtual void setVisibleArea(const QRectF &visibleArea);
109     virtual QRectF visibleArea() const;
110 
111     QRectF clampVisibleArea(const QRectF &visibleArea) const;
112 
113 #ifdef QT_LOCATION_DEBUG
114 public:
115 #else
116 protected:
117 #endif
118     QSize m_viewportSize;
119     QGeoProjection *m_geoProjection;
120     QPointer<QGeoMappingManagerEngine> m_engine;
121     QGeoCameraData m_cameraData;
122     QGeoMapType m_activeMapType;
123     QList<QGeoMapParameter *> m_mapParameters;
124     QList<QDeclarativeGeoMapItemBase *> m_mapItems;
125     QGeoCameraCapabilities m_cameraCapabilities;
126     bool m_copyrightVisible = true;
127     mutable double m_maximumViewportLatitude = 0;
128     mutable double m_minimumViewportLatitude = 0;
129 };
130 
131 QT_END_NAMESPACE
132 
133 #endif // QGEOMAP_P_P_H
134