summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2019-06-06 16:31:25 +0900
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>2019-06-06 16:31:25 +0900
commit9ee98a06160ee2b234e92db70eb18e128fc76e5d (patch)
treed144be711339162d8fb8662ac868cc3677318072 /app
parent61a91b68c0c895714ea8d612fc752ad4b5cf56ef (diff)
Diffstat (limited to 'app')
-rw-r--r--app/Hudtbt.qml93
-rw-r--r--app/TbtBoard.qml78
-rw-r--r--app/app.pri17
-rw-r--r--app/app.pro31
-rw-r--r--app/app.qrc8
-rw-r--r--app/config.tests/qlibhomescreen/.qmake.stash24
-rw-r--r--app/config.tests/qlibhomescreen/qlibhomescreen.cpp8
-rw-r--r--app/config.tests/qlibhomescreen/qlibhomescreen.pro6
-rw-r--r--app/config.tests/qlibwindowmanager/.qmake.stash24
-rw-r--r--app/config.tests/qlibwindowmanager/qlibwindowmanager.cpp8
-rw-r--r--app/config.tests/qlibwindowmanager/qlibwindowmanager.pro5
-rw-r--r--app/file_operation.cpp83
-rw-r--r--app/file_operation.h38
-rw-r--r--app/hudtbt.qrc6
-rw-r--r--app/images/arrow-0-large.pngbin3587 -> 0 bytes
-rw-r--r--app/images/arrow-l-180-large.pngbin3982 -> 0 bytes
-rw-r--r--app/images/arrow-l-30-large.pngbin3817 -> 0 bytes
-rw-r--r--app/images/arrow-l-45-large.pngbin3749 -> 0 bytes
-rw-r--r--app/images/arrow-l-75-large.pngbin3970 -> 0 bytes
-rw-r--r--app/images/arrow-r-180-large.pngbin3966 -> 0 bytes
-rw-r--r--app/images/arrow-r-30-large.pngbin3808 -> 0 bytes
-rw-r--r--app/images/arrow-r-45-large.pngbin3763 -> 0 bytes
-rw-r--r--app/images/arrow-r-75-large.pngbin4036 -> 0 bytes
-rw-r--r--app/images/car-marker.pngbin6248 -> 0 bytes
-rw-r--r--app/images/destination.pngbin5375 -> 0 bytes
-rw-r--r--app/images/images.qrc15
-rw-r--r--app/images/marker-end.pngbin6199 -> 0 bytes
-rw-r--r--app/images/marker-green.pngbin958 -> 0 bytes
-rw-r--r--app/images/simple-background-white.pngbin4548 -> 0 bytes
-rw-r--r--app/images/simple-bottom-background-black.pngbin4561 -> 0 bytes
-rw-r--r--app/main.cpp132
-rw-r--r--app/qcheapruler.cpp115
-rw-r--r--app/qcheapruler.hpp57
-rw-r--r--app/qml/Main.qml188
-rw-r--r--app/qml/MapWindow.qml356
-rw-r--r--app/qml/TbtBoard.qml187
-rw-r--r--app/qml/qmldir2
37 files changed, 206 insertions, 1275 deletions
diff --git a/app/Hudtbt.qml b/app/Hudtbt.qml
new file mode 100644
index 0000000..141cd71
--- /dev/null
+++ b/app/Hudtbt.qml
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
+ * Copyright (C) 2016 The Qt Company Ltd.
+ *
+ * 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
+
+ApplicationWindow {
+ id: window
+
+ title: "HUD Tbt Demo"
+ width: 1920
+ height: 1080
+ visible: true
+
+ property string api_str: "naviapi"
+ property string verb_subscribe: "subscribe"
+ property string event_getdestdir: "naviapi/navicore_getdestdir"
+ property var msgid_enu: { "call":2, "retok":3, "reterr":4, "event":5 }
+ property string request_str: ""
+ property string status_str: ""
+
+ property double state: 0
+ WebSocket {
+ id: websocket
+ url: bindingAddress
+
+ onStatusChanged: {
+ if (websocket.status === WebSocket.Error){
+ console.log ("Error: " + websocket.errorString)
+ websocket.active = false
+ }else if (websocket.status === WebSocket.Open){
+ console.log ("Socket Open")
+ do_subscribe("getdestdir")
+ }else if (websocket.status === WebSocket.Closed){
+ console.log ("Socket closed")
+ }
+ }
+ onTextMessageReceived: {
+ var message_json = JSON.parse(message)
+
+ console.log ("Raw response: " + message)
+ console.log ("JSON response: " + message_json)
+
+ if (message_json[0] === msgid_enu.event){
+
+ if(message_json[2].event === event_getdestdir)
+ {
+ var state = message_json[2].data.state
+ tbt_board.state = state
+ console.log ("state is ok !")
+ }
+ }
+ else{
+ if (message_json[0] !== msgid_enu.retok) {
+ console.log ("Return value is not ok !")
+ return
+ }
+ }
+ /* refresh happen */
+ }
+ active: true
+ }
+ //subscribe
+ function do_subscribe( event ) {
+ request_str = '[' + msgid_enu.call + ',"99999","' + api_str+'/'+verb_subscribe + '", {"value":"' + event + '"} ]'
+ console.log (request_str)
+ websocket.sendTextMessage (request_str)
+ }
+ TbtBoard {
+ id: tbt_board
+ z: 1
+ visible: true
+ anchors.fill: parent
+ }
+
+}
+
diff --git a/app/TbtBoard.qml b/app/TbtBoard.qml
new file mode 100644
index 0000000..333bc0e
--- /dev/null
+++ b/app/TbtBoard.qml
@@ -0,0 +1,78 @@
+import QtQuick 2.0
+
+//turn by turn board view
+Item {
+ id: tbt_board
+
+ // turn direction arrow board image
+ Image {
+ id: turnDirectionBoard
+ visible: true
+ anchors.centerIn: parent
+ z: 3
+ }
+
+ // the cases of direction arrow board
+ states: [
+ State {
+ name: "0" // NoDirection
+ PropertyChanges { target: turnDirectionBoard; source: "" }
+ },
+ State {
+ name: "1" // DirectionForward
+ PropertyChanges { target: turnDirectionBoard; source: "" }
+ },
+ State {
+ name: "2" // DirectionBearRight
+ PropertyChanges { target: turnDirectionBoard; source: "" }
+ },
+ State {
+ name: "3" // DirectionLightRight
+ PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-r-30-full.png" }
+ },
+ State {
+ name: "4" // DirectionRight
+ PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-r-45-full.png" }
+ },
+ State {
+ name: "5" // DirectionHardRight
+ PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-r-75-full.png" }
+ },
+ State {
+ name: "6" // DirectionUTurnRight
+ //TODO modify qtlocation U-Turn best.For test, change app source.
+ PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-l-180-full.png" }
+ },
+ State {
+ name: "7" // DirectionUTurnLeft
+ //TODO modify qtlocation U-Turn best.For test, change app source.
+ PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-r-180-full.png" }
+ },
+ State {
+ name: "8" // DirectionHardLeft
+ PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-l-75-full.png" }
+ },
+ State {
+ name: "9" // DirectionLeft
+ PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-l-45-full.png" }
+ },
+ State {
+ name: "10" // DirectionLightLeft
+ PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-l-30-full.png" }
+ },
+ State {
+ name: "11" // DirectionBearLeft
+ PropertyChanges { target: turnDirectionBoard; source: "" }
+ },
+ State {
+ name: "12" //arrive the destination
+ PropertyChanges { target: turnDirectionBoard; source: "qrc:destination_full.png" }
+ },
+ State {
+ name: "invisible"
+ PropertyChanges { target: turnDirectionBoard; source: "" }
+ }
+
+ ]
+
+}
diff --git a/app/app.pri b/app/app.pri
index 8e98c34..f22f540 100644
--- a/app/app.pri
+++ b/app/app.pri
@@ -1,18 +1,3 @@
-load(configure)
-
-qtCompileTest(qlibhomescreen)
-qtCompileTest(qlibwindowmanager)
-
-config_qlibhomescreen {
- CONFIG += link_pkgconfig
- PKGCONFIG += qlibhomescreen
- DEFINES += HAVE_QLIBHOMESCREEN
-}
-
-config_qlibwindowmanager {
- CONFIG += link_pkgconfig
- PKGCONFIG += qlibwindowmanager
- DEFINES += HAVE_QLIBWINDOWMANAGER
-}
+TEMPLATE = app
DESTDIR = $${OUT_PWD}/../package/root/bin
diff --git a/app/app.pro b/app/app.pro
index 275b29e..d769d8f 100644
--- a/app/app.pro
+++ b/app/app.pro
@@ -1,31 +1,10 @@
-TARGET = tbtnavi
-TEMPLATE = app
-
-QT += qml network quick positioning location sql widgets
-
-CONFIG += c++14
+TARGET = hudtbt
+QT += quick aglextras
include(app.pri)
-ios|android {
- QT -= widgets
-}
-
-SOURCES += \
- main.cpp \
- qcheapruler.cpp \
- file_operation.cpp
-
-HEADERS += \
- qcheapruler.hpp \
- file_operation.h
-
-INCLUDEPATH += \
- ../include
-
-OTHER_FILES += \
- qmapboxlgapp.qml
+SOURCES = main.cpp \
RESOURCES += \
- images/images.qrc \
- app.qrc
+ hudtbt.qrc\
+ images/images.qrc
diff --git a/app/app.qrc b/app/app.qrc
deleted file mode 100644
index 7ffb6e2..0000000
--- a/app/app.qrc
+++ /dev/null
@@ -1,8 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>qml/qmldir</file>
- <file>qml/Main.qml</file>
- <file>qml/MapWindow.qml</file>
- <file>qml/TbtBoard.qml</file>
- </qresource>
-</RCC>
diff --git a/app/config.tests/qlibhomescreen/.qmake.stash b/app/config.tests/qlibhomescreen/.qmake.stash
deleted file mode 100644
index d0807e7..0000000
--- a/app/config.tests/qlibhomescreen/.qmake.stash
+++ /dev/null
@@ -1,24 +0,0 @@
-QMAKE_CXX.INCDIRS = \
- /usr/include/c++/5 \
- /usr/include/x86_64-linux-gnu/c++/5 \
- /usr/include/c++/5/backward \
- /usr/lib/gcc/x86_64-linux-gnu/5/include \
- /usr/local/include \
- /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed \
- /usr/include/x86_64-linux-gnu \
- /usr/include
-QMAKE_CXX.LIBDIRS = \
- /usr/lib/gcc/x86_64-linux-gnu/5 \
- /usr/lib/x86_64-linux-gnu \
- /usr/lib \
- /lib/x86_64-linux-gnu \
- /lib
-QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
-QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 5
-QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 4
-QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
-QMAKE_CXX.COMPILER_MACROS = \
- QT_COMPILER_STDCXX \
- QMAKE_GCC_MAJOR_VERSION \
- QMAKE_GCC_MINOR_VERSION \
- QMAKE_GCC_PATCH_VERSION
diff --git a/app/config.tests/qlibhomescreen/qlibhomescreen.cpp b/app/config.tests/qlibhomescreen/qlibhomescreen.cpp
deleted file mode 100644
index 8e49ff7..0000000
--- a/app/config.tests/qlibhomescreen/qlibhomescreen.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <qlibhomescreen.h>
-
-int main(int argc,char **argv)
-{
- QLibHomeScreen qlibHomeScreen;
- return 0;
-}
-
diff --git a/app/config.tests/qlibhomescreen/qlibhomescreen.pro b/app/config.tests/qlibhomescreen/qlibhomescreen.pro
deleted file mode 100644
index a5e6fde..0000000
--- a/app/config.tests/qlibhomescreen/qlibhomescreen.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-SOURCES = qlibhomescreen.cpp
-
-CONFIG += qt
-QT += quick
-CONFIG += link_pkgconfig
-PKGCONFIG += qlibhomescreen
diff --git a/app/config.tests/qlibwindowmanager/.qmake.stash b/app/config.tests/qlibwindowmanager/.qmake.stash
deleted file mode 100644
index d0807e7..0000000
--- a/app/config.tests/qlibwindowmanager/.qmake.stash
+++ /dev/null
@@ -1,24 +0,0 @@
-QMAKE_CXX.INCDIRS = \
- /usr/include/c++/5 \
- /usr/include/x86_64-linux-gnu/c++/5 \
- /usr/include/c++/5/backward \
- /usr/lib/gcc/x86_64-linux-gnu/5/include \
- /usr/local/include \
- /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed \
- /usr/include/x86_64-linux-gnu \
- /usr/include
-QMAKE_CXX.LIBDIRS = \
- /usr/lib/gcc/x86_64-linux-gnu/5 \
- /usr/lib/x86_64-linux-gnu \
- /usr/lib \
- /lib/x86_64-linux-gnu \
- /lib
-QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
-QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 5
-QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 4
-QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
-QMAKE_CXX.COMPILER_MACROS = \
- QT_COMPILER_STDCXX \
- QMAKE_GCC_MAJOR_VERSION \
- QMAKE_GCC_MINOR_VERSION \
- QMAKE_GCC_PATCH_VERSION
diff --git a/app/config.tests/qlibwindowmanager/qlibwindowmanager.cpp b/app/config.tests/qlibwindowmanager/qlibwindowmanager.cpp
deleted file mode 100644
index bb95c93..0000000
--- a/app/config.tests/qlibwindowmanager/qlibwindowmanager.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <qlibwindowmanager.h>
-
-int main(int argc,char **argv)
-{
- QLibWindowmanager qwm;
- return 0;
-}
-
diff --git a/app/config.tests/qlibwindowmanager/qlibwindowmanager.pro b/app/config.tests/qlibwindowmanager/qlibwindowmanager.pro
deleted file mode 100644
index cb51d98..0000000
--- a/app/config.tests/qlibwindowmanager/qlibwindowmanager.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-SOURCES = qlibwindowmanager.cpp
-
-CONFIG += qt
-CONFIG += link_pkgconfig
-PKGCONFIG += qlibwindowmanager
diff --git a/app/file_operation.cpp b/app/file_operation.cpp
deleted file mode 100644
index b51477e..0000000
--- a/app/file_operation.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-#include "file_operation.h"
-
-File_Operation::File_Operation(){
- initFileOperation();
-}
-
-File_Operation::~File_Operation(){
-
-}
-
-void File_Operation::initFileOperation(){
-
- m_mapAccessToken = "";
- m_car_speed = 60; // set default Km/h
- m_start_latitude = 36.136261; // set default coordinate Tokyo Hilton
- m_start_longitute = -115.151254;
- m_mapStyleUrls = "mapbox://styles/mapbox/streets-v10"; // set default map style
-
- QFile file(NAVI_CONFIG_FILEPATH);
- if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
- fprintf(stderr,"Failed to open mapAccessToken file \"%s\": %m", qPrintable(NAVI_CONFIG_FILEPATH));
- return;
- }
-
- QByteArray data = file.readAll();
- QJsonDocument jsonDoc(QJsonDocument::fromJson(data));
- QJsonObject jsonObj(jsonDoc.object());
-
- if(jsonObj.contains("mapAccessToken")){
- m_mapAccessToken = jsonObj["mapAccessToken"].toString();
- }else{
- fprintf(stderr,"Failed to find mapAccessToken data \"%s\": %m", qPrintable(NAVI_CONFIG_FILEPATH));
- return;
- }
-
- if(jsonObj.contains("speed")){
- m_car_speed = jsonObj["speed"].toDouble();
- }else{
- fprintf(stderr,"Failed to find speed data \"%s\": %m", qPrintable(NAVI_CONFIG_FILEPATH));
- return;
- }
-
- if(jsonObj.contains("latitude")){
- m_start_latitude = jsonObj["latitude"].toDouble();
- }else{
- fprintf(stderr,"Failed to find latitude data \"%s\": %m", qPrintable(NAVI_CONFIG_FILEPATH));
- return;
- }
-
- if(jsonObj.contains("longitute")){
- m_start_longitute = jsonObj["longitute"].toDouble();
- }else{
- fprintf(stderr,"Failed to find longitute data \"%s\": %m", qPrintable(NAVI_CONFIG_FILEPATH));
- return;
- }
-
- if(jsonObj.contains("mapStyleUrls")){
- m_mapStyleUrls = jsonObj["mapStyleUrls"].toString();
- }else{
- fprintf(stderr,"Failed to find mapStyleUrls data \"%s\": %m", qPrintable(NAVI_CONFIG_FILEPATH));
- return;
- }
-
- file.close();
-
- return;
-}
-
-QString File_Operation::getMapAccessToken() {
- return m_mapAccessToken;
-}
-double File_Operation::getCarSpeed(){
- return m_car_speed;
-}
-double File_Operation::getStartLatitude(){
- return m_start_latitude;
-}
-double File_Operation::getStartLongitute(){
- return m_start_longitute;
-}
-QString File_Operation::getMapStyleUrls() {
- return m_mapStyleUrls;
-}
diff --git a/app/file_operation.h b/app/file_operation.h
deleted file mode 100644
index 9fbbd6c..0000000
--- a/app/file_operation.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef FILE_OPERATION_H
-#define FILE_OPERATION_H
-#include <QObject>
-#include <QString>
-#include <QFile>
-#include <QJsonObject>
-#include <QJsonDocument>
-
-/******************************************************
- * Write navigation config in /etc/naviconfig.ini
- ******************************************************/
-#define NAVI_CONFIG_FILEPATH "/etc/naviconfig.ini"
-
-class File_Operation: public QObject{
-
- Q_OBJECT
-
- QString m_mapAccessToken;
- double m_car_speed; // set Km/h
- double m_start_latitude;
- double m_start_longitute;
- QString m_mapStyleUrls;
-
-public:
- File_Operation();
- ~File_Operation();
-
- Q_INVOKABLE QString getMapAccessToken();
- Q_INVOKABLE double getCarSpeed();
- Q_INVOKABLE double getStartLatitude();
- Q_INVOKABLE double getStartLongitute();
- Q_INVOKABLE QString getMapStyleUrls();
-
-private:
- void initFileOperation();
-};
-
-#endif // FILE_OPERATION_H
diff --git a/app/hudtbt.qrc b/app/hudtbt.qrc
new file mode 100644
index 0000000..fd5fd7f
--- /dev/null
+++ b/app/hudtbt.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>TbtBoard.qml</file>
+ <file>Hudtbt.qml</file>
+ </qresource>
+</RCC>
diff --git a/app/images/arrow-0-large.png b/app/images/arrow-0-large.png
deleted file mode 100644
index 124b896..0000000
--- a/app/images/arrow-0-large.png
+++ /dev/null
Binary files differ
diff --git a/app/images/arrow-l-180-large.png b/app/images/arrow-l-180-large.png
deleted file mode 100644
index cb4ff22..0000000
--- a/app/images/arrow-l-180-large.png
+++ /dev/null
Binary files differ
diff --git a/app/images/arrow-l-30-large.png b/app/images/arrow-l-30-large.png
deleted file mode 100644
index b660a71..0000000
--- a/app/images/arrow-l-30-large.png
+++ /dev/null
Binary files differ
diff --git a/app/images/arrow-l-45-large.png b/app/images/arrow-l-45-large.png
deleted file mode 100644
index 6050cf7..0000000
--- a/app/images/arrow-l-45-large.png
+++ /dev/null
Binary files differ
diff --git a/app/images/arrow-l-75-large.png b/app/images/arrow-l-75-large.png
deleted file mode 100644
index 5edd0b4..0000000
--- a/app/images/arrow-l-75-large.png
+++ /dev/null
Binary files differ
diff --git a/app/images/arrow-r-180-large.png b/app/images/arrow-r-180-large.png
deleted file mode 100644
index 22e8c9f..0000000
--- a/app/images/arrow-r-180-large.png
+++ /dev/null
Binary files differ
diff --git a/app/images/arrow-r-30-large.png b/app/images/arrow-r-30-large.png
deleted file mode 100644
index 47bd445..0000000
--- a/app/images/arrow-r-30-large.png
+++ /dev/null
Binary files differ
diff --git a/app/images/arrow-r-45-large.png b/app/images/arrow-r-45-large.png
deleted file mode 100644
index b69a9e8..0000000
--- a/app/images/arrow-r-45-large.png
+++ /dev/null
Binary files differ
diff --git a/app/images/arrow-r-75-large.png b/app/images/arrow-r-75-large.png
deleted file mode 100644
index 537fd0b..0000000
--- a/app/images/arrow-r-75-large.png
+++ /dev/null
Binary files differ
diff --git a/app/images/car-marker.png b/app/images/car-marker.png
deleted file mode 100644
index 34bab94..0000000
--- a/app/images/car-marker.png
+++ /dev/null
Binary files differ
diff --git a/app/images/destination.png b/app/images/destination.png
deleted file mode 100644
index 2d92322..0000000
--- a/app/images/destination.png
+++ /dev/null
Binary files differ
diff --git a/app/images/images.qrc b/app/images/images.qrc
index fc51ad3..97d193f 100644
--- a/app/images/images.qrc
+++ b/app/images/images.qrc
@@ -1,9 +1,5 @@
<RCC>
<qresource prefix="/">
- <file>car-marker.png</file>
- <file>marker-green.png</file>
- <file>marker-end.png</file>
- <file>simple-bottom-background-black.png</file>
<file>arrow-l-30-full.png</file>
<file>arrow-l-45-full.png</file>
<file>arrow-l-75-full.png</file>
@@ -12,17 +8,6 @@
<file>arrow-r-45-full.png</file>
<file>arrow-r-75-full.png</file>
<file>arrow-r-180-full.png</file>
- <file>arrow-0-large.png</file>
- <file>arrow-l-30-large.png</file>
- <file>arrow-l-45-large.png</file>
- <file>arrow-l-75-large.png</file>
- <file>arrow-l-180-large.png</file>
- <file>arrow-r-30-large.png</file>
- <file>arrow-r-45-large.png</file>
- <file>arrow-r-75-large.png</file>
- <file>arrow-r-180-large.png</file>
- <file>simple-background-white.png</file>
- <file>destination.png</file>
<file>destination_full.png</file>
</qresource>
</RCC>
diff --git a/app/images/marker-end.png b/app/images/marker-end.png
deleted file mode 100644
index 2763c39..0000000
--- a/app/images/marker-end.png
+++ /dev/null
Binary files differ
diff --git a/app/images/marker-green.png b/app/images/marker-green.png
deleted file mode 100644
index e2f2078..0000000
--- a/app/images/marker-green.png
+++ /dev/null
Binary files differ
diff --git a/app/images/simple-background-white.png b/app/images/simple-background-white.png
deleted file mode 100644
index df9c2a0..0000000
--- a/app/images/simple-background-white.png
+++ /dev/null
Binary files differ
diff --git a/app/images/simple-bottom-background-black.png b/app/images/simple-bottom-background-black.png
deleted file mode 100644
index 5c70f5f..0000000
--- a/app/images/simple-bottom-background-black.png
+++ /dev/null
Binary files differ
diff --git a/app/main.cpp b/app/main.cpp
index 489c72b..bd136c0 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -1,115 +1,29 @@
-#include <QQmlApplicationEngine>
-
-#include <QtCore/QDebug>
-#include <QtCore/QCommandLineParser>
-#include <QtCore/QUrlQuery>
-#include <QtGui/QGuiApplication>
-#include <QtQml/QQmlContext>
-#include <QtQuick/QQuickWindow>
-#include <QtDBus/QDBusConnection>
-
-#include "qcheapruler.hpp"
-#include "file_operation.h"
-
-#ifdef HAVE_QLIBHOMESCREEN
-#include <qlibhomescreen.h>
-#endif
-#ifdef HAVE_QLIBWINDOWMANAGER
-#include <qlibwindowmanager.h>
-#endif
+/*
+ * Copyright (C) 2016 The Qt Company Ltd.
+ *
+ * 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.
+ */
+
+#include <QtAGLExtras/AGLApplication>
+#include <QtQml/QQmlApplicationEngine>
int main(int argc, char *argv[])
{
- QString myname = QString("tbtnavi");
-
- QGuiApplication app(argc, argv);
- app.setApplicationName(myname);
- app.setApplicationVersion(QStringLiteral("0.1.0"));
- app.setOrganizationDomain(QStringLiteral("automotivelinux.org"));
- app.setOrganizationName(QStringLiteral("AutomotiveGradeLinux"));
-
- QCommandLineParser parser;
- parser.addPositionalArgument("port", app.translate("main", "port for binding"));
- parser.addPositionalArgument("secret", app.translate("main", "secret for binding"));
- parser.addHelpOption();
- parser.addVersionOption();
- parser.process(app);
- QStringList positionalArguments = parser.positionalArguments();
-
- //make the bindingAddress for websocket
- QQmlApplicationEngine engine;
- QUrl bindingAddress;
- int port = 0;
- QString secret;
- if (positionalArguments.length() == 2) {
- port = positionalArguments.takeFirst().toInt();
- secret = positionalArguments.takeFirst();
-
- bindingAddress.setScheme(QStringLiteral("ws"));
- bindingAddress.setHost(QStringLiteral("localhost"));
- bindingAddress.setPort(port);
- bindingAddress.setPath(QStringLiteral("/api"));
- QUrlQuery query;
- query.addQueryItem(QStringLiteral("token"), secret);
- bindingAddress.setQuery(query);
- engine.rootContext()->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress);
- }else {
- engine.rootContext()->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress);
- }
-
-#ifdef HAVE_QLIBWINDOWMANAGER
- // WindowManager
- QLibWindowmanager* qwm = new QLibWindowmanager();
- if(qwm->init(port,secret) != 0){
- exit(EXIT_FAILURE);
- }
- // Request a surface as described in layers.json windowmanager’s file
- if(qwm->requestSurface(myname) != 0){
- exit(EXIT_FAILURE);
- }
-#endif
-
-#ifdef HAVE_QLIBHOMESCREEN
- // HomeScreen
- QLibHomeScreen* qhs = new QLibHomeScreen();
- std::string token = secret.toStdString();
- qhs->init(port, token.c_str());
- // Set the event handler for Event_TapShortcut which will activate the surface for windowmanager
- qhs->set_event_handler(QLibHomeScreen::Event_ShowWindow, [qwm, myname](json_object *object){
- qDebug("Surface %s got tapShortcut\n", qPrintable(myname));
- qwm->activateWindow(myname, "master.split.sub");
- });
-#endif
- qmlRegisterType<QCheapRuler>("com.mapbox.cheap_ruler", 1, 0, "CheapRuler");
-
- //read the config info from /etc/naviconfig.ini
- File_Operation file;
- engine.rootContext()->setContextProperty("fileOperation", &file);
-
- //load the qml file
- engine.load(QUrl(QStringLiteral("qrc:qml/Main.qml")));
-
- QObject *root = engine.rootObjects().first();
- QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
-#ifdef HAVE_QLIBHOMESCREEN
- qhs->setQuickWindow(window);
-#endif
-
-#ifdef HAVE_QLIBWINDOWMANAGER
-// QObject::connect(window, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateSurface()));
- // Create an event callback against an event type. Here a lambda is called when SyncDraw event occurs
- qwm->set_event_handler(QLibWindowmanager::Event_SyncDraw, [root, qwm, myname](json_object *object) {
- fprintf(stderr, "Surface got syncDraw!\n");
- qwm->endDraw(myname);
- });
- // Create an event callback against an event type. Here a lambda is called when SyncDraw event occurs
- qwm->set_event_handler(QLibWindowmanager::Event_Active, [root](json_object *object) {
- fprintf(stderr, "Surface got Event_Active!\n");
- });
-#else
- window->resize(1024, 768);
- window->setVisible(true);
-#endif
+ AGLApplication app(argc, argv);
+ app.setApplicationName("Hudtbt");
+ app.setupApplicationRole("hudtbt");
+ app.load(QUrl(QStringLiteral("qrc:/Hudtbt.qml")));
return app.exec();
}
+
diff --git a/app/qcheapruler.cpp b/app/qcheapruler.cpp
deleted file mode 100644
index 6e2f59c..0000000
--- a/app/qcheapruler.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-#include "qcheapruler.hpp"
-
-#include <QString>
-
-QCheapRuler::QCheapRuler()
-{
- //set the default current position
- m_currentPosition = QGeoCoordinate(36.136261, -115.151254);
- //m_currentPosition = QGeoCoordinate(35.692396, 139.691102);
-}
-
-QCheapRuler::~QCheapRuler()
-{
-}
-
-//get route distance
-double QCheapRuler::distance() const
-{
- return m_distance;
-}
-
-//get current distance along the route
-double QCheapRuler::currentDistance() const
-{
- return m_currentDistance;
-}
-
-//get the current Coordinate
-void QCheapRuler::setCurrentCoordinate(QString m_latitude,QString m_longitude)
-{
- double latitude = m_latitude.toDouble();
- double longitude = m_longitude.toDouble();
- setCurrentPosition(latitude,longitude);
-}
-
-//set current position below the coordinate info from navigation service
-void QCheapRuler::setCurrentPosition(double latitude, double longitude)
-{
- //set coordinate info and notify the changes when latitude or longitude info has changed
- if((m_currentPosition.latitude() != latitude)
- ||(m_currentPosition.longitude() != longitude))
- {
- m_currentPosition.setLatitude(latitude);
- m_currentPosition.setLongitude(longitude);
- emit currentPositionChanged();
- }
-}
-
-void QCheapRuler::setCurrentDistance(QString strdistance)
-{
- double distance = strdistance.toDouble();
- //set current distance info and notify the changes when the info has changed
- //but it will not send notify when it start or stop demo
-
- if((m_currentDistance != distance)
- &&(distance != 0.0))
- {
- m_currentDistance = distance;
- emit currentDistanceChanged();
- }
-}
-
-//get current position(coordinate)
-QGeoCoordinate QCheapRuler::currentPosition() const
-{
- return m_currentPosition;
-}
-
-QJSValue QCheapRuler::path() const
-{
- // Should never be called.
- return QJSValue();
-}
-
-//set route path and get the total distance
-void QCheapRuler::setPath(const QJSValue &value)
-{
- if (!value.isArray())
- return;
-
- m_path.clear();
- quint32 length = value.property(QStringLiteral("length")).toUInt();
-
- //push back the coordinate info along the route
- for (unsigned i = 0; i < length; ++i) {
- auto property = value.property(i);
- cr::point coordinate = { 0., 0. };
-
- if (property.hasProperty(QStringLiteral("latitude")))
- coordinate.y = property.property(QStringLiteral("latitude")).toNumber();
-
- if (property.hasProperty(QStringLiteral("longitude")))
- coordinate.x = property.property(QStringLiteral("longitude")).toNumber();
-
- m_path.push_back(coordinate);
- }
-
- //count the total distance along the route
- double distance = ruler().lineDistance(m_path);
- if (m_distance != distance) {
- m_distance = distance;
- }
-
- emit pathChanged();
-}
-
-//init the CheapRuler class
-cr::CheapRuler QCheapRuler::ruler() const
-{
- if (m_path.empty()) {
- return cr::CheapRuler(0., cr::CheapRuler::Kilometers);
- } else {
- return cr::CheapRuler(m_currentPosition.latitude(), cr::CheapRuler::Kilometers);
- }
-}
diff --git a/app/qcheapruler.hpp b/app/qcheapruler.hpp
deleted file mode 100644
index 8d3d7bb..0000000
--- a/app/qcheapruler.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#pragma once
-
-#include <QGeoCoordinate>
-#include <QJSValue>
-#include <QObject>
-#include <QtCore>
-
-#include <mapbox/cheap_ruler.hpp> /* BSD3 LICENSE */
-
-namespace cr = mapbox::cheap_ruler;
-
-class QCheapRuler : public QObject{
- Q_OBJECT
- //registy the read write&notify function for qml
- //the distance from start point to end point(read only)
- Q_PROPERTY(double distance READ distance)
- //the distance from start point to current postion along the route(read notify)
- Q_PROPERTY(double currentDistance READ currentDistance NOTIFY currentDistanceChanged)
- //the coordinate info of current postion(read)
- Q_PROPERTY(QGeoCoordinate currentPosition READ currentPosition NOTIFY currentPositionChanged)
- //the route path info postion(read write&notify)
- Q_PROPERTY(QJSValue path READ path WRITE setPath NOTIFY pathChanged)
-
-public:
- QCheapRuler();
- ~QCheapRuler();
-
- //read write&notify function for qml
- double distance() const;
- double currentDistance() const;
- QGeoCoordinate currentPosition() const;
- QJSValue path() const;
- void setPath(const QJSValue &value);
- void setCurrentPosition(double, double);
-
- //functions that can called by qml(Q_INVOKABLE)
- Q_INVOKABLE void setCurrentCoordinate(QString,QString);
- Q_INVOKABLE void setCurrentDistance(QString);
-
-signals:
- //notify signals to qml
- //notify signal when the distance from start point to current postion changed
- void currentDistanceChanged();
- //notify signal when currentPosition changed
- void currentPositionChanged();
- //notify signal when the distance from start point to current postion changed
- void pathChanged();
-
-private:
- cr::CheapRuler ruler() const;
-
- double m_distance = 0.;
- double m_currentDistance = 0.;
- QGeoCoordinate m_currentPosition;
-
- cr::line_string m_path;
-};
diff --git a/app/qml/Main.qml b/app/qml/Main.qml
deleted file mode 100644
index 7b99ca5..0000000
--- a/app/qml/Main.qml
+++ /dev/null
@@ -1,188 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Controls 2.2
-import QtWebSockets 1.0
-import QtPositioning 5.0
-
-import "qrc:/qml"
-
-ApplicationWindow {
- id: window
-
- title: "Turn By Turn Navigation Demo"
- height: 720
- width: 640
- visible: true
-
- property string tbt_navi_request_str: ""
- property string api_str: "naviapi"
- property string verb_getrouteinfo: "navicore_getrouteinfo"
- property string verb_getallsessions: "navicore_getallsessions"
- property string verb_subscribe: "subscribe"
- property string verb_unsubscribe: "unsubscribe"
- property string event_setdemorouteinfo: "naviapi/navicore_setdemorouteinfo"
- property string event_arrivedest: "naviapi/navicore_arrivedest"
- property string event_stopdemo: "naviapi/navicore_stopdemo"
- property string event_setdestpos: "naviapi/navicore_setdestpos"
- property string event_gps: "naviapi/navicore_gps"
- property string event_getdestdir: "naviapi/navicore_getdestdir"
- property var msgid_enu: { "call":2, "retok":3, "reterr":4, "event":5 }
-
- WebSocket {
- id: websocket
- url: bindingAddress
-
- onStatusChanged: {
- if (websocket.status === WebSocket.Error){
- console.log ("Error: " + websocket.errorString)
- websocket.active = false
- countdown.start()
- }else if (websocket.status === WebSocket.Open){
- console.log ("Socket Open")
- do_getallsessions()
- }else if (websocket.status === WebSocket.Closed){
- console.log ("Socket closed")
- }
- }
-
- onTextMessageReceived: {
- //console.log("tbtnavi:onTextMessageReceived: " + message)
- var message_json = JSON.parse(message)
-
- //analyse the infomation from the naviapi service
- if (message_json[0] === msgid_enu.event)
- {
- //set route infomation during the route demo
- if(message_json[2].event === event_setdemorouteinfo)
- {
- var latitude = message_json[2].data[0].DemoLatitude
- var longitude = message_json[2].data[0].DemoLongitude
- var distance = message_json[2].data[0].DemoDistance
- var direction = message_json[2].data[0].DemoDirection
- //console.log("tbtnavi: distance = " + distance + "direction = " + direction)
- mapwindow.do_setDirection(direction)
- mapwindow.do_setNextCrossDistance(distance)
- }
- //when arrive the destination
- else if(message_json[2].event === event_arrivedest)
- {
- mapwindow.do_arrivedest()
- }
- //when the demo stopped
- else if(message_json[2].event === event_stopdemo)
- {
- mapwindow.do_stopnavidemo()
- mapwindow.do_setCoordinate(35.6673965582,139.7491882778)
- mapwindow.startPoint = QtPositioning.coordinate(35.6673965582,139.7491882778);
- }
- //when add destination
- else if(message_json[2].event === event_setdestpos)
- {
- var allroutes = message_json[2].data[0].AllRoutes
- var destlat = message_json[2].data[0].DestinationLatitude
- var destlon = message_json[2].data[0].DestinationLongitude
- mapwindow.do_setdest(allroutes,destlat,destlon)
- }
- else if(message_json[2].event === event_gps){
- //console.log ("tbt:Receive Event======event_gps")
- var lat = message_json[2].data.latitude
- var lon = message_json[2].data.longitude
- //console.log ("tbt:Receive Event lat====== " + lat+" "+"lon======"+lon)
- mapwindow.do_setCoordinate(lat,lon)
-
- }
- else if(message_json[2].event === event_getdestdir){
- var state = message_json[2].data.state
- mapwindow.do_setTbtState(state)
- }
- }
- else if (message_json[0] === msgid_enu.retok)
- {
- //when connect successed request the route infomation
- if(message_json[2].request.info === verb_getallsessions)
- {
- do_getrouteinfo()
- }
- //add destination
- else if(message_json[2].request.info === verb_getrouteinfo)
- {
- var routes = message_json[2].response[0].AllRoutes
- var currentlat = message_json[2].response[0].CurrentLatitude
- var currentlon = message_json[2].response[0].CurrentLongitude
- var destposlat = message_json[2].response[0].DestinationLatitude
- var destposlon = message_json[2].response[0].DestinationLongitude
- mapwindow.do_addRoutePoint(currentlat,currentlon,destposlat,destposlon,routes)
- }
- }
- else{
- console.log("Raw response: " + message)
- }
- }
- active: false
- }
-
- Timer {
- id: countdown
- repeat: false
- interval: 3000
- triggeredOnStart: false
- onTriggered: {
- websocket.active = true
- }
- }
-
- onVisibleChanged: {
- if (visible){
- if (!websocket.active){
- websocket.active = true
- }
- }
- else {
- countdown.stop()
- if (websocket.active){
- do_unsubscribe("setdemopos")
- do_unsubscribe("stopdemo")
- do_unsubscribe("arrivedest")
- }
- }
- }
-
- //make a connect to the naviapi service
- function do_getallsessions() {
- tbt_navi_request_str = '[' + msgid_enu.call + ',"99999","' + api_str+'/'+verb_getallsessions + '", {} ]'
- console.log (tbt_navi_request_str)
- websocket.sendTextMessage (tbt_navi_request_str)
- }
-
- //get route information
- function do_getrouteinfo() {
- tbt_navi_request_str = '[' + msgid_enu.call + ',"99999","' + api_str+'/'+verb_getrouteinfo+ '", {}]'
- console.log (tbt_navi_request_str)
- websocket.sendTextMessage (tbt_navi_request_str)
- }
-
- //subscribe
- function do_subscribe( event ) {
- tbt_navi_request_str = '[' + msgid_enu.call + ',"99999","' + api_str+'/'+verb_subscribe + '", {"value":"' + event + '"} ]'
- console.log (tbt_navi_request_str)
- websocket.sendTextMessage (tbt_navi_request_str)
- }
-
- //unsubscribe
- function do_unsubscribe( event ) {
- tbt_navi_request_str = '[' + msgid_enu.call + ',"99999","' + api_str+'/'+verb_unsubscribe + '", {"value":"' + event + '"} ]'
- console.log (tbt_navi_request_str)
- websocket.sendTextMessage (tbt_navi_request_str)
- }
-
- Item {
- anchors.centerIn: parent
- width: parent.width
- height: parent.height
-
- MapWindow {
- id:mapwindow
- anchors.fill: parent
- objectName: "mapwindow"
- }
- }
-}
diff --git a/app/qml/MapWindow.qml b/app/qml/MapWindow.qml
deleted file mode 100644
index efb4bcf..0000000
--- a/app/qml/MapWindow.qml
+++ /dev/null
@@ -1,356 +0,0 @@
-import QtLocation 5.9
-import QtPositioning 5.0
-import QtQuick 2.0
-
-import com.mapbox.cheap_ruler 1.0
-
-Item {
- id: mapWindow
-
- property int disOffset: fileOperation.getCarSpeed() // set Km/h
- property real rotateAngle: 0
- property var startPoint
- property var endPoint
-
- //turn by turn board view
- TbtBoard {
- id: tbt_board
- z: 1
- visible: false
- anchors.fill: parent
- }
-
- //mapview and route views
- Map {
- id: map
- anchors.fill: parent
-
- plugin: Plugin {
- name: "mapboxgl"
-
- PluginParameter {
- name: "mapboxgl.mapping.additional_style_urls"
- value: fileOperation.getMapStyleUrls()
- }
-
- PluginParameter {
- name: "mapboxgl.access_token"
- value: fileOperation.getMapAccessToken()
- }
- }
-
- center: ruler.currentPosition
- zoomLevel: 18
- tilt: 60
- gesture.acceptedGestures:MapGestureArea.NoGesture
- copyrightsVisible: false
-
- RotationAnimation on bearing {
- id: bearingAnimation
-
- duration: 250
- alwaysRunToEnd: false
- direction: RotationAnimation.Shortest
- running: true
- }
-
- Location {
- id: previousLocation
- coordinate: QtPositioning.coordinate(0, 0);
- }
-
- onCenterChanged: {
- if (previousLocation.coordinate === center)
- return;
-
- bearingAnimation.to = previousLocation.coordinate.azimuthTo(center);
- bearingAnimation.start();
-
- previousLocation.coordinate = center;
- }
-
- MapQuickItem {
- id: startMarker
-
- sourceItem: Image {
- id: greenMarker
- source: "qrc:///marker-green.png"
- }
- anchorPoint.x: greenMarker.width / 2
- anchorPoint.y: greenMarker.height / 2
- }
-
- MapQuickItem {
- id: endMarker
-
- sourceItem: Image {
- id: redMarker
- source: "qrc:///marker-end.png"
- }
- anchorPoint.x: redMarker.width / 2
- anchorPoint.y: redMarker.height / 2
- }
-
- MapItemView {
- model: routeModel
-
- delegate: MapRoute {
- route: routeData
- line.color: "#6b43a1"
- line.width: map.zoomLevel - 5
- opacity: (index == 0) ? 1.0 : 0.3
-
- onRouteChanged: {
- ruler.path = routeData.path;
- }
- }
- }
-
- MapQuickItem {
- zoomLevel: map.zoomLevel
-
- sourceItem: Image {
- id: carMarker
- source: "qrc:///car-marker.png"
- transform: Rotation {
- origin.x: carMarker.width / 2;
- origin.y: carMarker.height / 2;
- angle: rotateAngle
- }
- }
-
- coordinate: ruler.currentPosition
- anchorPoint.x: carMarker.width / 2
- anchorPoint.y: carMarker.height / 2
-
- Location {
- id: previousCarLocation
- coordinate: QtPositioning.coordinate(0, 0);
- }
-
- onCoordinateChanged: {
- if(coordinate === mapWindow.startPoint)
- return;
- rotateAngle = previousCarLocation.coordinate.azimuthTo(coordinate);
- previousCarLocation.coordinate = coordinate;
- }
- }
-
- //add route view in the map
- function updateRoute() {
- routeQuery.clearWaypoints();
- routeQuery.addWaypoint(startMarker.coordinate);
- routeQuery.addWaypoint(endMarker.coordinate);
- map.addMapItem(startMarker)
- map.addMapItem(endMarker)
- }
-
- //clear route view in the map
- function clearRoute() {
- routeQuery.clearWaypoints();
- routeModel.reset();
- map.removeMapItem(startMarker)
- map.removeMapItem(endMarker)
- }
-
- CheapRuler {
- id: ruler
-
- /* onCurrentDistanceChanged: {
- var total = 0;
- var i = 0;
- var alldistance = ruler.distance * 1000;
-
- if((routeModel.status === RouteModel.Ready)
- && (routeModel.count === 1))
- {
- // XXX: Use car speed in meters to pre-warn the turn instruction
- while (total < ruler.currentDistance && i < routeModel.get(0).segments.length)
- {
- total += routeModel.get(0).segments[i++].maneuver.distanceToNextInstruction;
- }
-
- //show the tbt board(it will be always show when demo start)
-// 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
-
- //when goto the last instruction,set the states to "arriveDest"
- if(i >= (routeModel.get(0).segments.length-1))
- {
- total = alldistance;
-// tbt_board.state = "arriveDest";
- }
-
- var dis = (total - ruler.currentDistance).toFixed(1);
- //console.log("tbtnavi:dis = " + dis)
-
- // Set distance
- tbt_board.do_setDistance(dis)
-
- // Set board status
- if(dis < mapWindow.disOffset && i < routeModel.get(0).segments.length)
- {
- //show the tbt board(the big one)
- tbt_board.do_showTbtboard(true)
- }
- else
- {
- //disvisible the tbt board(the big one)
- tbt_board.do_showTbtboard(false)
- }
- }
- }*/ //deleted
- }
- }
-
- //the route view display by RouteModel
- RouteModel {
- id: routeModel
-
- autoUpdate: true
- query: routeQuery
-
- plugin: Plugin {
- name: "mapbox"
-
- // Development access token, do not use in production.
- PluginParameter {
- name: "mapbox.access_token"
- value: fileOperation.getMapAccessToken()
- }
- }
- }
-
- RouteQuery {
- id: routeQuery
- }
-
- Component.onCompleted: {
- //request the route info when map load finish
- 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,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;
-
- 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) {
- 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
- function do_stopnavidemo() {
- //disvisible the tbt board
- tbt_board.visible = false
- //clear the routeview
- if (map) {
- map.clearRoute();
- }
- }
-
- //arrvice the destination signal
- function do_arrivedest(){
- //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();
- }
- }
- }
- }
- }
-}
diff --git a/app/qml/TbtBoard.qml b/app/qml/TbtBoard.qml
deleted file mode 100644
index 738530d..0000000
--- a/app/qml/TbtBoard.qml
+++ /dev/null
@@ -1,187 +0,0 @@
-import QtQuick 2.0
-
-//turn by turn board view
-Item {
- id: tbt_board
-
- property bool showboard: false
-
- // the backgroud image(the small one)
- Image {
- id: whitebackgroud
- visible: !showboard
- anchors.top: parent.top
- width:turnDirection.width
- height:turnDirection.height + distance.height
- source: "qrc:simple-background-white.png"
- z: 1
- }
-
- // turn direction arrow board image(the small one)
- Image {
- id: turnDirection
- visible: !showboard
- anchors.top: parent.top
- z: 3
- }
-
- // the distance to the next crossing road(textview)(the small one)
- Text {
- id: distance
- visible: !showboard
- anchors.top: turnDirection.bottom
- z: 3
- font.pixelSize: 23
- width:turnDirection.width
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.family: "Lato"
- font.weight: Font.Light
- color: "#000000"
- }
-
- // the backgroud image
- Image {
- id: backgroudBoard
- visible: showboard
- anchors.fill: parent
- source: "qrc:simple-bottom-background-black.png"
- z: 1
- }
-
- // turn direction arrow board image
- Image {
- id: turnDirectionBoard
- visible: showboard
- width : parent.height - turnInstructionsBoard.height - distanceBoard.height
- height: parent.height - turnInstructionsBoard.height - distanceBoard.height
- anchors.centerIn: parent
- z: 3
- }
-
- // the distance to the next crossing road(textview)
- Text {
- id: distanceBoard
- visible: showboard
- anchors.bottom: turnInstructionsBoard.top
- z: 3
- font.pixelSize: 45
- width:tbt_board.width
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.family: "Lato"
- font.weight: Font.Light
- color: "#FFFFFF"
- }
-
- // the description of the next crossing road(textview)
- Text {
- id: turnInstructionsBoard
- visible: showboard
- anchors.bottom: parent.bottom
- z: 3
- font.pixelSize: 30
- width:tbt_board.width
- wrapMode: Text.Wrap
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.family: "Lato"
- font.weight: Font.Light
- color: "#FFFFFF"
- }
-
- // the cases of direction arrow board
- states: [
- State {
- name: "12" //arrive the destination
- PropertyChanges { target: turnDirectionBoard; source: "qrc:destination_full.png" }
- PropertyChanges { target: turnDirection; source: "qrc:destination.png" }
- },
- State {
- name: "0" // NoDirection
- PropertyChanges { target: turnDirectionBoard; source: "" }
- PropertyChanges { target: turnDirection; source: "" }
- },
- State {
- name: "1" // DirectionForward
- PropertyChanges { target: turnDirectionBoard; source: "" }
- PropertyChanges { target: turnDirection; source: "" }
- },
- State {
- name: "2" // DirectionBearRight
- PropertyChanges { target: turnDirectionBoard; source: "" }
- PropertyChanges { target: turnDirection; source: "" }
- },
- State {
- name: "3" // DirectionLightRight
- PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-r-30-full.png" }
- PropertyChanges { target: turnDirection; source: "qrc:arrow-r-30-large.png" }
- },
- State {
- name: "4" // DirectionRight
- PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-r-45-full.png" }
- PropertyChanges { target: turnDirection; source: "qrc:arrow-r-45-large.png" }
- },
- State {
- name: "5" // DirectionHardRight
- PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-r-75-full.png" }
- PropertyChanges { target: turnDirection; source: "qrc:arrow-r-75-large.png" }
- },
- State {
- name: "6" // DirectionUTurnRight
- //TODO modify qtlocation U-Turn best.For test, change app source.
- PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-l-180-full.png" }
- PropertyChanges { target: turnDirection; source: "qrc:arrow-l-180-large.png" }
- },
- State {
- name: "7" // DirectionUTurnLeft
- //TODO modify qtlocation U-Turn best.For test, change app source.
- PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-r-180-full.png" }
- PropertyChanges { target: turnDirection; source: "qrc:arrow-r-180-large.png" }
- },
- State {
- name: "8" // DirectionHardLeft
- PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-l-75-full.png" }
- PropertyChanges { target: turnDirection; source: "qrc:arrow-l-75-large.png" }
- },
- State {
- name: "9" // DirectionLeft
- PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-l-45-full.png" }
- PropertyChanges { target: turnDirection; source: "qrc:arrow-l-45-large.png" }
- },
- State {
- name: "10" // DirectionLightLeft
- PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-l-30-full.png" }
- PropertyChanges { target: turnDirection; source: "qrc:arrow-l-30-large.png" }
- },
- State {
- name: "11" // DirectionBearLeft
- PropertyChanges { target: turnDirectionBoard; source: "" }
- PropertyChanges { target: turnDirection; source: "" }
- }
- ]
-
- // Set distance
- function do_setDistance(dis) {
- if(dis > 1000)
- {
- distanceBoard.text = (dis / 1000).toFixed(1) + " km"
- }
- else
- {
- distanceBoard.text = dis + " m"
- }
-
- distance.text = (((dis/100).toFixed(0))*100) +"m"
- }
-
- //set turnInstructions
- function do_setTurnInstructions(turnInstructions) {
- turnInstructionsBoard.text = turnInstructions
- }
-
- //show the tbt board(the big one)
- function do_showTbtboard(mvisible) {
- showboard = mvisible
- }
-}
diff --git a/app/qml/qmldir b/app/qml/qmldir
deleted file mode 100644
index 7bbd751..0000000
--- a/app/qml/qmldir
+++ /dev/null
@@ -1,2 +0,0 @@
-MapWindow 1.0 MapWindow.qml
-TbtBoard 1.0 TbtBoard.qml