-
Notifications
You must be signed in to change notification settings - Fork 1
/
Navigation.qml
99 lines (81 loc) · 2.16 KB
/
Navigation.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import QtQuick 2.12
import QtLocation 5.12
import QtPositioning 5.12
Item {
id: naviFrame
visible: true
property real naviTilt: 30
property real zoom: 16.0
property real carPositionX: 40.755
property real carPositionY: -73.995
Plugin {
id: mapboxglPlugin
name: "mapboxgl"
PluginParameter {
name: "mapboxgl.access_token"
value: "pk.eyJ1Ijoib2xld2FuZG93c2tpMiIsImEiOiJjampqdnQ4MWIwdzlnM2ttZGVqcnYza2xvIn0.ni1y0Hj_mm8B0YYfX3BW9g"
}
PluginParameter {
name: "mapboxgl.mapping.cache.size"
value: 2000
}
PluginParameter {
name: "mapboxgl.mapping.additional_style_urls"
value: "mapbox://styles/olewandowski2/cjrakjdzm2jf12sp9rdgwncmh"
//value: "mapbox://styles/olewandowski2/cjn5sohnz0nr42suv510nrw4l"
//value: "mapbox://styles/olewandowski2/cjrp872n3bo7i2slfyx8jlv75"
}
}
MapQuickItem {
id: car
visible: studio3d.inMap && map.mapReady
anchorPoint.x: image.width *2 / 3
anchorPoint.y: image.height/2
// zoomLevel: map.zoomLevel
sourceItem: Image {
id: image
source: "car.png"
height: sourceSize.height / 2
}
}
Map {
id: map
anchors.fill: parent
plugin: mapboxglPlugin
center: QtPositioning.coordinate(carPositionX, carPositionY)
zoomLevel: zoom
bearing: 30
tilt: naviTilt
Component.onCompleted: {
if (map.mapReady) map.addMapItem(car)
}
}
Binding { target: car; property: "coordinate"; value: map.center }
function tiltIn()
{
if(naviTilt<89.5)
naviTilt+=0.1
}
function zoomIn()
{
if(zoom < 17.0)
zoom+=0.001
}
function moveCamera()
{
carPositionX += 0.000007
carPositionY += 0.000005
}
Timer {
id: navigtionLoop
interval: 16
repeat: true
running: true
triggeredOnStart: true
onTriggered: {
tiltIn()
zoomIn()
moveCamera()
}
}
}