diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-09-21 18:14:26 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-01-27 09:56:25 +0000 |
commit | 69a42c4a5c37a5a74c4b285c64328bc88ed8e059 (patch) | |
tree | 54c3d5bf14a4938ab4786d5dfb70379aeee2894d /src/location/maps/qgeomap_p.h | |
parent | a6ff21e1e5ae264b7de264b47e08d334739fa4c6 (diff) | |
download | qtlocation-69a42c4a5c37a5a74c4b285c64328bc88ed8e059.tar.gz |
Allow plugins to use alternative map projections
QtLocation mapping has always been geared around the WebMercator
projection. Some mapping SDKs support additional projections, such
as General Perspective (often called globe view or globe rendering).
The goal of this patch is to allow a plugin to provide such a view,
disabling WebMercator specific features, and redirecting API calls
to plugin-specific implementations.
In particular, this patch disables the rendering of Map Items
(QDeclarativeGeoMapItemBase and sons) for projections different from
WebMercator, with the exception of MapQuickItems.
MapQuickItems, in turn, lose the ability to draw "on the map", when
the projection is different from WebMercator. However, they can still
be used to add geolocated popups, buttons and other UI elements.
fitViewportToMapItems is also disabled, for both it can't be computed
and there wouldn't be any item to fit (with the exception of
mapquickitems)
Change-Id: I9fa2fdd01a35a078fc4663efc9d269c4ecaa3f41
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/maps/qgeomap_p.h')
-rw-r--r-- | src/location/maps/qgeomap_p.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/location/maps/qgeomap_p.h b/src/location/maps/qgeomap_p.h index 7c7825f2..b2382099 100644 --- a/src/location/maps/qgeomap_p.h +++ b/src/location/maps/qgeomap_p.h @@ -73,6 +73,8 @@ class Q_LOCATION_PRIVATE_EXPORT QGeoMap : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QGeoMap) + Q_ENUMS(Capability) + Q_FLAGS(Capabilities) public: enum ItemType { NoItem = 0x0000, @@ -86,6 +88,16 @@ public: Q_DECLARE_FLAGS(ItemTypes, ItemType) + enum Capability { + SupportsNothing = 0x0000, + SupportsVisibleRegion = 0x0001, + SupportsSetBearing = 0x0002, + SupportsAnchoringCoordinate = 0x0004, + SupportsFittingViewportToGeoRectangle = 0x0008 + }; + + Q_DECLARE_FLAGS(Capabilities, Capability) + virtual ~QGeoMap(); // Sets the display size @@ -97,6 +109,7 @@ public: QGeoCameraData cameraData() const; QGeoCameraCapabilities cameraCapabilities() const; + virtual Capabilities capabilities() const; void setActiveMapType(const QGeoMapType mapType); const QGeoMapType activeMapType() const; @@ -132,6 +145,11 @@ public: virtual void setAcceptedGestures(bool pan, bool flick, bool pinch, bool rotate, bool tilt); virtual bool handleEvent(QEvent *event); + virtual bool setBearing(qreal bearing, const QGeoCoordinate &coordinate); + virtual QGeoShape visibleRegion() const; + virtual bool anchorCoordinateToPoint(const QGeoCoordinate &coordinate, const QPointF &anchorPoint); + virtual bool fitViewportToGeoRectangle(const QGeoRectangle &rectangle); + protected: QGeoMap(QGeoMapPrivate &dd, QObject *parent = 0); void setCameraData(const QGeoCameraData &cameraData); |