diff options
author | Grigorii Zimin <gzimin@luxoft.com> | 2019-10-30 15:13:08 +0300 |
---|---|---|
committer | Grigorii Zimin <gzimin@luxoft.com> | 2019-10-30 14:20:55 +0000 |
commit | 32f996ef041e7fc8843dd5732af16ddb8ad4b2c8 (patch) | |
tree | 2ad3d38fc9c418ac6ac73d7288637acc8c610076 | |
parent | b729d6add6252f2e7ead0298ec69df4fcc0da6d8 (diff) |
[map] ICMapView reflects "demo_driving" state of MainView
Fixes: AUTOSUITE-1324
Change-Id: Iffe5b66194902eefa96f3907ea089036d11d185f
Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com>
-rw-r--r-- | apps/com.pelagicore.map/Main.qml | 12 | ||||
-rw-r--r-- | apps/com.pelagicore.map/views/ICMapView.qml | 75 |
2 files changed, 87 insertions, 0 deletions
diff --git a/apps/com.pelagicore.map/Main.qml b/apps/com.pelagicore.map/Main.qml index 863ea4f0..8713165a 100644 --- a/apps/com.pelagicore.map/Main.qml +++ b/apps/com.pelagicore.map/Main.qml @@ -138,6 +138,18 @@ QtObject { activeMapType: Style.theme === Style.Light ? mainMap.store.getMapType(icMapView.mapReady, mainMap.store.defaultLightThemeId) : mainMap.store.getMapType(icMapView.mapReady, mainMap.store.defaultDarkThemeId); + + Connections { + target: mainMap.store + onNavigationDemoActiveChanged: { + if (mainMap.store.navigationDemoActive) { + icMapView.path = mainMap.store.routeModel.get(0).path; + icMapView.state = "demo_driving"; + } else { + icMapView.state = "initial"; + } + } + } } } } diff --git a/apps/com.pelagicore.map/views/ICMapView.qml b/apps/com.pelagicore.map/views/ICMapView.qml index 400a900f..eb96825d 100644 --- a/apps/com.pelagicore.map/views/ICMapView.qml +++ b/apps/com.pelagicore.map/views/ICMapView.qml @@ -34,6 +34,8 @@ import QtQuick 2.10 import QtLocation 5.9 import shared.animations 1.0 +import shared.Style 1.0 +import shared.Sizes 1.0 Item { id: root @@ -44,8 +46,51 @@ Item { property alias mapBearing: mainMap.bearing property alias mapReady: mainMap.mapReady property alias activeMapType: mainMap.activeMapType + property var path property var mapPlugin + state: "initial" + states: [ + State { + // just a map w/o any additional items in it + name: "initial" + PropertyChanges { + target: posMarker + coordinate: QtPositioning.coordinate() + rotation: 0.0 + visible: false + } + PropertyChanges { + target: destMarker + visible: false + coordinate: QtPositioning.coordinate() + } + PropertyChanges { + target: pathView + visible: false + path: [] + } + }, + State { + name: "demo_driving" + PropertyChanges { + target: posMarker + coordinate: root.mapCenter + rotation: 0.0 + visible: true + } + PropertyChanges { + target: destMarker + visible: true + coordinate: root.path[root.path.length - 1] + } + PropertyChanges { + target: pathView + visible: true + path: root.path + } + } + ] Map { id: mainMap anchors.fill: parent @@ -54,5 +99,35 @@ Item { zoomLevel: 10 plugin: root.mapPlugin copyrightsVisible: false + + MapPolyline { + id: pathView + line.color: Style.accentColor + line.width: Sizes.dp(8) + smooth: true + opacity: Style.opacityHigh + } + + MapQuickItem { + id: destMarker + anchorPoint: Qt.point(markerImage.width * 0.5, markerImage.height * 0.8) + sourceItem: Image { + id: markerImage + source: Qt.resolvedUrl("../assets/pin-destination.png") + width: Sizes.dp(139/2) + height: Sizes.dp(161/2) + } + } + + MapQuickItem { + id: posMarker + anchorPoint: Qt.point(posImage.width * 0.5, posImage.height * 0.5) + sourceItem: Image { + id: posImage + source: Qt.resolvedUrl("../assets/pin-your-position.png") + width: Sizes.dp(116/2) + height: Sizes.dp(135/2) + } + } } } |