From b4364919e5a74325812f2f527adbfe62a165109e Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Sun, 22 Sep 2019 20:38:07 -0700 Subject: qml: allow map plugins to be set on runtime Allow selection of OSM over MapBox with enableOSM configuration file option. Bug-AGL: SPEC-2667 Change-Id: Ie055ca1263b0a6f2a74046e5ff85535e48e60d31 Signed-off-by: Matt Ranostay --- app/navigation.qml | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'app/navigation.qml') diff --git a/app/navigation.qml b/app/navigation.qml index c4eba78..de08bf6 100644 --- a/app/navigation.qml +++ b/app/navigation.qml @@ -39,6 +39,23 @@ ApplicationWindow { property real positionTimer_interval : fileOperation.getUpdateInterval() // set millisecond property real car_moving_distance : (car_driving_speed / 3.6) / (1000/positionTimer_interval) // Metric unit + Plugin { + id: mapbox + name: "mapbox" + PluginParameter { + name: "mapbox.access_token"; + value: fileOperation.getMapAccessToken() + } + } + Plugin { + id: osm + name: "osm" + PluginParameter { + name: "osm.mapping.host"; + value: "https://a.tile.openstreetmap.org/" + } + } + Map{ id: map property int pathcounter : 0 @@ -60,11 +77,7 @@ ApplicationWindow { width: parent.width height: parent.height - plugin: Plugin { - name: "mapbox" - PluginParameter { name: "mapbox.access_token"; - value: fileOperation.getMapAccessToken() } - } + plugin: fileOperation.isOSMEnabled() ? osm : mapbox center: QtPositioning.coordinate(car_position_lat, car_position_lon) zoomLevel: default_zoom_level bearing: 0 @@ -214,12 +227,7 @@ ApplicationWindow { RouteModel { id: routeModel objectName: "routeModel" - plugin : Plugin { - name: "mapbox" - PluginParameter { name: "mapbox.access_token"; - value: fileOperation.getMapAccessToken() - } - } + plugin: map.plugin query: RouteQuery { id: routeQuery } -- cgit 1.2.3-korg