2017-07-16 23:04:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2017-07-14 14:53:08 +00:00
|
|
|
import QtQuick 2.0
|
|
|
|
import QtLocation 5.3
|
|
|
|
import QtPositioning 5.3
|
2017-07-16 00:01:54 +00:00
|
|
|
import org.subsurfacedivelog.mobile 1.0
|
2017-07-14 14:53:08 +00:00
|
|
|
|
2017-07-14 21:55:29 +00:00
|
|
|
Item {
|
2017-07-19 21:09:53 +00:00
|
|
|
readonly property var esriMapTypeIndexes: { "STREET": 0, "SATELLITE": 1 }
|
2017-07-15 21:56:54 +00:00
|
|
|
|
2017-07-14 14:53:08 +00:00
|
|
|
Plugin {
|
|
|
|
id: mapPlugin
|
|
|
|
name: "esri"
|
|
|
|
}
|
|
|
|
|
2017-07-16 00:01:54 +00:00
|
|
|
MapWidgetHelper {
|
|
|
|
id: mapHelper
|
2017-07-16 20:59:09 +00:00
|
|
|
map: map
|
2017-07-16 00:01:54 +00:00
|
|
|
}
|
|
|
|
|
2017-07-14 14:53:08 +00:00
|
|
|
Map {
|
2017-07-15 21:56:54 +00:00
|
|
|
id: map
|
2017-07-14 14:53:08 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
plugin: mapPlugin
|
|
|
|
zoomLevel: 1
|
2017-07-15 21:56:54 +00:00
|
|
|
|
2017-07-19 21:09:53 +00:00
|
|
|
readonly property var defaultCenter: QtPositioning.coordinate(0, 0)
|
|
|
|
readonly property var defaultZoomIn: 17.0
|
|
|
|
property var newCenter: defaultCenter
|
|
|
|
property var newZoom: 1.0
|
2017-07-16 22:16:27 +00:00
|
|
|
|
2017-07-15 21:56:54 +00:00
|
|
|
Component.onCompleted: {
|
2017-07-19 21:09:53 +00:00
|
|
|
map.activeMapType = map.supportedMapTypes[esriMapTypeIndexes.SATELLITE]
|
2017-07-15 21:56:54 +00:00
|
|
|
}
|
2017-07-16 21:25:19 +00:00
|
|
|
|
2017-07-17 19:24:30 +00:00
|
|
|
MapItemView {
|
|
|
|
id: mapItemView
|
|
|
|
model: mapHelper.model
|
|
|
|
delegate: MapQuickItem {
|
|
|
|
anchorPoint.x: 0
|
|
|
|
anchorPoint.y: mapItemImage.height
|
2017-07-17 19:36:55 +00:00
|
|
|
coordinate: model.coordinate
|
2017-07-19 20:51:39 +00:00
|
|
|
z: mapHelper.model.selectedUuid === model.uuid ? mapHelper.model.count - 1 : 0
|
2017-07-18 23:36:59 +00:00
|
|
|
sourceItem: Image {
|
2017-07-19 21:09:53 +00:00
|
|
|
id: mapItemImage
|
|
|
|
source: "qrc:///mapwidget-marker" + (mapHelper.model.selectedUuid === model.uuid ? "-selected" : "")
|
2017-07-19 21:06:08 +00:00
|
|
|
|
|
|
|
SequentialAnimation {
|
2017-07-19 21:09:53 +00:00
|
|
|
id: mapItemImageAnimation
|
2017-07-19 21:06:08 +00:00
|
|
|
PropertyAnimation {
|
|
|
|
target: mapItemImage; property: "scale"; from: 1.0; to: 0.7; duration: 120;
|
|
|
|
}
|
|
|
|
PropertyAnimation {
|
|
|
|
target: mapItemImage; property: "scale"; from: 0.7; to: 1.0; duration: 80;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onSourceChanged: {
|
|
|
|
if (mapHelper.model.selectedUuid === model.uuid)
|
2017-07-19 21:09:53 +00:00
|
|
|
mapItemImageAnimation.restart()
|
2017-07-19 21:06:08 +00:00
|
|
|
}
|
2017-07-18 23:36:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
|
|
|
mapHelper.model.selectedUuid = model.uuid
|
|
|
|
}
|
|
|
|
}
|
2017-07-17 19:24:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-16 22:16:27 +00:00
|
|
|
ParallelAnimation {
|
|
|
|
id: mapAnimation
|
|
|
|
CoordinateAnimation {
|
|
|
|
target: map
|
|
|
|
property: "center"
|
|
|
|
to: map.newCenter
|
|
|
|
duration: 2000
|
|
|
|
}
|
|
|
|
NumberAnimation {
|
|
|
|
target: map
|
|
|
|
property: "zoomLevel"
|
|
|
|
to: 17
|
|
|
|
duration: 3000
|
|
|
|
easing.type: Easing.InCubic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-19 00:06:40 +00:00
|
|
|
function centerOnMapLocation(mapLocation) {
|
2017-07-19 21:09:53 +00:00
|
|
|
map.newCenter = mapLocation.coordinate
|
|
|
|
map.zoomLevel = 2
|
|
|
|
mapAnimation.restart()
|
|
|
|
mapHelper.model.selectedUuid = mapLocation.uuid
|
2017-07-16 21:25:19 +00:00
|
|
|
}
|
2017-07-14 14:53:08 +00:00
|
|
|
}
|
|
|
|
}
|