diff options
author | Arseniy Movshev <dodoradio@outlook.com> | 2022-11-12 23:10:12 +0000 |
---|---|---|
committer | Arseniy Movshev <dodoradio@outlook.com> | 2023-01-07 14:51:55 +0000 |
commit | d6bd9347a59df2808676a549ba81df12ecfc2d3d (patch) | |
tree | 9dc492b917a3e7ff47e97d24b43bff698816f6c8 | |
parent | 6161b765b5a2b64717de06b6f26bb7c2cf76d3d8 (diff) |
Work on adding gui for dropping pins
Continue work on waypoint dialog
Add experimental method of saving map positions
Diffstat (limited to '')
-rw-r--r-- | src/DefaultMapControls.qml | 57 | ||||
-rw-r--r-- | src/MainMapView.qml | 69 | ||||
-rw-r--r-- | src/SetPointMapControls.qml | 67 | ||||
-rw-r--r-- | src/SetPointPage.qml | 96 | ||||
-rw-r--r-- | src/SettingsPage.qml | 5 | ||||
-rw-r--r-- | src/main.qml | 17 | ||||
-rw-r--r-- | src/resources.qrc | 3 |
7 files changed, 273 insertions, 41 deletions
diff --git a/src/DefaultMapControls.qml b/src/DefaultMapControls.qml new file mode 100644 index 0000000..b6a35de --- /dev/null +++ b/src/DefaultMapControls.qml @@ -0,0 +1,57 @@ +import QtQuick 2.0 +import org.asteroid.controls 1.0 + +Item { + IconButton { + iconName: "ios-add-circle-outline" + anchors.right: parent.right + anchors.bottom: parent.verticalCenter + height: parent.height*0.2 + width: height + iconColor: "blue" + z: 2 + onClicked: mapView.zoomLevel = mapView.zoomLevel + 0.3 + } + IconButton { + iconName: "ios-remove-circle-outline" + anchors.right: parent.right + anchors.top: parent.verticalCenter + height: parent.height*0.2 + width: height + iconColor: "blue" + z: 2 + onClicked: mapView.zoomLevel = mapView.zoomLevel - 0.3 + } + IconButton { + iconName: "ios-locate-outline" + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + height: parent.height*0.2 + width: height + iconColor: "blue" + z: 2 + } + IconButton { + iconName: "ios-menu-outline" + anchors.bottom: parent.bottom + anchors.right: parent.horizontalCenter + height: parent.height*0.2 + width: height + iconColor: "blue" + z: 2 + onClicked: pageStack.push(settingsPage,{}) + } + IconButton { + iconName: "ios-pin-outline" + anchors.bottom: parent.bottom + anchors.left: parent.horizontalCenter + height: parent.height*0.2 + width: height + iconColor: "blue" + z: 2 + onClicked: { + parent.visible = false + setPointControls.visible = true + } + } +} diff --git a/src/MainMapView.qml b/src/MainMapView.qml index 7b81b45..39a4b8e 100644 --- a/src/MainMapView.qml +++ b/src/MainMapView.qml @@ -1,9 +1,25 @@ import QtQuick 2.0 import org.asteroid.controls 1.0 +import Nemo.Configuration 1.0 import QtPositioning 5.15 import QtLocation 5.15 Item { + ConfigurationValue { + id: mapZoom + key: "/map/zoomlevel" + defaultValue: 3.4 + } + ConfigurationValue { + id: mapCenterLat + key: "/map/location/lat" + defaultValue: 0 + } + ConfigurationValue { + id: mapCenterLong + key: "/map/location/long" + defaultValue: 0 + } Label { text: "Map Data from OpenStreetMap" font.pixelSize: parent.width*0.02 @@ -17,44 +33,27 @@ Item { copyrightsVisible: false //this is compensated by showing the copyright when application is loading color: "#00000000" z: 1 + Component.onCompleted: { zoomLevel = mapZoom.value; center.latitude = mapCenterLat.value; center.longitude = mapCenterLong.value; console.log(mapCenterLat.value,mapCenterLong.value)} + onZoomLevelChanged: mapZoom.value = zoomLevel + onCenterChanged: {mapCenterLat.value = center.latitude; mapCenterLong.value = center.longitude; console.log(center)} } - IconButton { - iconName: "ios-add-circle-outline" - anchors.right: parent.right - anchors.bottom: parent.verticalCenter - height: parent.height*0.2 - width: height - iconColor: "blue" - z: 2 - onClicked: mapView.zoomLevel = mapView.zoomLevel + 0.3 - } - IconButton { - iconName: "ios-remove-circle-outline" - anchors.right: parent.right - anchors.top: parent.verticalCenter - height: parent.height*0.2 - width: height - iconColor: "blue" - z: 2 - onClicked: mapView.zoomLevel = mapView.zoomLevel - 0.3 - } - IconButton { - iconName: "ios-locate-outline" - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - height: parent.height*0.2 - width: height - iconColor: "blue" + DefaultMapControls { + id: mapControls + anchors.fill: parent z: 2 } - IconButton { - iconName: "ios-menu-outline" - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - height: parent.height*0.2 - width: height - iconColor: "blue" + SetPointMapControls { + id: setPointControls + anchors.fill: parent + visible: false z: 2 - onClicked: pageStack.push(settingsPage,{}) + function primaryButtonAction() { + pageStack.push(setPointPage,{coord: mapView.center}) + } + } + Component { + id: setPointPage + SetPointPage { + } } } diff --git a/src/SetPointMapControls.qml b/src/SetPointMapControls.qml new file mode 100644 index 0000000..8423ea7 --- /dev/null +++ b/src/SetPointMapControls.qml @@ -0,0 +1,67 @@ +import QtQuick 2.0 +import org.asteroid.controls 1.0 + +Item { + PageHeader { + text: "Add waypoint" + } + IconButton { + iconName: "ios-add-circle-outline" + anchors.right: parent.right + anchors.bottom: parent.verticalCenter + height: parent.height*0.2 + width: height + iconColor: "blue" + z: 2 + onClicked: mapView.zoomLevel = mapView.zoomLevel + 0.3 + } + IconButton { + iconName: "ios-remove-circle-outline" + anchors.right: parent.right + anchors.top: parent.verticalCenter + height: parent.height*0.2 + width: height + iconColor: "blue" + z: 2 + onClicked: mapView.zoomLevel = mapView.zoomLevel - 0.3 + } + IconButton { + iconName: "ios-locate-outline" + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + height: parent.height*0.2 + width: height + iconColor: "blue" + z: 2 + } + IconButton { + iconName: "ios-close-circle-outline" + anchors.bottom: parent.bottom + anchors.right: parent.horizontalCenter + height: parent.height*0.2 + width: height + iconColor: "blue" + z: 2 + onClicked: { + parent.visible = false + mapControls.visible = true + } + } + IconButton { + iconName: "ios-checkmark-circle-outline" + anchors.bottom: parent.bottom + anchors.left: parent.horizontalCenter + height: parent.height*0.2 + width: height + iconColor: "blue" + z: 2 + onClicked: primaryButtonAction() + } + Icon { + anchors.centerIn: parent + width: parent.width*0.1 + height: width + name: "ios-add" + color: "blue" + } +} diff --git a/src/SetPointPage.qml b/src/SetPointPage.qml new file mode 100644 index 0000000..50643b0 --- /dev/null +++ b/src/SetPointPage.qml @@ -0,0 +1,96 @@ +import QtQuick 2.0 +import org.asteroid.controls 1.0 as Asteroid +import QtPositioning 5.15 +import QtLocation 5.15 +import Nemo.Configuration 1.0 + +Item { + id: root + // FlatMesh { + // centerColor: "#003ee9" + // outerColor: "#00bc1b" + // anchors.fill: parent + // } + Asteroid.PageHeader { + text: "Add waypoint" + } + ConfigurationValue { + id: waypointList + key: "/map/waypointList" + defaultValue: "" + } + property string selectedIcon: "ios-locate-outline" + property variant coord + Flickable { + anchors.fill: parent + contentHeight: contentColumn.implicitHeight + anchors.leftMargin: root.width*0.15 + anchors.rightMargin: root.width*0.15 + Column { + id: contentColumn + anchors.fill: parent + Asteroid.TextField { + id: textBox + width: parent.width + height: parent.width*0.2 + //for the default text, we probably want a date/time + previewText: "Waypoint name" + text: Date().toLocaleString(Locale.ShortFormat) + } + ListView { + id: iconSelectorView + width: parent.width + height: width*0.2 + orientation: ListView.Horizontal + model: iconModel + delegate: Asteroid.IconButton { + iconName: name + onClicked: root.selectedIcon = model.name + height: iconSelectorView.height + width: height + iconColor: root.selectedIcon == model.name ? colours.primary : colours.primaryUnselected + } + ListModel { + id: iconModel + ListElement { + name: "ios-locate-outline" + } + ListElement { + name: "ios-checkmark" + } + ListElement { + name: "ios-help" + } + ListElement { + name: "ios-information" + } + ListElement { + name: "ios-body-outline" + } + ListElement { + name: "ios-bicycle" + } + ListElement { + name: "ios-car-outline" + } + ListElement { + name: "ios-boat-outline" + } + } + } + Asteroid.IconButton { + width: parent.width*0.2 + height: width + iconName: "ios-checkmark-circle-outline" + anchors.horizontalCenter: parent.horizontalCenter + onClicked: appendWayPoint() + } + } + } + + function appendWayPoint() { //the colours.primary is currently a placeholder. it would be nice to let users select colours, but I CBA to write a colour picker right now. + var newWayPointString = ">" + "selectedIcon" + ";" + coord + ";" + colours.primary + ";" + textBox.text + ";" + Date() + console.log(newWayPointString) + pageStack.pop() + } +} diff --git a/src/SettingsPage.qml b/src/SettingsPage.qml index 189ebe4..6ff5da3 100644 --- a/src/SettingsPage.qml +++ b/src/SettingsPage.qml @@ -5,6 +5,11 @@ import QtLocation 5.15 Item { id: root + // FlatMesh { + // centerColor: "#003ee9" + // outerColor: "#00bc1b" + // anchors.fill: parent + // } PageHeader { text: "Map settings" } diff --git a/src/main.qml b/src/main.qml index f04edb4..12ca9de 100644 --- a/src/main.qml +++ b/src/main.qml @@ -4,11 +4,15 @@ import QtPositioning 5.15 import QtLocation 5.15 Application { - id: app - - centerColor: "#003ee9" + centerColor: "#6e90e9" outerColor: "#00bc1b" + id: app + Item { + id: colours + property string primary: "#0056d7" + property string primaryUnselected: "#3274d7" + } Plugin { id: mapProvider name: "osm" @@ -16,12 +20,13 @@ Application { LayerStack { id: pageStack anchors.fill: parent - firstPage: mainmapview + firstPage: mainMapView } Component { - id: mainmapview - MainMapView {} + id: mainMapView + MainMapView { + } } Component { id: settingsPage diff --git a/src/resources.qrc b/src/resources.qrc index 66c9640..0984a2c 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -1,7 +1,10 @@ <RCC> <qresource prefix="/"> <file>main.qml</file> + <file>DefaultMapControls.qml</file> <file>MainMapView.qml</file> + <file>SetPointMapControls.qml</file> + <file>SetPointPage.qml</file> <file>SettingsPage.qml</file> </qresource> </RCC> |