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-15 21:56:54 +00:00
|
|
|
|
|
|
|
readonly property var esriMapTypeIndexes: { "STREET": 0, "SATELLITE": 1 };
|
|
|
|
|
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-16 22:16:27 +00:00
|
|
|
property var newCenter: QtPositioning.coordinate(0, 0);
|
|
|
|
|
2017-07-15 21:56:54 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
map.activeMapType = map.supportedMapTypes[esriMapTypeIndexes.SATELLITE];
|
|
|
|
}
|
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-18 23:36:59 +00:00
|
|
|
sourceItem: Image {
|
|
|
|
id: mapItemImage;
|
|
|
|
source: "qrc:///mapwidget-marker" + (mapHelper.model.selectedUuid === model.uuid ? "-selected" : "");
|
|
|
|
}
|
|
|
|
|
|
|
|
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-17 20:13:31 +00:00
|
|
|
function centerOnCoordinate(coordinate) {
|
|
|
|
map.newCenter = coordinate;
|
2017-07-16 22:16:27 +00:00
|
|
|
map.zoomLevel = 2;
|
|
|
|
mapAnimation.restart();
|
2017-07-16 21:25:19 +00:00
|
|
|
}
|
2017-07-14 14:53:08 +00:00
|
|
|
}
|
|
|
|
}
|