summaryrefslogtreecommitdiff
path: root/src/MainMapView.qml
blob: 39a4b8e3d4355fda5db07282223d4ba4c7e26089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
        anchors.centerIn: parent
        z: 0
    }
    Map {
        id: mapView
        plugin: mapProvider
        anchors.fill: parent
        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)}
    }
    DefaultMapControls {
        id: mapControls
        anchors.fill: parent
        z: 2
    }
    SetPointMapControls {
        id: setPointControls
        anchors.fill: parent
        visible: false
        z: 2
        function primaryButtonAction() {
             pageStack.push(setPointPage,{coord: mapView.center})
        }
    }
    Component {
        id: setPointPage
        SetPointPage {
        }
    }
}