-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamapviewer.qml
72 lines (62 loc) · 2.26 KB
/
amapviewer.qml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
import QtQuick 2.0
import QtQuick.Window 2.0
import QtLocation 5.6
import QtPositioning 5.6
//https://books.google.nl/books?id=hvBZDwAAQBAJ&pg=PA190&lpg=PA190&dq=QGeoServiceProvider+.pro&source=bl&ots=rPcVXaaZ3Q&sig=ACfU3U1SkQ8B0QIUESliep_cZAnPAtaieg&hl=nl&sa=X&ved=2ahUKEwivv8708OrmAhUSUlAKHcf4D1UQ6AEwAXoECAoQAQ#v=onepage&q=QGeoServiceProvider%20.pro&f=false
Item {
width: 512
height: 350
visible: true
// anchors.fill: parent
id: window
Plugin {
id: mapPlugin
name: "esri" // "mapboxgl", "esri", ...osm
// specify plugin parameters if necessary
// PluginParameter {
// name:
// value:
// }
PluginParameter
{
name: "osm.mapping.host"
value: "https://a.tile.openstreetmap.org"
}
PluginParameter { name: "osm.useragent"; value: "My great Qt OSM application" }
// PluginParameter { name: "osm.mapping.host"; value: "http://osm.tile.server.address/" }
PluginParameter { name: "osm.mapping.copyright"; value: "All mine" }
// PluginParameter { name: "osm.routing.host"; value: "http://osrm.server.address/viaroute" }
// PluginParameter { name: "osm.geocoding.host"; value: "http://geocoding.server.address" }
}
Map {
id: map
anchors.fill: parent
plugin: mapPlugin
// center: QtPositioning.coordinate(59.91, 10.75) // Oslo
zoomLevel: 14
// Component.onCompleted:
// {
// addMarker("ewoud", 59.91, 10.75)
// }
}
function clearMapItems()
{
map.clearMapItems()
}
function addMarker(name, latitude, longitude)
{
var component = Qt.createComponent("qrc:/amarker.qml")
var item = component.createObject(window, {coordinate: QtPositioning.coordinate(latitude, longitude), labelText:name})
map.addMapItem(item)
}
function center(latitude, longitude)
{
map.center = QtPositioning.coordinate(latitude, longitude)
}
function fitViewportToMapItems()
{
map.fitViewportToMapItems()
if (map.zoomLevel > 14)
map.zoomLevel = 14
}
}