summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/location/location.cpp3
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap.cpp26
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap_p.h3
-rw-r--r--src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp41
-rw-r--r--src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h9
5 files changed, 72 insertions, 10 deletions
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp
index 45087751..422b4c72 100644
--- a/src/imports/location/location.cpp
+++ b/src/imports/location/location.cpp
@@ -200,6 +200,9 @@ public:
qmlRegisterType<QDeclarativeGeoRoute, 13>(uri, major, minor, "Route");
qmlRegisterType<QDeclarativeGeoRouteQuery, 13>(uri, major, minor, "RouteQuery");
+ minor = 14;
+ qmlRegisterType<QDeclarativeGeoMap, 14>(uri, major, minor, "Map");
+
// Register the latest Qt version as QML type version
qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR);
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp
index 1b5ea11c..4074bcad 100644
--- a/src/location/declarativemaps/qdeclarativegeomap.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomap.cpp
@@ -892,8 +892,10 @@ void QDeclarativeGeoMap::setZoomLevel(qreal zoomLevel, bool overzoom)
} else {
const bool zlHasChanged = zoomLevel != m_cameraData.zoomLevel();
m_cameraData.setZoomLevel(zoomLevel);
- if (zlHasChanged)
+ if (zlHasChanged) {
emit zoomLevelChanged(zoomLevel);
+ emit visibleRegionChanged();
+ }
}
}
@@ -976,8 +978,10 @@ void QDeclarativeGeoMap::setBearing(qreal bearing)
} else {
const bool bearingHasChanged = bearing != m_cameraData.bearing();
m_cameraData.setBearing(bearing);
- if (bearingHasChanged)
+ if (bearingHasChanged) {
emit bearingChanged(bearing);
+ emit visibleRegionChanged();
+ }
}
}
@@ -1041,8 +1045,10 @@ void QDeclarativeGeoMap::setTilt(qreal tilt)
} else {
const bool tiltHasChanged = tilt != m_cameraData.tilt();
m_cameraData.setTilt(tilt);
- if (tiltHasChanged)
+ if (tiltHasChanged) {
emit tiltChanged(tilt);
+ emit visibleRegionChanged();
+ }
}
}
@@ -1099,8 +1105,10 @@ void QDeclarativeGeoMap::setFieldOfView(qreal fieldOfView)
} else {
const bool fovChanged = fieldOfView != m_cameraData.fieldOfView();
m_cameraData.setFieldOfView(fieldOfView);
- if (fovChanged)
+ if (fovChanged) {
emit fieldOfViewChanged(fieldOfView);
+ emit visibleRegionChanged();
+ }
}
}
@@ -1266,8 +1274,10 @@ void QDeclarativeGeoMap::setCenter(const QGeoCoordinate &center)
} else {
const bool centerHasChanged = center != m_cameraData.center();
m_cameraData.setCenter(center);
- if (centerHasChanged)
+ if (centerHasChanged) {
emit centerChanged(center);
+ emit visibleRegionChanged();
+ }
}
}
@@ -1309,15 +1319,18 @@ void QDeclarativeGeoMap::setVisibleRegion(const QGeoShape &shape)
// shape invalidated -> nothing to fit anymore
m_visibleRegion = QGeoRectangle();
m_pendingFitViewport = false;
+ emit visibleRegionChanged();
return;
}
if (!m_map || !width() || !height()) {
m_pendingFitViewport = true;
+ emit visibleRegionChanged();
return;
}
fitViewportToGeoShape(m_visibleRegion);
+ emit visibleRegionChanged();
}
QGeoShape QDeclarativeGeoMap::visibleRegion() const
@@ -1755,6 +1768,9 @@ void QDeclarativeGeoMap::onCameraDataChanged(const QGeoCameraData &cameraData)
emit tiltChanged(m_cameraData.tilt());
if (fovHasChanged)
emit fieldOfViewChanged(m_cameraData.fieldOfView());
+ if (centerHasChanged || zoomHasChanged || bearingHasChanged
+ || tiltHasChanged || fovHasChanged)
+ emit visibleRegionChanged();
}
/*!
diff --git a/src/location/declarativemaps/qdeclarativegeomap_p.h b/src/location/declarativemaps/qdeclarativegeomap_p.h
index 55751365..c97c3622 100644
--- a/src/location/declarativemaps/qdeclarativegeomap_p.h
+++ b/src/location/declarativemaps/qdeclarativegeomap_p.h
@@ -97,7 +97,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMap : public QQuickItem
Q_PROPERTY(QList<QObject *> mapParameters READ mapParameters)
Q_PROPERTY(QGeoServiceProvider::Error error READ error NOTIFY errorChanged)
Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
- Q_PROPERTY(QGeoShape visibleRegion READ visibleRegion WRITE setVisibleRegion)
+ Q_PROPERTY(QGeoShape visibleRegion READ visibleRegion WRITE setVisibleRegion NOTIFY visibleRegionChanged)
Q_PROPERTY(bool copyrightsVisible READ copyrightsVisible WRITE setCopyrightsVisible NOTIFY copyrightsVisibleChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
Q_PROPERTY(bool mapReady READ mapReady NOTIFY mapReadyChanged)
@@ -233,6 +233,7 @@ Q_SIGNALS:
void mapReadyChanged(bool ready);
Q_REVISION(11) void mapObjectsChanged();
void visibleAreaChanged();
+ Q_REVISION(14) void visibleRegionChanged();
protected:
void mousePressEvent(QMouseEvent *event) override ;
diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp
index b594d2dc..aa1db493 100644
--- a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp
+++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp
@@ -192,7 +192,8 @@ void QDeclarativeGeoServiceProvider::componentComplete()
|| required_->mappingRequirements() != NoMappingFeatures
|| required_->routingRequirements() != NoRoutingFeatures
|| required_->geocodingRequirements() != NoGeocodingFeatures
- || required_->placesRequirements() != NoPlacesFeatures) {
+ || required_->placesRequirements() != NoPlacesFeatures
+ || required_->navigationRequirements() != NoNavigationFeatures) {
QStringList providers = QGeoServiceProvider::availableServiceProviders();
@@ -673,7 +674,8 @@ QDeclarativeGeoServiceProviderRequirements::QDeclarativeGeoServiceProviderRequir
mapping_(QDeclarativeGeoServiceProvider::NoMappingFeatures),
routing_(QDeclarativeGeoServiceProvider::NoRoutingFeatures),
geocoding_(QDeclarativeGeoServiceProvider::NoGeocodingFeatures),
- places_(QDeclarativeGeoServiceProvider::NoPlacesFeatures)
+ places_(QDeclarativeGeoServiceProvider::NoPlacesFeatures),
+ navigation_(QDeclarativeGeoServiceProvider::NoNavigationFeatures)
{
}
@@ -769,6 +771,27 @@ void QDeclarativeGeoServiceProviderRequirements::setPlacesRequirements(const QDe
/*!
\internal
*/
+QDeclarativeGeoServiceProvider::NavigationFeatures QDeclarativeGeoServiceProviderRequirements::navigationRequirements() const
+{
+ return navigation_;
+}
+
+/*!
+ \internal
+*/
+void QDeclarativeGeoServiceProviderRequirements::setNavigationRequirements(const QDeclarativeGeoServiceProvider::NavigationFeatures &features)
+{
+ if (navigation_ == features)
+ return;
+
+ navigation_ = features;
+ emit navigationRequirementsChanged(navigation_);
+ emit requirementsChanged();
+}
+
+/*!
+ \internal
+*/
bool QDeclarativeGeoServiceProviderRequirements::matches(const QGeoServiceProvider *provider) const
{
QGeoServiceProvider::MappingFeatures mapping =
@@ -817,13 +840,25 @@ bool QDeclarativeGeoServiceProviderRequirements::matches(const QGeoServiceProvid
return false;
}
+ QGeoServiceProvider::NavigationFeatures navigation =
+ static_cast<QGeoServiceProvider::NavigationFeatures>(int(navigation_));
+
+ if (navigation == QGeoServiceProvider::AnyNavigationFeatures) {
+ if (provider->navigationFeatures() == QGeoServiceProvider::NoNavigationFeatures)
+ return false;
+ } else {
+ if ((provider->navigationFeatures() & navigation) != navigation)
+ return false;
+ }
+
return true;
}
bool QDeclarativeGeoServiceProviderRequirements::operator == (const QDeclarativeGeoServiceProviderRequirements &rhs) const
{
return (mapping_ == rhs.mapping_ && routing_ == rhs.routing_
- && geocoding_ == rhs.geocoding_ && places_ == rhs.places_);
+ && geocoding_ == rhs.geocoding_ && places_ == rhs.places_
+ && navigation_ == rhs.navigation_);
}
/*******************************************************************************
diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
index f6a663f3..3d5592c0 100644
--- a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
+++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
@@ -257,6 +257,9 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoServiceProviderRequirements : pub
Q_PROPERTY(QDeclarativeGeoServiceProvider::PlacesFeatures places
READ placesRequirements WRITE setPlacesRequirements
NOTIFY placesRequirementsChanged)
+ Q_PROPERTY(QDeclarativeGeoServiceProvider::NavigationFeatures navigation
+ READ navigationRequirements WRITE setNavigationRequirements
+ NOTIFY navigationRequirementsChanged)
public:
explicit QDeclarativeGeoServiceProviderRequirements(QObject *parent = 0);
@@ -274,6 +277,9 @@ public:
QDeclarativeGeoServiceProvider::PlacesFeatures placesRequirements() const;
void setPlacesRequirements(const QDeclarativeGeoServiceProvider::PlacesFeatures &features);
+ QDeclarativeGeoServiceProvider::NavigationFeatures navigationRequirements() const;
+ void setNavigationRequirements(const QDeclarativeGeoServiceProvider::NavigationFeatures &features);
+
Q_INVOKABLE bool matches(const QGeoServiceProvider *provider) const;
bool operator == (const QDeclarativeGeoServiceProviderRequirements &rhs) const;
@@ -283,6 +289,7 @@ Q_SIGNALS:
void routingRequirementsChanged(const QDeclarativeGeoServiceProvider::RoutingFeatures &features);
void geocodingRequirementsChanged(const QDeclarativeGeoServiceProvider::GeocodingFeatures &features);
void placesRequirementsChanged(const QDeclarativeGeoServiceProvider::PlacesFeatures &features);
+ void navigationRequirementsChanged(const QDeclarativeGeoServiceProvider::NavigationFeatures &features);
void requirementsChanged();
@@ -291,7 +298,7 @@ private:
QDeclarativeGeoServiceProvider::RoutingFeatures routing_;
QDeclarativeGeoServiceProvider::GeocodingFeatures geocoding_;
QDeclarativeGeoServiceProvider::PlacesFeatures places_;
-
+ QDeclarativeGeoServiceProvider::NavigationFeatures navigation_;
};
QT_END_NAMESPACE