From 7ea071f08abbe9bcc34d6fe4a84219c082885088 Mon Sep 17 00:00:00 2001 From: janbar Date: Fri, 13 Oct 2023 09:42:31 +0200 Subject: [PATCH] add option to search around pinned place --- gui/controls2_509/MapView.qml | 43 +++++++++++++++++++++++++++++++++++ gui/controls2_515/MapView.qml | 43 +++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/gui/controls2_509/MapView.qml b/gui/controls2_509/MapView.qml index 1c8f3aa9..8dfcfccc 100644 --- a/gui/controls2_509/MapView.qml +++ b/gui/controls2_509/MapView.qml @@ -227,6 +227,7 @@ MapPage { }, State { name: "locationInfo" + PropertyChanges { target: searchAroundPlace; visible: true; } PropertyChanges { target: addFavorite; visible: true; } PropertyChanges { target: goThere; visible: true; } }, @@ -586,6 +587,48 @@ MapPage { } } } + // Search around place. The button is visible in state 'locationInfo' + MapIcon { + id: searchAroundPlace + visible: false + z: 1 + anchors.bottom: parent.bottom + anchors.left: addFavorite.right + anchors.margins: units.gu(1) + source: "qrc:/images/trip/search.svg" + color: "black" + backgroundColor: "white" + borderPadding: units.gu(1.0) + opacity: 0.7 + height: units.gu(6) + onClicked: { + var page = stackView.push("qrc:/controls2/SearchPlace.qml", { + "searchCenterLat": popLocationInfo.placeLat, + "searchCenterLon": popLocationInfo.placeLon, + "acceptLabel": qsTr("Go"), + "acceptIcon" : "qrc:/images/trip/navigator.svg", + "showPositionEnabled": true + }); + ToolBox.connectOnce(page.selectLocation, function(location, lat, lon, label){ + if (lat !== NaN && lon !== NaN && label !== "") { + popRouting.goTo(lat, lon, label); + } + }); + ToolBox.connectOnce(page.showPosition, function(lat, lon){ + if (lat !== NaN && lon !== NaN) { + map.showCoordinatesInstantly(lat, lon); + mark.showOverlay = true; + mark.lat = lat; + mark.lon = lon; + mark.screenX = map.width / 2; + mark.screenY = map.height / 2; + if (navigation) + navigation = false; + popLocationInfo.show(); + } + }); + } + } //////////////////////////////////////////////////////////////////////////// diff --git a/gui/controls2_515/MapView.qml b/gui/controls2_515/MapView.qml index b346f725..e42bd2dd 100644 --- a/gui/controls2_515/MapView.qml +++ b/gui/controls2_515/MapView.qml @@ -227,6 +227,7 @@ MapPage { }, State { name: "locationInfo" + PropertyChanges { target: searchAroundPlace; visible: true; } PropertyChanges { target: addFavorite; visible: true; } PropertyChanges { target: goThere; visible: true; } }, @@ -586,6 +587,48 @@ MapPage { } } } + // Search around place. The button is visible in state 'locationInfo' + MapIcon { + id: searchAroundPlace + visible: false + z: 1 + anchors.bottom: parent.bottom + anchors.left: addFavorite.right + anchors.margins: units.gu(1) + source: "qrc:/images/trip/search.svg" + color: "black" + backgroundColor: "white" + borderPadding: units.gu(1.0) + opacity: 0.7 + height: units.gu(6) + onClicked: { + var page = stackView.push("qrc:/controls2/SearchPlace.qml", { + "searchCenterLat": popLocationInfo.placeLat, + "searchCenterLon": popLocationInfo.placeLon, + "acceptLabel": qsTr("Go"), + "acceptIcon" : "qrc:/images/trip/navigator.svg", + "showPositionEnabled": true + }); + ToolBox.connectOnce(page.selectLocation, function(location, lat, lon, label){ + if (lat !== NaN && lon !== NaN && label !== "") { + popRouting.goTo(lat, lon, label); + } + }); + ToolBox.connectOnce(page.showPosition, function(lat, lon){ + if (lat !== NaN && lon !== NaN) { + map.showCoordinatesInstantly(lat, lon); + mark.showOverlay = true; + mark.lat = lat; + mark.lon = lon; + mark.screenX = map.width / 2; + mark.screenY = map.height / 2; + if (navigation) + navigation = false; + popLocationInfo.show(); + } + }); + } + } ////////////////////////////////////////////////////////////////////////////