/* * Copyright (C) 2016 The Qt Company Ltd. * Copyright (C) 2019 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import QtQuick 2.6 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 import QtWebSockets 1.0 import QtLocation 5.9 import QtPositioning 5.6 import QtQuick.Window 2.11 ApplicationWindow { id: root visible: true width: Window.width height: Window.height title: qsTr("navigation") property real car_position_lat: fileOperation.getStartLatitude() property real car_position_lon: fileOperation.getStartLongitude() property real car_direction: 0 //North property real car_driving_speed: fileOperation.getCarSpeed() // set Km/h property bool st_heading_up: false property real default_zoom_level : 18 property real default_car_direction : 0 property real car_accumulated_distance : 0 property real positionTimer_interval : fileOperation.getUpdateInterval() // set millisecond property real car_moving_distance : (car_driving_speed / 3.6) / (1000/positionTimer_interval) // Metric unit Plugin { id: mapbox name: "mapbox" PluginParameter { name: "mapbox.access_token"; value: fileOperation.getMapAccessToken() } PluginParameter { name: "mapbox.mapping.additional_map_ids" value: fileOperation.getMapStyleUrls() } PluginParameter { name: "mapbox.mapping.cache.directory" value: fileOperation.getCachePath("mapbox") } } Plugin { id: osm name: "osm" PluginParameter { name: "osm.mapping.host"; value: "https://a.tile.openstreetmap.org/" } PluginParameter { name: "osm.mapping.cache.directory" value: fileOperation.getCachePath("osm") } } Connections { target: navigation onWaypointsEvent: { // only support one waypoint currently map.doSetWaypointsSlot(data.points[0].latitude, data.points[0].longitude, true) } onStatusEvent: { if (data.state == "stop") { // Slight hack here, if sts_guide != 0, btn_guidance.discardWaypoints // will trigger another stop, which can cancel a queued waypoint set, // so set it to 0 in advance. btn_guidance.sts_guide = 0 map.doPauseSimulationSlot() } if (data.state == "start") { btn_guidance.startGuidance() } } } Map { id: map property int pathcounter : 0 property int segmentcounter : 0 property int waypoint_count: -1 property int lastX : -1 property int lastY : -1 property int pressX : -1 property int pressY : -1 property int jitterThreshold : 30 property variant currentpostion : QtPositioning.coordinate(car_position_lat, car_position_lon) property int last_segmentcounter : -1 width: parent.width height: parent.height plugin: fileOperation.isOSMEnabled() ? osm : mapbox center: QtPositioning.coordinate(car_position_lat, car_position_lon) zoomLevel: default_zoom_level bearing: 0 objectName: "map" GeocodeModel { id: geocodeModel plugin: map.plugin onStatusChanged: { if ((status == GeocodeModel.Ready) || (status == GeocodeModel.Error)) map.geocodeFinished() } onLocationsChanged: { if (count == 1) { map.center.latitude = get(0).coordinate.latitude map.center.longitude = get(0).coordinate.longitude } } } MapItemView { model: geocodeModel delegate: pointDelegate } Component { id: pointDelegate MapCircle { id: point radius: 1000 color: "#46a2da" border.color: "#190a33" border.width: 2 smooth: true opacity: 0.25 center: locationData.coordinate } } function geocode(fromAddress) { // send the geocode request geocodeModel.query = fromAddress geocodeModel.update() } MapQuickItem { id: poi sourceItem: Rectangle { width: 14; height: 14; color: "#e41e25"; border.width: 2; border.color: "white"; smooth: true; radius: 7 } coordinate { latitude: 36.136261 longitude: -115.151254 } opacity: 1.0 anchorPoint: Qt.point(sourceItem.width/2, sourceItem.height/2) } MapQuickItem { sourceItem: Text{ text: "Westgate" color:"#242424" font.bold: true styleColor: "#ECECEC"
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <remote fetch="https://gerrit.automotivelinux.org/gerrit/" name="agl" pushurl="ssh://gerrit.automotivelinux.org:29418" review="https://gerrit.automotivelinux.org/gerrit/"/>
  <remote fetch="https://github.com/" name="github"/>
  <remote fetch="git://git.openembedded.org/" name="openembedded"/>
  <remote fetch="git://code.qt.io/" name="qt.io"/>
  <remote fetch="git://git.yoctoproject.org/" name="yocto"/>
  
  <default remote="agl" revision="refs/tags/flounder/6.0.3" sync-j="4"/>
  
  <project name="01org/meta-security-isafw" path="meta-security-isafw" remote="github" revision="489abdc65cefb566d696c8b218aa0b9b99a350ae" upstream="master"/>
  <project name="AGL/meta-agl" path="meta-agl"/>
  <project name="AGL/meta-agl-demo" path="meta-agl-demo"/>
  <project name="AGL/meta-agl-devel" path="meta-agl-devel"/>
  <project name="AGL/meta-agl-extra" path="meta-agl-extra"/>
  <project name="AGL/meta-renesas-rcar-gen3" path="meta-renesas-rcar-gen3"/>
  <project name="CogentEmbedded/meta-rcar" path="meta-rcar" remote="github" revision="b9be2cd1ed7e6fe3662cf99001a0fabc51652ecf" upstream="v3.9.0"/>
  <project name="advancedtelematic/meta-updater" path="meta-updater" remote="github" revision="ff555e8690eb47177ade42dc6912ae17a759cc45" upstream="rocko"/>
  <project name="advancedtelematic/meta-updater-qemux86-64" path="meta-updater-qemux86-64" remote="github" revision="697632ddd98ed7ae3dbd0bd84abb04079767bc56" upstream="rocko"/>
  <project name="boundarydevices/meta-boundary" path="meta-boundary" remote="github" revision="f96f41b2e5beda2b51acb702d082568898b36a68" upstream="rocko"/>
  <project name="kraj/meta-altera" path="meta-altera" remote="github" revision="14e08a419cb9d4017f40360c14fcc3c2c1ce8e42" upstream="rocko"/>
  <project name="meta-freescale" remote="yocto" revision="a4158e3425a79720ddc4c02e76251d567bdceb51" upstream="rocko"/>
  <project name="meta-gplv2" remote="yocto" revision="f875c60ecd6f30793b80a431a2423c4b98e51548" upstream="rocko"/>
  <project name="meta-intel" remote="yocto" revision="718bb384942675437c081f6795da7f421da1fee6" upstream="rocko"/>
  <project name="meta-oic" remote="yocto" revision="6e831e4bcdfa6ab8c26eb4fca4bdc98faf028818" upstream="1.2.1"/>
  <project name="meta-openembedded" remote="openembedded" revision="eae996301d9c097bcbeb8046f08041dc82bb62f8" upstream="rocko"/>
  <project name="meta-qcom" remote="yocto" revision="68d67447ec83de4784203afa016c49538165532d" upstream="rocko"/>
  <project name="meta-qt5/meta-qt5" path="meta-qt5" remote="github" revision="682ad61c071a9710e9f9d8a32ab1b5f3c14953d1" upstream="rocko"/>
  <project name="meta-raspberrypi" remote="yocto" revision="8e4c537d84fdde8e3b4642d0dda2c0f4af76d52f" upstream="rocko"/>
  <project name="meta-security" remote="yocto" revision="8f6969a775fa6afbf553e72ba83e71197780b2d8" upstream="master"/>
  <project name="meta-ti" remote="yocto" revision="ed83a43c6a76875ee5f0388b3b60a28f2a373a10" upstream="rocko"/>
  <project name="meta-virtualization" remote="yocto" revision="bd77388f31929f38e7d4cc9c711f0f83f563007e" upstream="rocko"/>
  <project name="phongt/meta-sdl" path="meta-sdl" remote="github" revision="60c9fe8a4a9c6ca95f222685f8d6248f16236f2a" upstream="release/4.4.0"/>
  <project name="poky" remote="yocto" revision="68a612b7d31d270348ef5439d7f779c309bdb6ec" upstream="rocko"/>
</manifest>
egments.length - 1){ segmentcounter++ } if(segmentcounter === routeModel.get(0).segments.length - 1){ img_destination_direction.state = "12" map.removeMapItem(icon_segment_point) }else{ img_destination_direction.state = routeModel.get(0).segments[segmentcounter].maneuver.direction icon_segment_point.coordinate = routeModel.get(0).segments[segmentcounter].path[0] map.addMapItem(icon_segment_point) } }else{ if(next_cross_distance <= 330 && last_segmentcounter != segmentcounter) { last_segmentcounter = segmentcounter guidanceModule.guidance(routeModel.get(0).segments[segmentcounter].maneuver.instructionText) } // update progress_next_cross progress_next_cross.setProgress(next_cross_distance) } } } } function doGetRouteInfoSlot(){ if(btn_guidance.sts_guide == 0){ // idle navigation.broadcastPosition(car_position_lat, car_position_lon,car_direction,car_accumulated_distance); }else if(btn_guidance.sts_guide == 1){ // Routing navigation.broadcastPosition(car_position_lat, car_position_lon,car_direction,car_accumulated_distance); navigation.broadcastRouteInfo(car_position_lat, car_position_lon,routeQuery.waypoints[1].latitude,routeQuery.waypoints[1].longitude); }else if(btn_guidance.sts_guide == 2){ // onGuide navigation.broadcastRouteInfo(car_position_lat, car_position_lon,routeQuery.waypoints[1].latitude,routeQuery.waypoints[1].longitude); } } function rotateMapSmooth(){ if(root.st_heading_up){ map.state = "none" map.state = "smooth_rotate" }else{ map.state = "smooth_rotate_north" } } function stopMapRotation(){ map.state = "none" rot_anim.stop() } function doPauseSimulationSlot(){ btn_guidance.discardWaypoints(); } function doGetAllRoutesSlot(){ return routeModel.count; } function doSetWaypointsSlot(latitude,longitue,startFromCurrentPosition){ btn_guidance.discardWaypoints(startFromCurrentPosition); if(btn_present_position.state === "Optional"){ map.center = map.currentpostion btn_present_position.state = "Flowing" } map.addDestination(QtPositioning.coordinate(latitude,longitue)) } states: [ State { name: "none" }, State { name: "smooth_rotate" PropertyChanges { target: map; bearing: root.car_direction } }, State { name: "smooth_rotate_north" PropertyChanges { target: map; bearing: 0 } } ] transitions: Transition { NumberAnimation { properties: "center"; easing.type: Easing.InOutQuad } RotationAnimation { id: rot_anim property: "bearing" direction: RotationAnimation.Shortest easing.type: Easing.OutQuad duration: 200 } } } BtnPresentPosition { id: btn_present_position anchors.right: parent.right anchors.rightMargin: 125 anchors.bottom: parent.bottom anchors.bottomMargin: 175 } BtnMapDirection { id: btn_map_direction anchors.top: parent.top anchors.topMargin: 25 anchors.left: parent.left anchors.leftMargin: 25 } BtnGuidance { id: btn_guidance anchors.top: parent.top anchors.topMargin: 25 anchors.right: parent.right anchors.rightMargin: 125 } BtnShrink { id: btn_shrink anchors.left: parent.left anchors.leftMargin: 25 anchors.bottom: parent.bottom anchors.bottomMargin: 325 } BtnEnlarge { id: btn_enlarge anchors.left: parent.left anchors.leftMargin: 25 anchors.bottom: parent.bottom anchors.bottomMargin: 175 } ImgDestinationDirection { id: img_destination_direction anchors.top: parent.top anchors.topMargin: 25 anchors.left: parent.left anchors.leftMargin: 150 } ProgressNextCross { id: progress_next_cross anchors.top: parent.top anchors.topMargin: 25 anchors.left: img_destination_direction.right anchors.leftMargin: 20 } Image { visible: map.plugin.name === "mapbox" anchors.left: parent.left anchors.leftMargin: 35 anchors.bottom: parent.bottom anchors.bottomMargin: 10 scale: 1.5 source: "images/mapbox_logo.svg" } Label { visible: map.plugin.name === "mapbox" font.pixelSize: 18 anchors.right: parent.right anchors.rightMargin: 25 anchors.bottom: parent.bottom anchors.bottomMargin: 10 text: "© Mapbox | © OpenStreetMap | Improve this map" } }