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_H 37 #define QGEOMAP_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/qgeocameracapabilities_p.h> 54 #include <QtCore/QObject> 55 #include <QtPositioning/private/qdoublevector2d_p.h> 56 #include <QtLocation/private/qgeoprojection_p.h> 57 #include <QtLocation/qgeoroute.h> 58 #include <QTransform> 59 60 QT_BEGIN_NAMESPACE 61 62 class QGeoMappingManagerEngine; 63 class QGeoMapPrivate; 64 class QGeoMapController; 65 class QGeoCoordinate; 66 class QSGNode; 67 class QQuickWindow; 68 class QGeoMapParameter; 69 class QDeclarativeGeoMapItemBase; 70 class QGeoMapObject; 71 class QDeclarativeGeoMap; 72 73 class Q_LOCATION_PRIVATE_EXPORT QGeoMap : public QObject 74 { 75 Q_OBJECT 76 Q_DECLARE_PRIVATE(QGeoMap) 77 78 Q_ENUMS(Capability) 79 Q_FLAGS(Capabilities) 80 public: 81 enum ItemType { 82 NoItem = 0x0000, 83 MapRectangle = 0x0001, 84 MapCircle = 0x0002, 85 MapPolyline = 0x0004, 86 MapPolygon = 0x0008, 87 MapQuickItem = 0x0010, 88 CustomMapItem = 0x8000 89 }; 90 91 Q_DECLARE_FLAGS(ItemTypes, ItemType) 92 93 enum Capability { 94 SupportsNothing = 0x0000, 95 SupportsVisibleRegion = 0x0001, 96 SupportsSetBearing = 0x0002, 97 SupportsAnchoringCoordinate = 0x0004, 98 SupportsFittingViewportToGeoRectangle = 0x0008, 99 SupportsVisibleArea = 0x0010, 100 }; 101 102 Q_DECLARE_FLAGS(Capabilities, Capability) 103 104 virtual ~QGeoMap(); 105 106 // Sets the display size 107 void setViewportSize(const QSize& viewportSize); 108 QSize viewportSize() const; 109 int viewportWidth() const; 110 int viewportHeight() const; 111 112 113 const QGeoCameraData &cameraData() const; 114 QGeoCameraCapabilities cameraCapabilities() const; 115 virtual Capabilities capabilities() const; 116 117 void setActiveMapType(const QGeoMapType mapType); 118 const QGeoMapType activeMapType() const; 119 120 // returns the minimum zoom at the current viewport size 121 double minimumZoom() const; 122 double maximumCenterLatitudeAtZoom(const QGeoCameraData &cameraData) const; 123 double minimumCenterLatitudeAtZoom(const QGeoCameraData &cameraData) const; 124 125 // returns the size of the underlying map, at the current zoom level. Unrelated to width()/height()/size(). 126 double mapWidth() const; 127 double mapHeight() const; 128 129 const QGeoProjection &geoProjection() const; 130 131 virtual void prefetchData(); 132 virtual void clearData(); 133 134 void addParameter(QGeoMapParameter *param); 135 void removeParameter(QGeoMapParameter *param); 136 void clearParameters(); 137 138 ItemTypes supportedMapItemTypes() const; 139 140 void addMapItem(QDeclarativeGeoMapItemBase *item); 141 void removeMapItem(QDeclarativeGeoMapItemBase *item); 142 void clearMapItems(); 143 144 virtual bool createMapObjectImplementation(QGeoMapObject *obj); 145 QList<QGeoMapObject *> mapObjects() const; 146 147 148 virtual QString copyrightsStyleSheet() const; 149 virtual void setAcceptedGestures(bool pan, bool flick, bool pinch, bool rotate, bool tilt); 150 virtual bool handleEvent(QEvent *event); 151 152 virtual bool setBearing(qreal bearing, const QGeoCoordinate &coordinate); 153 virtual QGeoShape visibleRegion() const; 154 virtual bool anchorCoordinateToPoint(const QGeoCoordinate &coordinate, const QPointF &anchorPoint); 155 virtual bool fitViewportToGeoRectangle(const QGeoRectangle &rectangle, const QMargins &borders); 156 157 virtual void setCopyrightVisible(bool visible); 158 virtual void removeMapObject(QGeoMapObject *obj); 159 virtual QList<QObject *> mapObjectsAt(const QGeoCoordinate &coordinate) const; 160 virtual void setItemToWindowTransform(const QTransform &itemToWindowTransform); 161 162 void setVisibleArea(const QRectF &visibleArea); 163 QRectF visibleArea() const; 164 165 protected: 166 QGeoMap(QGeoMapPrivate &dd, QObject *parent = 0); 167 void setCameraData(const QGeoCameraData &cameraData); 168 void setCameraCapabilities(const QGeoCameraCapabilities &cameraCapabilities); 169 virtual QSGNode *updateSceneGraph(QSGNode *node, QQuickWindow *window) = 0; 170 171 Q_SIGNALS: 172 void cameraDataChanged(const QGeoCameraData &cameraData); 173 void sgNodeChanged(); 174 void activeMapTypeChanged(); 175 void cameraCapabilitiesChanged(const QGeoCameraCapabilities &oldCameraCapabilities); 176 void copyrightsChanged(const QImage ©rightsImage); 177 void copyrightsChanged(const QString ©rightsHtml); 178 void copyrightsStyleSheetChanged(const QString &styleSheet); 179 void visibleAreaChanged(); 180 181 private: 182 Q_DISABLE_COPY(QGeoMap) 183 friend class QDeclarativeGeoMap; //updateSceneGraph 184 }; 185 186 Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoMap::ItemTypes) 187 188 QT_END_NAMESPACE 189 190 #endif // QGEOMAP_P_H 191