summaryrefslogtreecommitdiffstats
path: root/app/qml/MapWindow.qml
diff options
context:
space:
mode:
Diffstat (limited to 'app/qml/MapWindow.qml')
-rw-r--r--app/qml/MapWindow.qml141
1 files changed, 107 insertions, 34 deletions
diff --git a/app/qml/MapWindow.qml b/app/qml/MapWindow.qml
index 8a41390..8321515 100644
--- a/app/qml/MapWindow.qml
+++ b/app/qml/MapWindow.qml
@@ -7,7 +7,7 @@ import com.mapbox.cheap_ruler 1.0
Item {
id: mapWindow
- property int disOffset: 70
+ property int disOffset: fileOperation.getCarSpeed() // set Km/h
property real rotateAngle: 0
property var startPoint
property var endPoint
@@ -29,28 +29,18 @@ Item {
name: "mapboxgl"
PluginParameter {
- name: "mapboxgl.mapping.items.insert_before"
- value: "road-label-small"
- }
-
- PluginParameter {
name: "mapboxgl.mapping.additional_style_urls"
- value: "mapbox://styles/mapbox/streets-v9"
+ value: fileOperation.getMapStyleUrls()
}
PluginParameter {
name: "mapboxgl.access_token"
value: fileOperation.getMapAccessToken()
}
-
- PluginParameter {
- name: "mapboxgl.mapping.cache.directory"
- value: "/home/0/app-data/navigation/"
- }
}
center: ruler.currentPosition
- zoomLevel: 20
+ zoomLevel: 18
tilt: 60
gesture.acceptedGestures:MapGestureArea.NoGesture
copyrightsVisible: false
@@ -166,7 +156,7 @@ Item {
CheapRuler {
id: ruler
- onCurrentDistanceChanged: {
+ /* onCurrentDistanceChanged: {
var total = 0;
var i = 0;
var alldistance = ruler.distance * 1000;
@@ -181,20 +171,21 @@ Item {
}
//show the tbt board(it will be always show when demo start)
- tbt_board.visible = true
+// tbt_board.visible = true
// Set turn instruction
tbt_board.do_setTurnInstructions(routeModel.get(0).segments[i].maneuver.instructionText)
- tbt_board.state = routeModel.get(0).segments[i].maneuver.direction
+// tbt_board.state = routeModel.get(0).segments[i].maneuver.direction
//when goto the last instruction,set the states to "arriveDest"
if(i >= (routeModel.get(0).segments.length-1))
{
total = alldistance;
- tbt_board.state = "arriveDest";
+// tbt_board.state = "arriveDest";
}
var dis = (total - ruler.currentDistance).toFixed(1);
+ console.log("tbtnavi:dis = " + dis)
// Set distance
tbt_board.do_setDistance(dis)
@@ -211,7 +202,7 @@ Item {
tbt_board.do_showTbtboard(false)
}
}
- }
+ }*/ //deleted
}
}
@@ -239,30 +230,91 @@ Item {
Component.onCompleted: {
//request the route info when map load finish
- if (ruler) {
- ruler.initRouteInfo();
- ruler.setCurrentPosition(fileOperation.getStartLatitude(), fileOperation.getStartLongitute());
- }
- }
+ console.log("Component.onCompleted")
+ }
//the functions can be called by outside
//add route signal function
- function do_addRoutePoint(poi_Lat_s, poi_Lon_s, poi_Lat_e, poi_Lon_e) {
- //set the startPoint and endPoint
- startPoint= QtPositioning.coordinate(poi_Lat_s,poi_Lon_s);
- endPoint = QtPositioning.coordinate(poi_Lat_e,poi_Lon_e);
+ function do_addRoutePoint(poi_Lat_s, poi_Lon_s, poi_Lat_e, poi_Lon_e,routes) {
+
+ var latitude = ""
+ var longitute = ""
+ //when current point is null
+ if((poi_Lat_s === "")
+ &&(poi_Lon_s === ""))
+ {
+ latitude = fileOperation.getStartLatitude()
+ longitute = fileOperation.getStartLongitute()
+ }
+ else
+ {
+ latitude = poi_Lat_s
+ longitute = poi_Lon_s
+ }
+
+ startPoint= QtPositioning.coordinate( latitude,longitute);
startMarker.coordinate = startPoint;
- endMarker.coordinate = endPoint;
- //update the route view
- if (map) {
- map.updateRoute();
+
+ if (ruler) {
+ console.log ("latitude:"+latitude+" longitute:"+longitute)
+ ruler.setCurrentCoordinate(latitude,longitute);
+ if((routes !== 0)
+ &&(poi_Lat_e !== "")
+ &&(poi_Lon_e !== ""))
+ {
+ endPoint = QtPositioning.coordinate(poi_Lat_e,poi_Lon_e);
+ endMarker.coordinate = endPoint;
+ //update the route view
+ if (map) {
+ map.updateRoute();
+ }
+ }
+ window.do_subscribe("gps")
+ window.do_subscribe("getdestdir")
+ window.do_subscribe("adddest")
+ window.do_subscribe("setdemopos")
+ window.do_subscribe("stopdemo")
+ window.do_subscribe("arrivedest")
}
}
//set the current position
- function do_setCoordinate(latitude,longitude,direction,distance) {
- ruler.setCurrentPosition(latitude, longitude);
- ruler.setCurrentDistance(distance);
+ function do_setCoordinate(latitude,longitude) {
+ ruler.setCurrentCoordinate(latitude, longitude);
+ }
+
+ function do_setDistance(distance) {
+ ruler.setCurrentDistance(distance);
+ }
+
+ function do_setNextCrossDistance(distance) {
+ var dis = distance;
+ console.log("tbtnavi:dis = " + dis)
+
+ // Set distance
+ tbt_board.do_setDistance(dis)
+
+ // Set board status
+ if((dis < mapWindow.disOffset) && (dis > 2))
+ {
+ //show the tbt board(the big one)
+ tbt_board.do_showTbtboard(false)
+ }
+ else
+ {
+ //disvisible the tbt board(the big one)
+ tbt_board.do_showTbtboard(false)
+ }
+ }
+
+ function do_setDirection(direction) {
+// ruler.setCurrentDistance(direction);
+ }
+
+ function do_setTbtState(tbtstate) {
+ //show the tbt board(it will be always show when demo start)
+ tbt_board.visible = true;
+ tbt_board.state = tbtstate;
}
//stop navidemo signal
@@ -280,4 +332,25 @@ Item {
//disvisible the tbt board
tbt_board.visible = false
}
+
+ //set the current position
+ function do_setdest(allroutes,latitude,longitude) {
+ if((allroutes !== 0)
+ &&(latitude !== "")
+ &&(longitude !== ""))
+ {
+ endPoint = QtPositioning.coordinate(latitude,longitude);
+ endMarker.coordinate = endPoint;
+
+ if (ruler) {
+ if(allroutes !== 0)
+ {
+ //update the route view
+ if (map) {
+ map.updateRoute();
+ }
+ }
+ }
+ }
+ }
}