summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--LICENSE39
-rw-r--r--app/app.pri13
-rw-r--r--app/app.pro42
-rw-r--r--app/forms/Geocode.qml81
-rw-r--r--app/forms/GeocodeForm.ui.qml173
-rw-r--r--app/forms/Locale.qml82
-rw-r--r--app/forms/LocaleForm.ui.qml153
-rw-r--r--app/forms/Message.qml58
-rw-r--r--app/forms/MessageForm.ui.qml106
-rw-r--r--app/forms/ReverseGeocode.qml75
-rw-r--r--app/forms/ReverseGeocodeForm.ui.qml140
-rw-r--r--app/forms/RouteAddress.qml142
-rw-r--r--app/forms/RouteAddressForm.ui.qml197
-rw-r--r--app/forms/RouteCoordinate.qml79
-rw-r--r--app/forms/RouteCoordinateForm.ui.qml173
-rw-r--r--app/forms/RouteList.qml87
-rw-r--r--app/forms/RouteListDelegate.qml82
-rw-r--r--app/forms/RouteListHeader.qml84
-rw-r--r--app/helper.js81
-rw-r--r--app/main.cpp135
-rw-r--r--app/map/CircleItem.qml58
-rw-r--r--app/map/ImageItem.qml61
-rw-r--r--app/map/MapComponent.qml677
-rw-r--r--app/map/Marker.qml116
-rw-r--r--app/map/PolygonItem.qml63
-rw-r--r--app/map/PolylineItem.qml57
-rw-r--r--app/map/RectangleItem.qml59
-rw-r--r--app/mapviewer.qml466
-rw-r--r--app/mapviewer.qrc36
-rw-r--r--app/menus/ItemPopupMenu.qml53
-rw-r--r--app/menus/MainMenu.qml126
-rw-r--r--app/menus/MapPopupMenu.qml64
-rw-r--r--app/menus/MarkerPopupMenu.qml76
-rw-r--r--app/resources/icon.pngbin0 -> 1859 bytes
-rw-r--r--app/resources/marker.pngbin0 -> 752 bytes
-rw-r--r--app/resources/scale.pngbin0 -> 98 bytes
-rw-r--r--app/resources/scale_end.pngbin0 -> 93 bytes
-rw-r--r--navigation.pro3
-rw-r--r--package/config.xml17
-rw-r--r--package/icon.svg279
-rw-r--r--package/package.pro19
-rw-r--r--package/root/config.xml18
-rw-r--r--package/root/icon.svg279
43 files changed, 4549 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..aa13093
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,39 @@
+****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************
diff --git a/app/app.pri b/app/app.pri
new file mode 100644
index 0000000..c3b1fd1
--- /dev/null
+++ b/app/app.pri
@@ -0,0 +1,13 @@
+TEMPLATE = app
+QMAKE_LFLAGS += "-Wl,--hash-style=gnu -Wl,--as-needed"
+
+load(configure)
+qtCompileTest(libhomescreen)
+
+config_libhomescreen {
+ CONFIG += link_pkgconfig
+ PKGCONFIG += homescreen
+ DEFINES += HAVE_LIBHOMESCREEN
+}
+
+DESTDIR = $${OUT_PWD}/../package/root/bin
diff --git a/app/app.pro b/app/app.pro
new file mode 100644
index 0000000..3c0e40d
--- /dev/null
+++ b/app/app.pro
@@ -0,0 +1,42 @@
+TARGET = navigation
+
+CONFIG += link_pkgconfig
+PKGCONFIG += libhomescreen qlibwindowmanager
+
+QT = qml network quick positioning location quickcontrols2
+
+SOURCES += main.cpp
+
+RESOURCES += \
+ mapviewer.qrc
+
+OTHER_FILES +=mapviewer.qml \
+ helper.js \
+ map/MapComponent.qml \
+ map/Marker.qml \
+ map/CircleItem.qml \
+ map/RectangleItem.qml \
+ map/PolylineItem.qml \
+ map/PolygonItem.qml \
+ map/ImageItem.qml \
+ menus/ItemPopupMenu.qml \
+ menus/MainMenu.qml \
+ menus/MapPopupMenu.qml \
+ menus/MarkerPopupMenu \
+ forms/Geocode.qml \
+ forms/GeocodeForm.ui.qml\
+ forms/Message.qml \
+ forms/MessageForm.ui.qml \
+ forms/ReverseGeocode.qml \
+ forms/ReverseGeocodeForm.ui.qml \
+ forms/RouteCoordinate.qml \
+ forms/Locale.qml \
+ forms/LocaleForm.ui.qml \
+ forms/RouteAddress.qml \
+ forms/RouteAddressForm.ui.qml \
+ forms/RouteCoordinateForm.ui.qml \
+ forms/RouteList.qml \
+ forms/RouteListDelegate.qml \
+ forms/RouteListHeader.qml
+
+include(app.pri)
diff --git a/app/forms/Geocode.qml b/app/forms/Geocode.qml
new file mode 100644
index 0000000..9e27325
--- /dev/null
+++ b/app/forms/Geocode.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtPositioning 5.5
+
+GeocodeForm {
+
+ property variant address
+ signal showPlace(variant address)
+ signal closeForm()
+
+ goButton.onClicked: {
+ // fill out the Address element
+ address.street = street.text
+ address.city = city.text
+ address.state = state.text
+ address.country = country.text
+ address.postalCode = postalCode.text
+ showPlace(address)
+ }
+
+ clearButton.onClicked: {
+ street.text = ""
+ city.text = ""
+ state.text = ""
+ country.text = ""
+ postalCode.text = ""
+ }
+
+ cancelButton.onClicked: {
+ closeForm()
+ }
+
+ Component.onCompleted: {
+ street.text = address.street
+ city.text = address.city
+ state.text = address.state
+ country.text = address.country
+ postalCode.text = address.postalCode
+ }
+}
+
+
diff --git a/app/forms/GeocodeForm.ui.qml b/app/forms/GeocodeForm.ui.qml
new file mode 100644
index 0000000..3ed715a
--- /dev/null
+++ b/app/forms/GeocodeForm.ui.qml
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.2
+
+Item {
+ property alias goButton: goButton
+ property alias clearButton: clearButton
+ property alias postalCode: postalCode
+ property alias street: street
+ property alias city: city
+ property alias state: state
+ property alias country: country
+ property alias cancelButton: cancelButton
+ Rectangle {
+ id: tabRectangle
+ y: 20
+ height: tabTitle.height * 2
+ color: "#46a2da"
+ anchors.rightMargin: 0
+ anchors.leftMargin: 0
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Label {
+ id: tabTitle
+ color: "#ffffff"
+ text: qsTr("Geocode")
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ Item {
+ id: item2
+ anchors.rightMargin: 20
+ anchors.leftMargin: 20
+ anchors.bottomMargin: 20
+ anchors.topMargin: 20
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: tabRectangle.bottom
+
+
+ GridLayout {
+ id: gridLayout3
+ anchors.rightMargin: 0
+ anchors.bottomMargin: 0
+ anchors.leftMargin: 0
+ anchors.topMargin: 0
+ rowSpacing: 10
+ rows: 1
+ columns: 2
+ anchors.fill: parent
+
+ Label {
+ id: label2
+ text: qsTr("Street")
+ }
+
+ TextField {
+ id: street
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label3
+ text: qsTr("City")
+ }
+
+ TextField {
+ id: city
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label4
+ text: qsTr("State")
+ }
+
+ TextField {
+ id: state
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label5
+ text: qsTr("Country")
+ }
+
+ TextField {
+ id: country
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label6
+ text: qsTr("Postal Code")
+ }
+
+ TextField {
+ id: postalCode
+ Layout.fillWidth: true
+ }
+
+ RowLayout {
+ id: rowLayout1
+ Layout.columnSpan: 2
+ Layout.alignment: Qt.AlignRight
+
+ Button {
+ id: goButton
+ text: qsTr("Proceed")
+ }
+
+ Button {
+ id: clearButton
+ text: qsTr("Clear")
+ }
+
+ Button {
+ id: cancelButton
+ text: qsTr("Cancel")
+ }
+ }
+
+ Item {
+ Layout.fillHeight: true
+ Layout.columnSpan: 2
+ }
+ }
+ }
+}
diff --git a/app/forms/Locale.qml b/app/forms/Locale.qml
new file mode 100644
index 0000000..6e76c98
--- /dev/null
+++ b/app/forms/Locale.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtPositioning 5.5
+
+LocaleForm {
+ property string locale
+ signal selectLanguage(string language)
+ signal closeForm()
+
+ goButton.onClicked: {
+
+ if (!languageGroup.current) return
+
+ if (otherRadioButton.checked) {
+ selectLanguage(language.text)
+ } else {
+ selectLanguage(languageGroup.current.text)
+ }
+ }
+
+ clearButton.onClicked: {
+ language.text = ""
+ }
+
+ cancelButton.onClicked: {
+ closeForm()
+ }
+
+ Component.onCompleted: {
+ switch (locale) {
+ case "en":
+ enRadioButton.checked = true;
+ break
+ case "fr":
+ frRadioButton.checked = true;
+ break
+ default:
+ otherRadioButton.checked = true;
+ language.text = locale
+ break
+ }
+ }
+}
diff --git a/app/forms/LocaleForm.ui.qml b/app/forms/LocaleForm.ui.qml
new file mode 100644
index 0000000..91a0847
--- /dev/null
+++ b/app/forms/LocaleForm.ui.qml
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.2
+
+Item {
+ property alias clearButton: clearButton
+ property alias goButton: goButton
+ property alias cancelButton: cancelButton
+ property alias tabTitle: tabTitle
+ property alias languageGroup: languageGroup
+ property alias enRadioButton: enRadioButton
+ property alias frRadioButton: frRadioButton
+ property alias otherRadioButton: otherRadioButton
+ property alias language: language
+
+ Rectangle {
+ id: tabRectangle
+ y: 20
+ height: tabTitle.height * 2
+ color: "#46a2da"
+ anchors.rightMargin: 0
+ anchors.leftMargin: 0
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Label {
+ id: tabTitle
+ color: "#ffffff"
+ text: "Locale"
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ Item {
+ id: item2
+ anchors.rightMargin: 20
+ anchors.leftMargin: 20
+ anchors.bottomMargin: 20
+ anchors.topMargin: 20
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: tabRectangle.bottom
+
+ GridLayout {
+ id: gridLayout3
+ anchors.rightMargin: 0
+ anchors.bottomMargin: 0
+ anchors.leftMargin: 0
+ anchors.topMargin: 0
+ rowSpacing: 10
+ rows: 1
+ columns: 2
+ anchors.fill: parent
+
+ ExclusiveGroup { id: languageGroup }
+ RadioButton {
+ id: enRadioButton
+ text: qsTr("en")
+ exclusiveGroup: languageGroup
+ Layout.columnSpan: 2
+ }
+
+ RadioButton {
+ id: frRadioButton
+ text: qsTr("fr")
+ exclusiveGroup: languageGroup
+ Layout.columnSpan: 2
+ }
+
+ RadioButton {
+ id: otherRadioButton
+ text: qsTr("Other")
+ exclusiveGroup: languageGroup
+ }
+
+ TextField {
+ id: language
+ Layout.fillWidth: true
+ placeholderText: qsTr("")
+ }
+
+ RowLayout {
+ id: rowLayout1
+ Layout.columnSpan: 2
+ Layout.alignment: Qt.AlignRight
+
+ Button {
+ id: goButton
+ text: qsTr("Proceed")
+ }
+
+ Button {
+ id: clearButton
+ text: qsTr("Clear")
+ }
+
+ Button {
+ id: cancelButton
+ text: qsTr("Cancel")
+ }
+ }
+
+ Item {
+ Layout.fillHeight: true
+ Layout.columnSpan: 2
+ }
+
+
+ }
+ }
+}
diff --git a/app/forms/Message.qml b/app/forms/Message.qml
new file mode 100644
index 0000000..5d12c1f
--- /dev/null
+++ b/app/forms/Message.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+
+MessageForm {
+ property string title
+ property string message
+ property variant backPage
+
+ signal closeForm(variant backPage)
+
+ button.onClicked: {
+ closeForm(backPage)
+ }
+
+ Component.onCompleted: {
+ messageText.text = message
+ messageTitle.text = title
+ }
+}
diff --git a/app/forms/MessageForm.ui.qml b/app/forms/MessageForm.ui.qml
new file mode 100644
index 0000000..a300841
--- /dev/null
+++ b/app/forms/MessageForm.ui.qml
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.2
+
+Item {
+ id: root
+ property alias messageText: messageText
+ property alias messageTitle: messageTitle
+ property alias button: button
+
+ Rectangle {
+ id: tabRectangle
+ y: 20
+ height: messageTitle.height * 2
+ color: "#46a2da"
+ anchors.rightMargin: 0
+ anchors.leftMargin: 0
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Label {
+ id: messageTitle
+ color: "#ffffff"
+ text: qsTr("type")
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ Item {
+ anchors.rightMargin: 20
+ anchors.leftMargin: 20
+ anchors.bottomMargin: 20
+ anchors.topMargin: 20
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: tabRectangle.bottom
+
+ ColumnLayout {
+ id: columnLayout1
+ spacing: 20
+ anchors.fill: parent
+
+ Label {
+ id: messageText
+ text: qsTr("message")
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignHCenter
+ wrapMode: Text.WordWrap
+ textFormat: Text.RichText
+ }
+
+ Button {
+ id: button
+ text: qsTr("OK")
+ Layout.alignment: Qt.AlignHCenter
+ }
+
+ Item {
+ Layout.fillHeight: true
+ }
+ }
+ }
+}
+
diff --git a/app/forms/ReverseGeocode.qml b/app/forms/ReverseGeocode.qml
new file mode 100644
index 0000000..9e3cd65
--- /dev/null
+++ b/app/forms/ReverseGeocode.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtPositioning 5.5
+
+//Reverse Geocode Dialog
+ReverseGeocodeForm {
+ property string title;
+ property variant coordinate
+ signal showPlace(variant coordinate)
+ signal closeForm()
+
+ goButton.onClicked: {
+ var coordinate = QtPositioning.coordinate(parseFloat(latitude.text),
+ parseFloat(longitude.text));
+ if (coordinate.isValid) {
+ showPlace(coordinate)
+ }
+ }
+
+ clearButton.onClicked: {
+ latitude.text = ""
+ longitude.text = ""
+ }
+
+ cancelButton.onClicked: {
+ closeForm()
+ }
+
+ Component.onCompleted: {
+ latitude.text = "" + coordinate.latitude
+ longitude.text = "" + coordinate.longitude
+ if (title.length != 0) {
+ tabTitle.text = title;
+ }
+ }
+}
diff --git a/app/forms/ReverseGeocodeForm.ui.qml b/app/forms/ReverseGeocodeForm.ui.qml
new file mode 100644
index 0000000..29eaec9
--- /dev/null
+++ b/app/forms/ReverseGeocodeForm.ui.qml
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.2
+
+Item {
+ property alias clearButton: clearButton
+ property alias goButton: goButton
+ property alias longitude: longitude
+ property alias latitude: latitude
+ property alias cancelButton: cancelButton
+ property alias tabTitle: tabTitle
+ Rectangle {
+ id: tabRectangle
+ y: 20
+ height: tabTitle.height * 2
+ color: "#46a2da"
+ anchors.rightMargin: 0
+ anchors.leftMargin: 0
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Label {
+ id: tabTitle
+ color: "#ffffff"
+ text: qsTr("Reverse Geocode")
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ Item {
+ id: item2
+ anchors.rightMargin: 20
+ anchors.leftMargin: 20
+ anchors.bottomMargin: 20
+ anchors.topMargin: 20
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: tabRectangle.bottom
+
+ GridLayout {
+ id: gridLayout3
+ anchors.rightMargin: 0
+ anchors.bottomMargin: 0
+ anchors.leftMargin: 0
+ anchors.topMargin: 0
+ rowSpacing: 10
+ rows: 1
+ columns: 2
+ anchors.fill: parent
+
+ Label {
+ id: label2
+ text: qsTr("Latitude")
+ }
+
+ TextField {
+ id: latitude
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label3
+ text: qsTr("Longitude")
+ }
+
+ TextField {
+ id: longitude
+ Layout.fillWidth: true
+ placeholderText: qsTr("")
+ }
+
+ RowLayout {
+ id: rowLayout1
+ Layout.columnSpan: 2
+ Layout.alignment: Qt.AlignRight
+
+ Button {
+ id: goButton
+ text: qsTr("Proceed")
+ }
+
+ Button {
+ id: clearButton
+ text: qsTr("Clear")
+ }
+
+ Button {
+ id: cancelButton
+ text: qsTr("Cancel")
+ }
+ }
+ Item {
+ Layout.fillHeight: true
+ Layout.columnSpan: 2
+ }
+ }
+ }
+}
diff --git a/app/forms/RouteAddress.qml b/app/forms/RouteAddress.qml
new file mode 100644
index 0000000..248396d
--- /dev/null
+++ b/app/forms/RouteAddress.qml
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtLocation 5.6
+import QtPositioning 5.5
+
+RouteAddressForm {
+ property alias plugin : tempGeocodeModel.plugin;
+ property variant fromAddress;
+ property variant toAddress;
+ signal showMessage(string topic, string message)
+ signal showRoute(variant startCoordinate,variant endCoordinate)
+ signal closeForm()
+
+ goButton.onClicked: {
+ tempGeocodeModel.reset()
+ fromAddress.country = fromCountry.text
+ fromAddress.street = fromStreet.text
+ fromAddress.city = fromCity.text
+ toAddress.country = toCountry.text
+ toAddress.street = toStreet.text
+ toAddress.city = toCity.text
+ tempGeocodeModel.startCoordinate = QtPositioning.coordinate()
+ tempGeocodeModel.endCoordinate = QtPositioning.coordinate()
+ tempGeocodeModel.query = fromAddress
+ tempGeocodeModel.update();
+ goButton.enabled = false;
+ }
+
+ clearButton.onClicked: {
+ fromStreet.text = ""
+ fromCity.text = ""
+ fromCountry.text = ""
+ toStreet.text = ""
+ toCity.text = ""
+ toCountry.text = ""
+ }
+
+ cancelButton.onClicked: {
+ closeForm()
+ }
+
+ Component.onCompleted: {
+ fromStreet.text = fromAddress.street
+ fromCity.text = fromAddress.city
+ fromCountry.text = fromAddress.country
+ toStreet.text = toAddress.street
+ toCity.text = toAddress.city
+ toCountry.text = toAddress.country
+ }
+
+ GeocodeModel {
+ id: tempGeocodeModel
+
+ property int success: 0
+ property variant startCoordinate
+ property variant endCoordinate
+
+ onCountChanged: {
+ if (success == 1 && count == 1) {
+ query = toAddress
+ update();
+ }
+ }
+
+ onStatusChanged: {
+ if ((status == GeocodeModel.Ready) && (count == 1)) {
+ success++
+ if (success == 1) {
+ startCoordinate.latitude = get(0).coordinate.latitude
+ startCoordinate.longitude = get(0).coordinate.longitude
+ }
+ if (success == 2) {
+ endCoordinate.latitude = get(0).coordinate.latitude
+ endCoordinate.longitude = get(0).coordinate.longitude
+ success = 0
+ if (startCoordinate.isValid && endCoordinate.isValid)
+ showRoute(startCoordinate,endCoordinate)
+ else
+ goButton.enabled = true
+ }
+ } else if ((status == GeocodeModel.Ready) || (status == GeocodeModel.Error)) {
+ var st = (success == 0 ) ? "start" : "end"
+ success = 0
+ if ((status == GeocodeModel.Ready) && (count == 0 )) {
+ showMessage(qsTr("Geocode Error"),qsTr("Unsuccessful geocode"));
+ goButton.enabled = true;
+ }
+ else if (status == GeocodeModel.Error) {
+ showMessage(qsTr("Geocode Error"),
+ qsTr("Unable to find location for the") + " " +
+ st + " " +qsTr("point"))
+ goButton.enabled = true;
+ }
+ else if ((status == GeocodeModel.Ready) && (count > 1 )) {
+ showMessage(qsTr("Ambiguous geocode"),
+ count + " " + qsTr("results found for the") +
+ " " + st + " " +qsTr("point, please specify location"))
+ goButton.enabled = true;
+ }
+ }
+ }
+ }
+}
diff --git a/app/forms/RouteAddressForm.ui.qml b/app/forms/RouteAddressForm.ui.qml
new file mode 100644
index 0000000..3f98dc0
--- /dev/null
+++ b/app/forms/RouteAddressForm.ui.qml
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.2
+
+Item {
+ property alias fromStreet: fromStreet
+ property alias fromCountry: fromCountry
+ property alias toStreet: toStreet
+ property alias toCity: toCity
+ property alias toCountry: toCountry
+ property alias fromCity: fromCity
+ property alias goButton: goButton
+ property alias clearButton: clearButton
+ property alias cancelButton: cancelButton
+
+ Rectangle {
+ id: tabRectangle
+ y: 20
+ height: tabTitle.height * 2
+ color: "#46a2da"
+ anchors.rightMargin: 0
+ anchors.leftMargin: 0
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Label {
+ id: tabTitle
+ color: "#ffffff"
+ text: qsTr("Route Address")
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ Item {
+ id: item2
+ anchors.rightMargin: 20
+ anchors.leftMargin: 20
+ anchors.bottomMargin: 20
+ anchors.topMargin: 20
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: tabRectangle.bottom
+
+ GridLayout {
+ id: gridLayout3
+ rowSpacing: 10
+ rows: 1
+ columns: 2
+ anchors.fill: parent
+
+ Label {
+ id: label1
+ text: qsTr("From")
+ font.bold: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ Layout.columnSpan : 2
+ }
+
+ Label {
+ id: label2
+ text: qsTr("Street")
+ }
+
+ TextField {
+ id: fromStreet
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label3
+ text: qsTr("City")
+ }
+
+ TextField {
+ id: fromCity
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label7
+ text: qsTr("Country")
+ }
+
+ TextField {
+ id: fromCountry
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label6
+ text: qsTr("To")
+ font.bold: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ Layout.columnSpan: 2
+ }
+
+ Label {
+ id: label4
+ text: qsTr("Street")
+ }
+
+ TextField {
+ id: toStreet
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label5
+ text: qsTr("City")
+ }
+
+ TextField {
+ id: toCity
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label8
+ text: qsTr("Country")
+ }
+
+ TextField {
+ id: toCountry
+ Layout.fillWidth: true
+ }
+
+ RowLayout {
+ id: rowLayout1
+ Layout.columnSpan: 2
+ Layout.alignment: Qt.AlignRight
+
+ Button {
+ id: goButton
+ text: qsTr("Proceed")
+ }
+
+ Button {
+ id: clearButton
+ text: qsTr("Clear")
+ }
+
+ Button {
+ id: cancelButton
+ text: qsTr("Cancel")
+ }
+ }
+
+ Item {
+ Layout.fillHeight: true
+ Layout.columnSpan: 2
+ }
+ }
+ }
+}
diff --git a/app/forms/RouteCoordinate.qml b/app/forms/RouteCoordinate.qml
new file mode 100644
index 0000000..f195ac7
--- /dev/null
+++ b/app/forms/RouteCoordinate.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtPositioning 5.5
+
+RouteCoordinateForm {
+ property variant toCoordinate
+ property variant fromCoordinate
+ signal showRoute(variant startCoordinate,variant endCoordinate)
+ signal closeForm()
+
+ goButton.onClicked: {
+ var startCoordinate = QtPositioning.coordinate(parseFloat(fromLatitude.text),
+ parseFloat(fromLongitude.text));
+ var endCoordinate = QtPositioning.coordinate(parseFloat(toLatitude.text),
+ parseFloat(toLongitude.text));
+ if (startCoordinate.isValid && endCoordinate.isValid) {
+ goButton.enabled = false;
+ showRoute(startCoordinate,endCoordinate)
+ }
+ }
+
+ clearButton.onClicked: {
+ fromLatitude.text = ""
+ fromLongitude.text = ""
+ toLatitude.text = ""
+ toLongitude.text = ""
+ }
+
+ cancelButton.onClicked: {
+ closeForm()
+ }
+
+ Component.onCompleted: {
+ fromLatitude.text = "" + fromCoordinate.latitude
+ fromLongitude.text = "" + fromCoordinate.longitude
+ toLatitude.text = "" + toCoordinate.latitude
+ toLongitude.text = "" + toCoordinate.longitude
+ }
+}
+
diff --git a/app/forms/RouteCoordinateForm.ui.qml b/app/forms/RouteCoordinateForm.ui.qml
new file mode 100644
index 0000000..bd492d3
--- /dev/null
+++ b/app/forms/RouteCoordinateForm.ui.qml
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.2
+
+Item {
+ property alias fromLatitude: fromLatitude
+ property alias fromLongitude: fromLongitude
+ property alias toLatitude: toLatitude
+ property alias toLongitude: toLongitude
+ property alias clearButton: clearButton
+ property alias goButton: goButton
+ property alias cancelButton: cancelButton
+
+ Rectangle {
+ id: tabRectangle
+ y: 20
+ height: tabTitle.height * 2
+ color: "#46a2da"
+ anchors.rightMargin: 0
+ anchors.leftMargin: 0
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Label {
+ id: tabTitle
+ color: "#ffffff"
+ text: qsTr("Route Coordinates")
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ Item {
+ id: item2
+ anchors.rightMargin: 20
+ anchors.leftMargin: 20
+ anchors.bottomMargin: 20
+ anchors.topMargin: 20
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: tabRectangle.bottom
+
+ GridLayout {
+ id: gridLayout3
+ rowSpacing: 10
+ rows: 1
+ columns: 2
+ anchors.fill: parent
+
+ Label {
+ id: label1
+ text: qsTr("From")
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.bold: true
+ Layout.columnSpan : 2
+ }
+
+ Label {
+ id: label2
+ text: qsTr("Latitude")
+ }
+
+ TextField {
+ id: fromLatitude
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label3
+ text: qsTr("Longitude")
+ }
+
+ TextField {
+ id: fromLongitude
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label6
+ text: qsTr("To")
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.bold: true
+ Layout.columnSpan: 2
+ }
+
+ Label {
+ id: label4
+ text: qsTr("Latitude")
+ }
+
+ TextField {
+ id: toLatitude
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: label5
+ text: qsTr("Longitude")
+ }
+
+ TextField {
+ id: toLongitude
+ Layout.fillWidth: true
+ }
+
+ RowLayout {
+ id: rowLayout1
+ Layout.columnSpan: 2
+ Layout.alignment: Qt.AlignRight
+ Button {
+ id: goButton
+ text: qsTr("Proceed")
+ }
+
+ Button {
+ id: clearButton
+ text: qsTr("Clear")
+ }
+
+ Button {
+ id: cancelButton
+ text: qsTr("Cancel")
+ }
+ }
+ Item {
+ Layout.fillHeight: true
+ Layout.columnSpan: 2
+ }
+ }
+ }
+}
diff --git a/app/forms/RouteList.qml b/app/forms/RouteList.qml
new file mode 100644
index 0000000..27fa572
--- /dev/null
+++ b/app/forms/RouteList.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+import "../helper.js" as Helper
+
+//! [routeinfomodel0]
+ListView {
+//! [routeinfomodel0]
+ property variant routeModel
+ property string totalTravelTime
+ property string totalDistance
+ signal closeForm()
+//! [routeinfomodel1]
+ interactive: true
+ model: ListModel { id: routeInfoModel }
+ header: RouteListHeader {}
+ delegate: RouteListDelegate{
+ routeIndex.text: index + 1
+ routeInstruction.text: instruction
+ routeDistance.text: distance
+ }
+//! [routeinfomodel1]
+ footer: Button {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Close")
+ onClicked: {
+ closeForm()
+ }
+ }
+
+ Component.onCompleted: {
+ //! [routeinfomodel2]
+ routeInfoModel.clear()
+ if (routeModel.count > 0) {
+ for (var i = 0; i < routeModel.get(0).segments.length; i++) {
+ routeInfoModel.append({
+ "instruction": routeModel.get(0).segments[i].maneuver.instructionText,
+ "distance": Helper.formatDistance(routeModel.get(0).segments[i].maneuver.distanceToNextInstruction)
+ });
+ }
+ }
+ //! [routeinfomodel2]
+ totalTravelTime = routeModel.count == 0 ? "" : Helper.formatTime(routeModel.get(0).travelTime)
+ totalDistance = routeModel.count == 0 ? "" : Helper.formatDistance(routeModel.get(0).distance)
+ }
+//! [routeinfomodel3]
+}
+//! [routeinfomodel3]
diff --git a/app/forms/RouteListDelegate.qml b/app/forms/RouteListDelegate.qml
new file mode 100644
index 0000000..2dc9981
--- /dev/null
+++ b/app/forms/RouteListDelegate.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.2
+
+Item {
+ id: root
+ property bool checked: false
+ property alias routeInstruction: instructionLabel
+ property alias routeDistance: distanceLabel
+ property alias routeIndex: indexLabel
+
+ width: parent.width
+ height: indexLabel.height * 2
+
+ RowLayout {
+ spacing: 10
+ anchors.left: parent.left
+ anchors.leftMargin: 30
+ anchors.verticalCenter: parent.verticalCenter
+ Label {
+ id: indexLabel
+ }
+ Label {
+ id: instructionLabel
+ wrapMode: Text.Wrap
+ }
+ Label {
+ id: distanceLabel
+ }
+ }
+
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: 15
+ height: 1
+ color: "#46a2da"
+ }
+}
+
+
+
diff --git a/app/forms/RouteListHeader.qml b/app/forms/RouteListHeader.qml
new file mode 100644
index 0000000..383f892
--- /dev/null
+++ b/app/forms/RouteListHeader.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+
+Item {
+ property alias travelTime: travelTimeLabel
+ property alias distance: distanceLabel
+ width: parent.width
+ height: tabTitle.height * 3.0
+
+ Rectangle {
+ id: tabRectangle
+ y: tabTitle.height
+ height: tabTitle.height * 2 - 1
+ color: "#46a2da"
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Label {
+ id: tabTitle
+ color: "#ffffff"
+ text: qsTr("Route Information")
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ Label {
+ id: travelTimeLabel
+ text: totalTravelTime
+ color: "#ffffff"
+ font.bold: true
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ }
+
+ Label {
+ id: distanceLabel
+ text: totalDistance
+ color: "#ffffff"
+ font.bold: true
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+}
diff --git a/app/helper.js b/app/helper.js
new file mode 100644
index 0000000..19201d0
--- /dev/null
+++ b/app/helper.js
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+function roundNumber(number, digits)
+{
+ var multiple = Math.pow(10, digits);
+ return Math.round(number * multiple) / multiple;
+}
+
+function formatTime(sec)
+{
+ var value = sec
+ var seconds = value % 60
+ value /= 60
+ value = (value > 1) ? Math.round(value) : 0
+ var minutes = value % 60
+ value /= 60
+ value = (value > 1) ? Math.round(value) : 0
+ var hours = value
+ if (hours > 0) value = hours + "h:"+ minutes + "m"
+ else value = minutes + "min"
+ return value
+}
+
+function formatDistance(meters)
+{
+ var dist = Math.round(meters)
+ if (dist > 1000 ){
+ if (dist > 100000){
+ dist = Math.round(dist / 1000)
+ }
+ else{
+ dist = Math.round(dist / 100)
+ dist = dist / 10
+ }
+ dist = dist + " km"
+ }
+ else{
+ dist = dist + " m"
+ }
+ return dist
+}
diff --git a/app/main.cpp b/app/main.cpp
new file mode 100644
index 0000000..b8516b6
--- /dev/null
+++ b/app/main.cpp
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QCommandLineParser>
+#include <QtCore/QTextStream>
+#include <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+#include <QtQuick/QQuickItem>
+#include <QtCore/QUrlQuery>
+#include <QtQml/QQmlContext>
+#include <QtQml/qqml.h>
+#include <QtQuickControls2/QQuickStyle>
+#include <QQuickWindow>
+#include <libhomescreen.hpp>
+#include <qlibwindowmanager.h>
+
+int main(int argc, char *argv[])
+{
+
+ QString myname = QString("Navigation");
+
+ QGuiApplication app(argc, argv);
+
+ QQuickStyle::setStyle("AGL");
+ QQmlApplicationEngine engine;
+ QQmlContext *context = engine.rootContext();
+
+ 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();
+
+ if (positionalArguments.length() == 2) {
+ int port = positionalArguments.takeFirst().toInt();
+ QString secret = positionalArguments.takeFirst();
+ QUrl bindingAddress;
+ 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);
+ context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress);
+ std::string token = secret.toStdString();
+ LibHomeScreen* hs = new LibHomeScreen();
+ QLibWindowmanager* qwm = new QLibWindowmanager();
+
+ // WindowManager
+ 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);
+ }
+ // Create an event callback against an event type. Here a lambda is called when SyncDraw event occurs
+ qwm->set_event_handler(QLibWindowmanager::Event_SyncDraw, [qwm, myname](json_object *object) {
+ fprintf(stderr, "Surface got syncDraw!\n");
+ qwm->endDraw(myname);
+ });
+
+ // HomeScreen
+ hs->init(port, token.c_str());
+ // Set the event handler for Event_TapShortcut which will activate the surface for windowmanager
+ hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [qwm, myname](json_object *object){
+ json_object *appnameJ = nullptr;
+ if(json_object_object_get_ex(object, "application_name", &appnameJ))
+ {
+ const char *appname = json_object_get_string(appnameJ);
+ if(myname == appname)
+ {
+ qDebug("Surface %s got tapShortcut\n", appname);
+ qwm->activateSurface(myname);
+ }
+ }
+ });
+
+ QVariantMap parameters;
+ parameters[QStringLiteral("osm.useragent")] = QStringLiteral("Automotive Grade Linux Navigation");
+
+ engine.addImportPath(QStringLiteral(":/imports"));
+ engine.load(QUrl(QStringLiteral("qrc:/mapviewer.qml")));
+ QObject::connect(&engine, SIGNAL(quit()), qApp, SLOT(quit()));
+
+ QObject *root = engine.rootObjects().first();
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
+ QObject::connect(window, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateSurface()));
+
+ QMetaObject::invokeMethod(root, "initializeProviders",
+ Q_ARG(QVariant, QVariant::fromValue(parameters)));
+ }
+
+ return app.exec();
+}
diff --git a/app/map/CircleItem.qml b/app/map/CircleItem.qml
new file mode 100644
index 0000000..3b32ba5
--- /dev/null
+++ b/app/map/CircleItem.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.5
+import QtLocation 5.6
+
+//TODO: remove/refactor me when items are integrated
+
+MapCircle {
+
+ color: "#46a2da"
+ border.color: "#190a33"
+ border.width: 2
+ smooth: true
+ opacity: 0.25
+
+ function setGeometry(markers, index){
+ center.latitude = markers[index].coordinate.latitude
+ center.longitude = markers[index].coordinate.longitude
+ radius= center.distanceTo(markers[index + 1].coordinate)
+ }
+}
diff --git a/app/map/ImageItem.qml b/app/map/ImageItem.qml
new file mode 100644
index 0000000..3bf4dfe
--- /dev/null
+++ b/app/map/ImageItem.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.5;
+import QtLocation 5.6
+
+MapQuickItem { //to be used inside MapComponent only
+ id: imageItem
+
+ MouseArea {
+ anchors.fill: parent
+ drag.target: parent
+ }
+
+ function setGeometry(markers, index) {
+ coordinate.latitude = markers[index].coordinate.latitude
+ coordinate.longitude = markers[index].coordinate.longitude
+ }
+
+ sourceItem: Image {
+ id: testImage
+ source: "../resources/icon.png"
+ opacity: 0.7
+ }
+}
diff --git a/app/map/MapComponent.qml b/app/map/MapComponent.qml
new file mode 100644
index 0000000..b4bb330
--- /dev/null
+++ b/app/map/MapComponent.qml
@@ -0,0 +1,677 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+import QtLocation 5.6
+import QtPositioning 5.5
+import "../helper.js" as Helper
+
+//! [top]
+Map {
+ id: map
+//! [top]
+ property variant markers
+ property variant mapItems
+ property variant location
+ property int markerCounter: 0 // counter for total amount of markers. Resets to 0 when number of markers = 0
+ property int currentMarker
+ property int lastX : -1
+ property int lastY : -1
+ property int pressX : -1
+ property int pressY : -1
+ property int jitterThreshold : 30
+ property bool followme: true
+ property variant scaleLengths: [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000, 2000000]
+ property alias routeQuery: routeQuery
+ property alias routeModel: routeModel
+ property alias geocodeModel: geocodeModel
+
+ signal showGeocodeInfo()
+ signal geocodeFinished()
+ signal routeError()
+ signal coordinatesCaptured(double latitude, double longitude)
+ signal showMainMenu(variant coordinate)
+ signal showMarkerMenu(variant coordinate)
+ signal showRouteMenu(variant coordinate)
+ signal showPointMenu(variant coordinate)
+ signal showRouteList()
+
+ function geocodeMessage()
+ {
+ var street, district, city, county, state, countryCode, country, postalCode, latitude, longitude, text
+ latitude = Math.round(geocodeModel.get(0).coordinate.latitude * 10000) / 10000
+ longitude =Math.round(geocodeModel.get(0).coordinate.longitude * 10000) / 10000
+ street = geocodeModel.get(0).address.street
+ district = geocodeModel.get(0).address.district
+ city = geocodeModel.get(0).address.city
+ county = geocodeModel.get(0).address.county
+ state = geocodeModel.get(0).address.state
+ countryCode = geocodeModel.get(0).address.countryCode
+ country = geocodeModel.get(0).address.country
+ postalCode = geocodeModel.get(0).address.postalCode
+
+ text = "<b>Latitude:</b> " + latitude + "<br/>"
+ text +="<b>Longitude:</b> " + longitude + "<br/>" + "<br/>"
+ if (street) text +="<b>Street: </b>"+ street + " <br/>"
+ if (district) text +="<b>District: </b>"+ district +" <br/>"
+ if (city) text +="<b>City: </b>"+ city + " <br/>"
+ if (county) text +="<b>County: </b>"+ county + " <br/>"
+ if (state) text +="<b>State: </b>"+ state + " <br/>"
+ if (countryCode) text +="<b>Country code: </b>"+ countryCode + " <br/>"
+ if (country) text +="<b>Country: </b>"+ country + " <br/>"
+ if (postalCode) text +="<b>PostalCode: </b>"+ postalCode + " <br/>"
+ return text
+ }
+
+ function calculateScale()
+ {
+ var coord1, coord2, dist, text, f
+ f = 0
+ coord1 = map.toCoordinate(Qt.point(0,scale.y))
+ coord2 = map.toCoordinate(Qt.point(0+scaleImage.sourceSize.width,scale.y))
+ dist = Math.round(coord1.distanceTo(coord2))
+
+ if (dist === 0) {
+ // not visible
+ } else {
+ for (var i = 0; i < scaleLengths.length-1; i++) {
+ if (dist < (scaleLengths[i] + scaleLengths[i+1]) / 2 ) {
+ f = scaleLengths[i] / dist
+ dist = scaleLengths[i]
+ break;
+ }
+ }
+ if (f === 0) {
+ f = dist / scaleLengths[i]
+ dist = scaleLengths[i]
+ }
+ }
+
+ text = Helper.formatDistance(dist)
+ scaleImage.width = (scaleImage.sourceSize.width * f) - 2 * scaleImageLeft.sourceSize.width
+ scaleText.text = text
+ }
+
+ function deleteMarkers()
+ {
+ var count = map.markers.length
+ for (var i = 0; i<count; i++){
+ map.removeMapItem(map.markers[i])
+ map.markers[i].destroy()
+ }
+ map.markers = []
+ markerCounter = 0
+ }
+
+ function deleteMapItems()
+ {
+ var count = map.mapItems.length
+ for (var i = 0; i<count; i++){
+ map.removeMapItem(map.mapItems[i])
+ map.mapItems[i].destroy()
+ }
+ map.mapItems = []
+ }
+
+ function addMarker()
+ {
+ var count = map.markers.length
+ markerCounter++
+ var marker = Qt.createQmlObject ('Marker {}', map)
+ map.addMapItem(marker)
+ marker.z = map.z+1
+ marker.coordinate = mouseArea.lastCoordinate
+
+ //update list of markers
+ var myArray = new Array()
+ for (var i = 0; i<count; i++){
+ myArray.push(markers[i])
+ }
+ myArray.push(marker)
+ markers = myArray
+ }
+
+ function addGeoItem(item)
+ {
+ var count = map.mapItems.length
+ var co = Qt.createComponent(item+'.qml')
+ if (co.status == Component.Ready) {
+ var o = co.createObject(map)
+ o.setGeometry(map.markers, currentMarker)
+ map.addMapItem(o)
+ //update list of items
+ var myArray = new Array()
+ for (var i = 0; i<count; i++){
+ myArray.push(mapItems[i])
+ }
+ myArray.push(o)
+ mapItems = myArray
+
+ } else {
+ console.log(item + " is not supported right now, please call us later.")
+ }
+ }
+
+ function deleteMarker(index)
+ {
+ //update list of markers
+ var myArray = new Array()
+ var count = map.markers.length
+ for (var i = 0; i<count; i++){
+ if (index != i) myArray.push(map.markers[i])
+ }
+
+ map.removeMapItem(map.markers[index])
+ map.markers[index].destroy()
+ map.markers = myArray
+ if (markers.length == 0) markerCounter = 0
+ }
+
+ function calculateMarkerRoute()
+ {
+ routeQuery.clearWaypoints();
+ for (var i = currentMarker; i< map.markers.length; i++){
+ routeQuery.addWaypoint(markers[i].coordinate)
+ }
+ routeQuery.travelModes = RouteQuery.CarTravel
+ routeQuery.routeOptimizations = RouteQuery.ShortestRoute
+ routeQuery.setFeatureWeight(0, 0)
+ routeModel.update();
+ }
+
+ function calculateCoordinateRoute(startCoordinate, endCoordinate)
+ {
+ //! [routerequest0]
+ // clear away any old data in the query
+ routeQuery.clearWaypoints();
+
+ // add the start and end coords as waypoints on the route
+ routeQuery.addWaypoint(startCoordinate)
+ routeQuery.addWaypoint(endCoordinate)
+ routeQuery.travelModes = RouteQuery.CarTravel
+ routeQuery.routeOptimizations = RouteQuery.FastestRoute
+
+ //! [routerequest0]
+
+ //! [routerequest0 feature weight]
+ for (var i=0; i<9; i++) {
+ routeQuery.setFeatureWeight(i, 0)
+ }
+ //for (var i=0; i<routeDialog.features.length; i++) {
+ // map.routeQuery.setFeatureWeight(routeDialog.features[i], RouteQuery.AvoidFeatureWeight)
+ //}
+ //! [routerequest0 feature weight]
+
+ //! [routerequest1]
+ routeModel.update();
+
+ //! [routerequest1]
+ //! [routerequest2]
+ // center the map on the start coord
+ map.center = startCoordinate;
+ //! [routerequest2]
+ }
+
+ function geocode(fromAddress)
+ {
+ //! [geocode1]
+ // send the geocode request
+ geocodeModel.query = fromAddress
+ geocodeModel.update()
+ //! [geocode1]
+ }
+
+
+//! [coord]
+ zoomLevel: (maximumZoomLevel - minimumZoomLevel)/2
+//! [coord]
+
+//! [mapnavigation]
+ // Enable pan, flick, and pinch gestures to zoom in and out
+ gesture.acceptedGestures: MapGestureArea.PanGesture | MapGestureArea.FlickGesture | MapGestureArea.PinchGesture
+ gesture.flickDeceleration: 3000
+ gesture.enabled: true
+//! [mapnavigation]
+ focus: true
+ onCopyrightLinkActivated: Qt.openUrlExternally(link)
+
+ onCenterChanged:{
+ scaleTimer.restart()
+ if (map.followme)
+ if (map.center != positionSource.position.coordinate) map.followme = false
+ }
+
+ onZoomLevelChanged:{
+ scaleTimer.restart()
+ if (map.followme) map.center = positionSource.position.coordinate
+ }
+
+ onWidthChanged:{
+ scaleTimer.restart()
+ }
+
+ onHeightChanged:{
+ scaleTimer.restart()
+ }
+
+ Component.onCompleted: {
+ markers = new Array();
+ mapItems = new Array();
+ }
+
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Plus) {
+ map.zoomLevel++;
+ } else if (event.key === Qt.Key_Minus) {
+ map.zoomLevel--;
+ } else if (event.key === Qt.Key_Left || event.key === Qt.Key_Right ||
+ event.key === Qt.Key_Up || event.key === Qt.Key_Down) {
+ var dx = 0;
+ var dy = 0;
+
+ switch (event.key) {
+
+ case Qt.Key_Left: dx = map.width / 4; break;
+ case Qt.Key_Right: dx = -map.width / 4; break;
+ case Qt.Key_Up: dy = map.height / 4; break;
+ case Qt.Key_Down: dy = -map.height / 4; break;
+
+ }
+
+ var mapCenterPoint = Qt.point(map.width / 2.0 - dx, map.height / 2.0 - dy);
+ map.center = map.toCoordinate(mapCenterPoint);
+ }
+ }
+
+ /* @todo
+ Binding {
+ target: map
+ property: 'center'
+ value: positionSource.position.coordinate
+ when: followme
+ }*/
+
+ PositionSource{
+ id: positionSource
+ active: followme
+
+ onPositionChanged: {
+ map.center = positionSource.position.coordinate
+ }
+ }
+
+ MapQuickItem {
+ id: locationPoint
+ sourceItem: Rectangle { width: 14; height: 14; color: "#e41e25"; border.width: 2; border.color: "white"; smooth: true; radius: 7 }
+ coordinate: location
+ opacity: 1.0
+ anchorPoint: Qt.point(sourceItem.width/2, sourceItem.height/2)
+ }
+
+ Slider {
+ id: zoomSlider;
+ z: map.z + 3
+ minimumValue: map.minimumZoomLevel;
+ maximumValue: map.maximumZoomLevel;
+ anchors.margins: 10
+ anchors.bottom: scale.top
+ anchors.top: parent.top
+ anchors.right: parent.right
+ orientation : Qt.Vertical
+ value: map.zoomLevel
+ onValueChanged: {
+ if (value >= 0)
+ map.zoomLevel = value
+ }
+ }
+
+ GridLayout {
+ z: map.z + 3
+ columns: 1
+ width: 300
+ height: 300
+
+ Button {
+ text: "Lookup Route"
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ onClicked: {
+ stackView.pop({item:page, immediate: true})
+ stackView.push(Qt.resolvedUrl("../forms/RouteAddress.qml"),
+ { "plugin": map.plugin,
+ "toAddress": toAddress,
+ "fromAddress": fromAddress})
+ stackView.currentItem.showRoute.connect(map.calculateCoordinateRoute)
+ stackView.currentItem.showMessage.connect(stackView.showMessage)
+ stackView.currentItem.closeForm.connect(stackView.closeForm)
+ }
+ }
+
+ Button {
+ text: "Reverse GeoCode"
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ onClicked: {
+ stackView.pop({item:page, immediate: true})
+ stackView.push(Qt.resolvedUrl("../forms/ReverseGeocode.qml"),
+ { "coordinate": map.location})
+ stackView.currentItem.showPlace.connect(map.geocode)
+ stackView.currentItem.closeForm.connect(stackView.closeForm)
+ }
+ }
+
+ Button {
+ text: "Show Route List"
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ onClicked: {
+ stackView.showRouteListPage()
+ }
+ }
+
+ Button {
+ text: "Clear Route"
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ enabled: map.routeModel.count
+ onClicked: {
+ map.routeModel.reset();
+ map.zoomLevel = map.maximumZoomLevel
+ map.center = map.location
+ }
+ }
+ }
+
+ Item {
+ id: scale
+ z: map.z + 3
+ visible: scaleText.text != "0 m"
+ anchors.bottom: parent.bottom;
+ anchors.right: parent.right
+ anchors.margins: 20
+ height: scaleText.height * 2
+ width: scaleImage.width
+
+ Image {
+ id: scaleImageLeft
+ source: "../resources/scale_end.png"
+ anchors.bottom: parent.bottom
+ anchors.right: scaleImage.left
+ }
+ Image {
+ id: scaleImage
+ source: "../resources/scale.png"
+ anchors.bottom: parent.bottom
+ anchors.right: scaleImageRight.left
+ }
+ Image {
+ id: scaleImageRight
+ source: "../resources/scale_end.png"
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ }
+ Label {
+ id: scaleText
+ color: "#004EAE"
+ anchors.centerIn: parent
+ text: "0 m"
+ }
+ Component.onCompleted: {
+ map.calculateScale();
+ }
+ }
+
+ //! [routemodel0]
+ RouteModel {
+ id: routeModel
+ plugin : map.plugin
+ query: RouteQuery {
+ id: routeQuery
+ }
+ onStatusChanged: {
+ if (status == RouteModel.Ready) {
+ switch (count) {
+ case 0:
+ // technically not an error
+ map.routeError()
+ break
+ case 1:
+ map.showRouteList()
+ break
+ }
+ } else if (status == RouteModel.Error) {
+ map.routeError()
+ }
+ }
+ }
+ //! [routemodel0]
+
+ //! [routedelegate0]
+ Component {
+ id: routeDelegate
+
+ MapRoute {
+ id: route
+ route: routeData
+ line.color: "#46a2da"
+ line.width: 5
+ smooth: true
+ opacity: 0.8
+ //! [routedelegate0]
+ MouseArea {
+ id: routeMouseArea
+ anchors.fill: parent
+ hoverEnabled: false
+ property variant lastCoordinate
+
+ onPressed : {
+ map.lastX = mouse.x + parent.x
+ map.lastY = mouse.y + parent.y
+ map.pressX = mouse.x + parent.x
+ map.pressY = mouse.y + parent.y
+ lastCoordinate = map.toCoordinate(Qt.point(mouse.x, mouse.y))
+ }
+
+ onPositionChanged: {
+ if (mouse.button == Qt.LeftButton) {
+ map.lastX = mouse.x + parent.x
+ map.lastY = mouse.y + parent.y
+ }
+ }
+
+ onPressAndHold:{
+ if (Math.abs(map.pressX - parent.x- mouse.x ) < map.jitterThreshold
+ && Math.abs(map.pressY - parent.y - mouse.y ) < map.jitterThreshold) {
+ showRouteMenu(lastCoordinate);
+ }
+ }
+
+ }
+ //! [routedelegate1]
+ }
+ }
+ //! [routedelegate1]
+
+ //! [geocodemodel0]
+ 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
+ }
+ }
+ }
+ //! [geocodemodel0]
+
+ //! [pointdel0]
+ Component {
+ id: pointDelegate
+
+ MapCircle {
+ id: point
+ color: "#46a2da"
+ border.color: "#190a33"
+ border.width: 2
+ smooth: true
+ opacity: 0.25
+ center: locationData.coordinate
+ //! [pointdel0]
+ MouseArea {
+ anchors.fill:parent
+ id: circleMouseArea
+ hoverEnabled: false
+ property variant lastCoordinate
+
+ onPressed : {
+ map.lastX = mouse.x + parent.x
+ map.lastY = mouse.y + parent.y
+ map.pressX = mouse.x + parent.x
+ map.pressY = mouse.y + parent.y
+ lastCoordinate = map.toCoordinate(Qt.point(mouse.x, mouse.y))
+ }
+
+ onPositionChanged: {
+ if (Math.abs(map.pressX - parent.x- mouse.x ) > map.jitterThreshold ||
+ Math.abs(map.pressY - parent.y -mouse.y ) > map.jitterThreshold) {
+ if (pressed) parent.radius = parent.center.distanceTo(
+ map.toCoordinate(Qt.point(mouse.x, mouse.y)))
+ }
+ if (mouse.button == Qt.LeftButton) {
+ map.lastX = mouse.x + parent.x
+ map.lastY = mouse.y + parent.y
+ }
+ }
+
+ onPressAndHold:{
+ if (Math.abs(map.pressX - parent.x- mouse.x ) < map.jitterThreshold
+ && Math.abs(map.pressY - parent.y - mouse.y ) < map.jitterThreshold) {
+ showPointMenu(lastCoordinate);
+ }
+ }
+ }
+ //! [pointdel1]
+ }
+ }
+ //! [pointdel1]
+
+ //! [routeview0]
+ MapItemView {
+ model: routeModel
+ delegate: routeDelegate
+ //! [routeview0]
+ autoFitViewport: true
+ //! [routeview1]
+ }
+ //! [routeview1]
+
+ //! [geocodeview]
+ MapItemView {
+ model: geocodeModel
+ delegate: pointDelegate
+ }
+ //! [geocodeview]
+
+ Timer {
+ id: scaleTimer
+ interval: 100
+ running: false
+ repeat: false
+ onTriggered: {
+ map.calculateScale()
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+ property variant lastCoordinate
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+
+ onPressed : {
+ map.lastX = mouse.x
+ map.lastY = mouse.y
+ map.pressX = mouse.x
+ map.pressY = mouse.y
+ lastCoordinate = map.toCoordinate(Qt.point(mouse.x, mouse.y))
+ }
+
+ onPositionChanged: {
+ if (mouse.button == Qt.LeftButton) {
+ map.lastX = mouse.x
+ map.lastY = mouse.y
+ }
+ }
+
+ onDoubleClicked: {
+ var mouseGeoPos = map.toCoordinate(Qt.point(mouse.x, mouse.y));
+ var preZoomPoint = map.fromCoordinate(mouseGeoPos, false);
+ if (mouse.button === Qt.LeftButton) {
+ map.zoomLevel++;
+ } else if (mouse.button === Qt.RightButton) {
+ map.zoomLevel--;
+ }
+ var postZoomPoint = map.fromCoordinate(mouseGeoPos, false);
+ var dx = postZoomPoint.x - preZoomPoint.x;
+ var dy = postZoomPoint.y - preZoomPoint.y;
+
+ var mapCenterPoint = Qt.point(map.width / 2.0 + dx, map.height / 2.0 + dy);
+ map.center = map.toCoordinate(mapCenterPoint);
+
+ lastX = -1;
+ lastY = -1;
+ }
+
+ onPressAndHold:{
+ if (Math.abs(map.pressX - mouse.x ) < map.jitterThreshold
+ && Math.abs(map.pressY - mouse.y ) < map.jitterThreshold) {
+ showMainMenu(lastCoordinate);
+ }
+ }
+ }
+//! [end]
+}
+//! [end]
diff --git a/app/map/Marker.qml b/app/map/Marker.qml
new file mode 100644
index 0000000..3c0ed17
--- /dev/null
+++ b/app/map/Marker.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5;
+import QtLocation 5.6
+
+//! [mqi-top]
+MapQuickItem {
+ id: marker
+//! [mqi-top]
+ property alias lastMouseX: markerMouseArea.lastX
+ property alias lastMouseY: markerMouseArea.lastY
+
+//! [mqi-anchor]
+ anchorPoint.x: image.width/4
+ anchorPoint.y: image.height
+
+ sourceItem: Image {
+ id: image
+//! [mqi-anchor]
+ source: "../resources/marker.png"
+ opacity: markerMouseArea.pressed ? 0.6 : 1.0
+ MouseArea {
+ id: markerMouseArea
+ property int pressX : -1
+ property int pressY : -1
+ property int jitterThreshold : 10
+ property int lastX: -1
+ property int lastY: -1
+ anchors.fill: parent
+ hoverEnabled : false
+ drag.target: marker
+ preventStealing: true
+
+ onPressed : {
+ map.pressX = mouse.x
+ map.pressY = mouse.y
+ map.currentMarker = -1
+ for (var i = 0; i< map.markers.length; i++){
+ if (marker == map.markers[i]){
+ map.currentMarker = i
+ break
+ }
+ }
+ }
+
+ onPressAndHold:{
+ if (Math.abs(map.pressX - mouse.x ) < map.jitterThreshold
+ && Math.abs(map.pressY - mouse.y ) < map.jitterThreshold) {
+ var p = map.fromCoordinate(marker.coordinate)
+ lastX = p.x
+ lastY = p.y
+ map.showMarkerMenu(marker.coordinate)
+ }
+ }
+ }
+
+ Text{
+ id: number
+ y: image.height/10
+ width: image.width
+ color: "white"
+ font.bold: true
+ font.pixelSize: 14
+ horizontalAlignment: Text.AlignHCenter
+ Component.onCompleted: {
+ text = map.markerCounter
+ }
+ }
+
+//! [mqi-closeimage]
+ }
+//! [mqi-closeimage]
+
+ Component.onCompleted: coordinate = map.toCoordinate(Qt.point(markerMouseArea.mouseX,
+ markerMouseArea.mouseY));
+//! [mqi-close]
+}
+//! [mqi-close]
diff --git a/app/map/PolygonItem.qml b/app/map/PolygonItem.qml
new file mode 100644
index 0000000..cab4e6c
--- /dev/null
+++ b/app/map/PolygonItem.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.5
+import QtLocation 5.6
+
+//TODO: remove me when items are integrated
+
+MapPolygon {
+
+ color: "#46a2da"
+ border.color: "#190a33"
+ border.width: 2
+ smooth: true
+ opacity: 0.25
+
+ function setGeometry(markers, index){
+ for (var i = index; i<markers.length; i++){
+ addCoordinate(markers[i].coordinate)
+ }
+ }
+ MouseArea {
+ anchors.fill:parent
+ id: mousearea
+ drag.target: parent
+ }
+}
diff --git a/app/map/PolylineItem.qml b/app/map/PolylineItem.qml
new file mode 100644
index 0000000..c27d8b7
--- /dev/null
+++ b/app/map/PolylineItem.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.5
+import QtLocation 5.6
+
+//TODO: remove/refactor me when items are integrated
+
+MapPolyline {
+
+ line.color: "#46a2da"
+ line.width: 4
+ opacity: 0.25
+ smooth: true
+
+ function setGeometry(markers, index){
+ for (var i = index; i<markers.length; i++){
+ addCoordinate(markers[i].coordinate)
+ }
+ }
+}
diff --git a/app/map/RectangleItem.qml b/app/map/RectangleItem.qml
new file mode 100644
index 0000000..8369c90
--- /dev/null
+++ b/app/map/RectangleItem.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.5
+import QtLocation 5.6
+
+MapRectangle {
+ id: mapRectangle
+
+ color: "#46a2da"
+ border.color: "#190a33"
+ border.width: 2
+ smooth: true
+ opacity: 0.25
+
+ function setGeometry(markers, index){
+ topLeft.latitude = Math.max(markers[index].coordinate.latitude, markers[index + 1].coordinate.latitude)
+ topLeft.longitude = Math.min(markers[index].coordinate.longitude, markers[index + 1].coordinate.longitude)
+ bottomRight.latitude = Math.min(markers[index].coordinate.latitude, markers[index + 1].coordinate.latitude)
+ bottomRight.longitude = Math.max(markers[index].coordinate.longitude, markers[index + 1].coordinate.longitude)
+ }
+
+}
diff --git a/app/mapviewer.qml b/app/mapviewer.qml
new file mode 100644
index 0000000..c99a2fc
--- /dev/null
+++ b/app/mapviewer.qml
@@ -0,0 +1,466 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 2.0
+import QtLocation 5.6
+import QtPositioning 5.5
+import AGL.Demo.Controls 1.0
+import "map"
+import "menus"
+import "helper.js" as Helper
+
+ApplicationWindow {
+ id: appWindow
+ property variant map
+ property variant parameters
+
+ //defaults
+ //! [routecoordinate]
+ property variant fromCoordinate: QtPositioning.coordinate(59.9483, 10.7695)
+ property variant toCoordinate: QtPositioning.coordinate(59.9645, 10.671)
+ //! [routecoordinate]
+
+ function createMap(provider)
+ {
+ var plugin
+
+ if (parameters && parameters.length>0)
+ plugin = Qt.createQmlObject ('import QtLocation 5.6; Plugin{ name:"' + provider + '"; parameters: appWindow.parameters}', appWindow)
+ else
+ plugin = Qt.createQmlObject ('import QtLocation 5.6; Plugin{ name:"' + provider + '"}', appWindow)
+
+ var zoomLevel = null
+ var center = null
+ if (map) {
+ zoomLevel = map.zoomLevel
+ center = map.center
+ map.destroy()
+ }
+
+ map = mapComponent.createObject(page);
+ map.plugin = plugin;
+
+ if (zoomLevel != null) {
+ map.zoomLevel = zoomLevel
+ map.center = center
+ } else {
+ map.zoomLevel = map.maximumZoomLevel
+ }
+
+ map.forceActiveFocus()
+ }
+
+ function getPlugins()
+ {
+ var plugin = Qt.createQmlObject ('import QtLocation 5.6; Plugin {}', appWindow)
+ var myArray = new Array()
+ for (var i = 0; i<plugin.availableServiceProviders.length; i++) {
+ var tempPlugin = Qt.createQmlObject ('import QtLocation 5.6; Plugin {name: "' + plugin.availableServiceProviders[i]+ '"}', appWindow)
+ if (tempPlugin.supportsMapping())
+ myArray.push(tempPlugin.name)
+ }
+ myArray.sort()
+ return myArray
+ }
+
+ function initializeProviders(pluginParameters)
+ {
+ var parameters = new Array()
+ for (var prop in pluginParameters){
+ var parameter = Qt.createQmlObject('import QtLocation 5.6; PluginParameter{ name: "'+ prop + '"; value: "' + pluginParameters[prop]+'"}',appWindow)
+ parameters.push(parameter)
+ }
+ appWindow.parameters = parameters
+ var plugins = getPlugins()
+ mainMenu.providerMenu.createMenu(plugins)
+ for (var i = 0; i<plugins.length; i++) {
+ if (plugins[i] === "osm")
+ mainMenu.selectProvider(plugins[i])
+ }
+ }
+
+ visible: true
+ //menuBar: mainMenu
+
+ //! [geocode0]
+ Address {
+ id :fromAddress
+ street: "Sandakerveien 116"
+ city: "Oslo"
+ country: "Norway"
+ state : ""
+ postalCode: "0484"
+ }
+ //! [geocode0]
+
+ Address {
+ id: toAddress
+ street: "Holmenkollveien 140"
+ city: "Oslo"
+ country: "Norway"
+ postalCode: "0791"
+ }
+
+ MainMenu {
+ id: mainMenu
+
+ function setLanguage(lang)
+ {
+ map.plugin.locales = lang;
+ stackView.pop(page)
+ }
+
+ onSelectProvider: {
+ stackView.pop()
+ for (var i = 0; i < providerMenu.items.length; i++) {
+ providerMenu.items[i].checked = providerMenu.items[i].text === providerName
+ }
+
+ createMap(providerName)
+ if (map.error === Map.NoError) {
+ selectMapType(map.activeMapType)
+ toolsMenu.createMenu(map);
+ } else {
+ mapTypeMenu.clear();
+ toolsMenu.clear();
+ }
+ }
+
+ onSelectMapType: {
+ stackView.pop(page)
+ for (var i = 0; i < mapTypeMenu.items.length; i++) {
+ mapTypeMenu.items[i].checked = mapTypeMenu.items[i].text === mapType.name
+ }
+ map.activeMapType = mapType
+ }
+
+
+ onSelectTool: {
+ switch (tool) {
+ case "AddressRoute":
+ stackView.pop({item:page, immediate: true})
+ stackView.push(Qt.resolvedUrl("forms/RouteAddress.qml"),
+ { "plugin": map.plugin,
+ "toAddress": toAddress,
+ "fromAddress": fromAddress})
+ stackView.currentItem.showRoute.connect(map.calculateCoordinateRoute)
+ stackView.currentItem.showMessage.connect(stackView.showMessage)
+ stackView.currentItem.closeForm.connect(stackView.closeForm)
+ break
+ case "CoordinateRoute":
+ stackView.pop({item:page, immediate: true})
+ stackView.push(Qt.resolvedUrl("forms/RouteCoordinate.qml"),
+ { "toCoordinate": toCoordinate,
+ "fromCoordinate": fromCoordinate})
+ stackView.currentItem.showRoute.connect(map.calculateCoordinateRoute)
+ stackView.currentItem.closeForm.connect(stackView.closeForm)
+ break
+ case "Geocode":
+ stackView.pop({item:page, immediate: true})
+ stackView.push(Qt.resolvedUrl("forms/Geocode.qml"),
+ { "address": fromAddress})
+ stackView.currentItem.showPlace.connect(map.geocode)
+ stackView.currentItem.closeForm.connect(stackView.closeForm)
+ break
+ case "RevGeocode":
+ stackView.pop({item:page, immediate: true})
+ stackView.push(Qt.resolvedUrl("forms/ReverseGeocode.qml"),
+ { "coordinate": fromCoordinate})
+ stackView.currentItem.showPlace.connect(map.geocode)
+ stackView.currentItem.closeForm.connect(stackView.closeForm)
+ break
+ case "Language":
+ stackView.pop({item:page, immediate: true})
+ stackView.push(Qt.resolvedUrl("forms/Locale.qml"),
+ { "locale": map.plugin.locales[0]})
+ stackView.currentItem.selectLanguage.connect(setLanguage)
+ stackView.currentItem.closeForm.connect(stackView.closeForm)
+ break
+ case "Clear":
+ map.clearData()
+ break
+ case "Prefetch":
+ map.prefetchData()
+ break
+ default:
+ console.log("Unsupported operation")
+ }
+ }
+
+ onToggleMapState: {
+ stackView.pop(page)
+ switch (state) {
+ case "FollowMe":
+ map.followme = !map.followme
+ break
+ default:
+ console.log("Unsupported operation")
+ }
+ }
+ }
+
+ MapPopupMenu {
+ id: mapPopupMenu
+
+ function show(coordinate)
+ {
+ stackView.pop(page)
+ mapPopupMenu.coordinate = coordinate
+ mapPopupMenu.markersCount = map.markers.length
+ mapPopupMenu.mapItemsCount = map.mapItems.length
+ mapPopupMenu.update()
+ mapPopupMenu.popup()
+ }
+
+ onItemClicked: {
+ stackView.pop(page)
+ switch (item) {
+ case "addMarker":
+ map.addMarker()
+ break
+ case "getCoordinate":
+ map.coordinatesCaptured(coordinate.latitude, coordinate.longitude)
+ break
+ case "fitViewport":
+ map.fitViewportToMapItems()
+ break
+ case "deleteMarkers":
+ map.deleteMarkers()
+ break
+ case "deleteItems":
+ map.deleteMapItems()
+ break
+ default:
+ console.log("Unsupported operation")
+ }
+ }
+ }
+
+ MarkerPopupMenu {
+ id: markerPopupMenu
+
+ function show(coordinate)
+ {
+ stackView.pop(page)
+ markerPopupMenu.markersCount = map.markers.length
+ markerPopupMenu.update()
+ markerPopupMenu.popup()
+ }
+
+ function askForCoordinate()
+ {
+ stackView.push(Qt.resolvedUrl("forms/ReverseGeocode.qml"),
+ { "title": qsTr("New Coordinate"),
+ "coordinate": map.markers[map.currentMarker].coordinate})
+ stackView.currentItem.showPlace.connect(moveMarker)
+ stackView.currentItem.closeForm.connect(stackView.closeForm)
+ }
+
+ function moveMarker(coordinate)
+ {
+ map.markers[map.currentMarker].coordinate = coordinate;
+ map.center = coordinate;
+ stackView.pop(page)
+ }
+
+ onItemClicked: {
+ stackView.pop(page)
+ switch (item) {
+ case "deleteMarker":
+ map.deleteMarker(map.currentMarker)
+ break;
+ case "getMarkerCoordinate":
+ map.coordinatesCaptured(map.markers[map.currentMarker].coordinate.latitude, map.markers[map.currentMarker].coordinate.longitude)
+ break;
+ case "moveMarkerTo":
+ askForCoordinate()
+ break;
+ case "routeToNextPoint":
+ case "routeToNextPoints":
+ map.calculateMarkerRoute()
+ break
+ case "distanceToNextPoint":
+ var coordinate1 = map.markers[currentMarker].coordinate;
+ var coordinate2 = map.markers[currentMarker+1].coordinate;
+ var distance = Helper.formatDistance(coordinate1.distanceTo(coordinate2));
+ stackView.showMessage(qsTr("Distance"),"<b>" + qsTr("Distance:") + "</b> " + distance)
+ break
+ case "drawImage":
+ map.addGeoItem("ImageItem")
+ break
+ case "drawRectangle":
+ map.addGeoItem("RectangleItem")
+ break
+ case "drawCircle":
+ map.addGeoItem("CircleItem")
+ break;
+ case "drawPolyline":
+ map.addGeoItem("PolylineItem")
+ break;
+ case "drawPolygonMenu":
+ map.addGeoItem("PolygonItem")
+ break
+ default:
+ console.log("Unsupported operation")
+ }
+ }
+ }
+
+ ItemPopupMenu {
+ id: itemPopupMenu
+
+ function show(type,coordinate)
+ {
+ stackView.pop(page)
+ itemPopupMenu.type = type
+ itemPopupMenu.update()
+ itemPopupMenu.popup()
+ }
+
+ onItemClicked: {
+ stackView.pop(page)
+ switch (item) {
+ case "showRouteInfo":
+ stackView.showRouteListPage()
+ break;
+ case "deleteRoute":
+ map.routeModel.reset();
+ break;
+ case "showPointInfo":
+ map.showGeocodeInfo()
+ break;
+ case "deletePoint":
+ map.geocodeModel.reset()
+ break;
+ default:
+ console.log("Unsupported operation")
+ }
+ }
+ }
+
+ StackView {
+ id: stackView
+ anchors.fill: parent
+ focus: true
+ initialItem: Item {
+ id: page
+ }
+
+ function showMessage(title,message,backPage)
+ {
+ push(Qt.resolvedUrl("forms/Message.qml"),
+ {
+ "title" : title,
+ "message" : message,
+ "backPage" : backPage
+ })
+ currentItem.closeForm.connect(closeMessage)
+ }
+
+ function closeMessage(backPage)
+ {
+ pop(backPage)
+ }
+
+ function closeForm()
+ {
+ pop(page)
+ }
+
+ function showRouteListPage()
+ {
+ push(Qt.resolvedUrl("forms/RouteList.qml") ,
+ {
+ "routeModel" : map.routeModel
+ })
+ currentItem.closeForm.connect(closeForm)
+ }
+ }
+
+ Component {
+ id: mapComponent
+
+ MapComponent{
+ width: page.width
+ height: page.height
+ onFollowmeChanged: mainMenu.isFollowMe = map.followme
+ onSupportedMapTypesChanged: mainMenu.mapTypeMenu.createMenu(map)
+ onCoordinatesCaptured: {
+ var text = "<b>" + qsTr("Latitude:") + "</b> " + Helper.roundNumber(latitude,4) + "<br/><b>" + qsTr("Longitude:") + "</b> " + Helper.roundNumber(longitude,4)
+ stackView.showMessage(qsTr("Coordinates"),text);
+ }
+ onGeocodeFinished:{
+ if (map.geocodeModel.status == GeocodeModel.Ready) {
+ if (map.geocodeModel.count == 0) {
+ stackView.showMessage(qsTr("Geocode Error"),qsTr("Unsuccessful geocode"))
+ } else if (map.geocodeModel.count > 1) {
+ stackView.showMessage(qsTr("Ambiguous geocode"), map.geocodeModel.count + " " +
+ qsTr("results found for the given address, please specify location"))
+ } else {
+ stackView.showMessage(qsTr("Location"), geocodeMessage(),page)
+ }
+ } else if (map.geocodeModel.status == GeocodeModel.Error) {
+ stackView.showMessage(qsTr("Geocode Error"),qsTr("Unsuccessful geocode"))
+ }
+ }
+ onRouteError: stackView.showMessage(qsTr("Route Error"),qsTr("Unable to find a route for the given points"),page)
+
+ onShowGeocodeInfo: stackView.showMessage(qsTr("Location"),geocodeMessage(),page)
+
+ onErrorChanged: {
+ if (map.error != Map.NoError) {
+ var title = qsTr("ProviderError")
+ var message = map.errorString + "<br/><br/><b>" + qsTr("Try to select other provider") + "</b>"
+ if (map.error == Map.MissingRequiredParameterError)
+ message += "<br/>" + qsTr("or see") + " \'mapviewer --help\' "
+ + qsTr("how to pass plugin parameters.")
+ stackView.showMessage(title,message);
+ }
+ }
+ //onShowMainMenu: mapPopupMenu.show(coordinate)
+ onShowMarkerMenu: markerPopupMenu.show(coordinate)
+ onShowRouteMenu: itemPopupMenu.show("Route",coordinate)
+ onShowPointMenu: itemPopupMenu.show("Point",coordinate)
+ onShowRouteList: stackView.showRouteListPage()
+ }
+ }
+}
diff --git a/app/mapviewer.qrc b/app/mapviewer.qrc
new file mode 100644
index 0000000..a85289e
--- /dev/null
+++ b/app/mapviewer.qrc
@@ -0,0 +1,36 @@
+<RCC>
+ <qresource prefix="/">
+ <file>mapviewer.qml</file>
+ <file>map/MapComponent.qml</file>
+ <file>map/Marker.qml</file>
+ <file>map/PolylineItem.qml</file>
+ <file>map/RectangleItem.qml</file>
+ <file>map/CircleItem.qml</file>
+ <file>map/PolygonItem.qml</file>
+ <file>map/ImageItem.qml</file>
+ <file>forms/Message.qml</file>
+ <file>forms/MessageForm.ui.qml</file>
+ <file>forms/Geocode.qml</file>
+ <file>forms/GeocodeForm.ui.qml</file>
+ <file>forms/ReverseGeocode.qml</file>
+ <file>forms/ReverseGeocodeForm.ui.qml</file>
+ <file>forms/RouteCoordinate.qml</file>
+ <file>forms/RouteCoordinateForm.ui.qml</file>
+ <file>forms/RouteAddress.qml</file>
+ <file>forms/RouteAddressForm.ui.qml</file>
+ <file>forms/Locale.qml</file>
+ <file>forms/LocaleForm.ui.qml</file>
+ <file>forms/RouteList.qml</file>
+ <file>forms/RouteListDelegate.qml</file>
+ <file>forms/RouteListHeader.qml</file>
+ <file>menus/MainMenu.qml</file>
+ <file>menus/MapPopupMenu.qml</file>
+ <file>menus/MarkerPopupMenu.qml</file>
+ <file>menus/ItemPopupMenu.qml</file>
+ <file>helper.js</file>
+ <file>resources/scale_end.png</file>
+ <file>resources/scale.png</file>
+ <file>resources/marker.png</file>
+ <file>resources/icon.png</file>
+ </qresource>
+</RCC>
diff --git a/app/menus/ItemPopupMenu.qml b/app/menus/ItemPopupMenu.qml
new file mode 100644
index 0000000..8d7e2f7
--- /dev/null
+++ b/app/menus/ItemPopupMenu.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+
+Menu {
+ property variant type
+ signal itemClicked(string item)
+
+ function update() {
+ clear()
+ addItem(qsTr("Info")).triggered.connect(function(){itemClicked("show" + type + "Info")})
+ addItem(qsTr("Delete")).triggered.connect(function(){itemClicked("delete" + type )})
+ }
+}
diff --git a/app/menus/MainMenu.qml b/app/menus/MainMenu.qml
new file mode 100644
index 0000000..fe2bfa1
--- /dev/null
+++ b/app/menus/MainMenu.qml
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+import QtLocation 5.6
+
+MenuBar {
+ property variant providerMenu: providerMenu
+ property variant mapTypeMenu: mapTypeMenu
+ property variant toolsMenu: toolsMenu
+ property alias isFollowMe: toolsMenu.isFollowMe
+
+ signal selectProvider(string providerName)
+ signal selectMapType(variant mapType)
+ signal selectTool(string tool);
+ signal toggleMapState(string state)
+
+ Menu {
+ id: providerMenu
+ title: qsTr("Provider")
+
+ function createMenu(plugins)
+ {
+ clear()
+ for (var i = 0; i < plugins.length; i++) {
+ createProviderMenuItem(plugins[i]);
+ }
+ }
+
+ function createProviderMenuItem(provider)
+ {
+ var item = addItem(provider);
+ item.checkable = true;
+ item.triggered.connect(function(){selectProvider(provider)})
+ }
+ }
+
+ Menu {
+ id: mapTypeMenu
+ title: qsTr("MapType")
+
+ function createMenu(map)
+ {
+ clear()
+ for (var i = 0; i<map.supportedMapTypes.length; i++) {
+ createMapTypeMenuItem(map.supportedMapTypes[i]).checked =
+ (map.activeMapType === map.supportedMapTypes[i]);
+ }
+ }
+
+ function createMapTypeMenuItem(mapType)
+ {
+ var item = addItem(mapType.name);
+ item.checkable = true;
+ item.triggered.connect(function(){selectMapType(mapType)})
+ return item;
+ }
+ }
+
+ Menu {
+ id: toolsMenu
+ property bool isFollowMe: false;
+ title: qsTr("Tools")
+
+ function createMenu(map)
+ {
+ clear()
+ if (map.plugin.supportsGeocoding(Plugin.ReverseGeocodingFeature)) {
+ addItem(qsTr("Reverse geocode")).triggered.connect(function(){selectTool("RevGeocode")})
+ }
+ if (map.plugin.supportsGeocoding()) {
+ addItem(qsTr("Geocode")).triggered.connect(function(){selectTool("Geocode")})
+ }
+ if (map.plugin.supportsRouting()) {
+ addItem(qsTr("Route with coordinates")).triggered.connect(function(){selectTool("CoordinateRoute")})
+ addItem(qsTr("Route with address")).triggered.connect(function(){selectTool("AddressRoute")})
+ }
+
+ var item = addItem("")
+ item.text = Qt.binding(function() { return isFollowMe ? qsTr("Stop following") : qsTr("Follow me")})
+ item.triggered.connect(function() {toggleMapState("FollowMe")})
+
+ addItem(qsTr("Language")).triggered.connect(function(){selectTool("Language")})
+ addItem(qsTr("Prefetch Map Data")).triggered.connect(function(){selectTool("Prefetch")})
+ addItem(qsTr("Clear Map Data")).triggered.connect(function(){selectTool("Clear")})
+ }
+ }
+}
diff --git a/app/menus/MapPopupMenu.qml b/app/menus/MapPopupMenu.qml
new file mode 100644
index 0000000..b8cc841
--- /dev/null
+++ b/app/menus/MapPopupMenu.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+
+Menu {
+ property variant coordinate
+ property int markersCount
+ property int mapItemsCount
+ signal itemClicked(string item)
+
+ function update() {
+ clear()
+ addItem(qsTr("Add Marker")).triggered.connect(function(){itemClicked("addMarker")})
+ addItem(qsTr("Get coordinate")).triggered.connect(function(){itemClicked("getCoordinate")})
+ addItem(qsTr("Fit Viewport To Map Items")).triggered.connect(function(){itemClicked("fitViewport")})
+
+ if (markersCount > 0) {
+ addItem(qsTr("Delete all markers")).triggered.connect(function(){itemClicked("deleteMarkers")})
+ }
+
+ if (mapItemsCount > 0) {
+ addItem(qsTr("Delete all items")).triggered.connect(function(){itemClicked("deleteItems")})
+ }
+ }
+}
diff --git a/app/menus/MarkerPopupMenu.qml b/app/menus/MarkerPopupMenu.qml
new file mode 100644
index 0000000..61855ff
--- /dev/null
+++ b/app/menus/MarkerPopupMenu.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+
+Menu {
+ property int currentMarker
+ property int markersCount
+ signal itemClicked(string item)
+
+ function update() {
+ clear()
+ addItem(qsTr("Delete")).triggered.connect(function(){itemClicked("deleteMarker")})
+ addItem(qsTr("Coordinates")).triggered.connect(function(){itemClicked("getMarkerCoordinate")})
+ addItem(qsTr("Move to")).triggered.connect(function(){itemClicked("moveMarkerTo")})
+ if (currentMarker == markersCount-2){
+ addItem(qsTr("Route to next point")).triggered.connect(function(){itemClicked("routeToNextPoint")});
+ addItem(qsTr("Distance to next point")).triggered.connect(function(){itemClicked("distanceToNextPoint")});
+ }
+ if (currentMarker < markersCount-2){
+ addItem(qsTr("Route to next points")).triggered.connect(function(){itemClicked("routeToNextPoints")});
+ addItem(qsTr("Distance to next point")).triggered.connect(function(){itemClicked("distanceToNextPoint")});
+ }
+
+ var menu = addMenu(qsTr("Draw..."))
+ menu.addItem(qsTr("Image")).triggered.connect(function(){itemClicked("drawImage")})
+
+ if (currentMarker <= markersCount-2){
+ menu.addItem(qsTr("Rectangle")).triggered.connect(function(){itemClicked("drawRectangle")})
+ menu.addItem(qsTr("Circle")).triggered.connect(function(){itemClicked("drawCircle")})
+ menu.addItem(qsTr("Polyline")).triggered.connect(function(){itemClicked("drawPolyline")})
+ }
+
+ if (currentMarker < markersCount-2){
+ menu.addItem(qsTr("Polygon")).triggered.connect(function(){itemClicked("drawPolygonMenu")})
+ }
+ }
+}
diff --git a/app/resources/icon.png b/app/resources/icon.png
new file mode 100644
index 0000000..973a500
--- /dev/null
+++ b/app/resources/icon.png
Binary files differ
diff --git a/app/resources/marker.png b/app/resources/marker.png
new file mode 100644
index 0000000..2116dfd
--- /dev/null
+++ b/app/resources/marker.png
Binary files differ
diff --git a/app/resources/scale.png b/app/resources/scale.png
new file mode 100644
index 0000000..c4f0812
--- /dev/null
+++ b/app/resources/scale.png
Binary files differ
diff --git a/app/resources/scale_end.png b/app/resources/scale_end.png
new file mode 100644
index 0000000..94510b1
--- /dev/null
+++ b/app/resources/scale_end.png
Binary files differ
diff --git a/navigation.pro b/navigation.pro
new file mode 100644
index 0000000..579a952
--- /dev/null
+++ b/navigation.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS = app package
+package.depends += app
diff --git a/package/config.xml b/package/config.xml
new file mode 100644
index 0000000..eec243d
--- /dev/null
+++ b/package/config.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="navigation" version="0.1">
+ <name>Navigation</name>
+ <icon src="icon.svg"/>
+ <content src="bin/navigation" type="application/vnd.agl.native"/>
+ <description>This is a demo application for navigation</description>
+ <author>Matt Ranostay &lt;matt.ranostay@konsulko.com&gt;</author>
+ <license>APL 2.0</license>
+ <feature name="urn:AGL:widget:required-api">
+ <param name="gps" value="ws" />
+ <param name="windowmanager" value="ws" />
+ <param name="homescreen" value="ws" />
+ </feature>
+ <feature name="urn:AGL:widget:required-permission">
+ <param name="urn:AGL:permission::public:no-htdocs" value="required" />
+ </feature>
+</widget>
diff --git a/package/icon.svg b/package/icon.svg
new file mode 100644
index 0000000..91661a7
--- /dev/null
+++ b/package/icon.svg
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ xmlns:i="&amp;ns_ai;"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 320 320"
+ style="enable-background:new 0 0 320 320;"
+ xml:space="preserve"
+ id="svg2"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="icon.svg"><metadata
+ id="metadata1292"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs1290" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2560"
+ inkscape:window-height="1464"
+ id="namedview1288"
+ showgrid="false"
+ inkscape:zoom="0.7375"
+ inkscape:cx="-572.20339"
+ inkscape:cy="160"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg2" /><style
+ type="text/css"
+ id="style4">
+ .st0{display:none;}
+ .st1{display:inline;}
+ .st2{opacity:0.4;fill:url(#SVGID_1_);}
+ .st3{fill:url(#SVGID_2_);}
+ .st4{fill:#FFFFFF;}
+ .st5{font-family:'Roboto-Regular';}
+ .st6{font-size:25px;}
+ .st7{letter-spacing:6;}
+ .st8{fill:url(#SVGID_3_);}
+ .st9{fill:url(#SVGID_4_);}
+ .st10{fill:url(#SVGID_5_);}
+ .st11{fill:url(#SVGID_6_);}
+ .st12{fill:url(#SVGID_7_);}
+ .st13{fill:url(#SVGID_8_);}
+ .st14{fill:url(#SVGID_9_);}
+ .st15{fill:url(#SVGID_10_);}
+ .st16{fill:url(#SVGID_11_);}
+ .st17{fill:url(#SVGID_12_);}
+ .st18{fill:url(#SVGID_13_);}
+ .st19{fill:url(#SVGID_14_);}
+ .st20{fill:url(#SVGID_15_);}
+ .st21{fill:url(#SVGID_16_);}
+ .st22{fill:url(#SVGID_17_);}
+ .st23{fill:url(#SVGID_18_);}
+ .st24{opacity:0.29;}
+ .st25{fill:url(#SVGID_19_);}
+ .st26{fill:url(#SVGID_20_);}
+ .st27{fill:url(#SVGID_21_);}
+ .st28{fill:url(#SVGID_22_);}
+ .st29{fill:url(#SVGID_23_);}
+ .st30{fill:url(#SVGID_24_);}
+ .st31{fill:url(#SVGID_25_);}
+ .st32{fill:url(#SVGID_26_);}
+ .st33{fill:url(#SVGID_27_);}
+ .st34{fill:url(#SVGID_28_);}
+ .st35{fill:url(#SVGID_29_);}
+ .st36{fill:url(#SVGID_30_);}
+ .st37{fill:url(#SVGID_31_);}
+ .st38{fill:url(#SVGID_32_);}
+ .st39{fill:url(#SVGID_33_);}
+ .st40{fill:url(#SVGID_34_);}
+ .st41{fill:url(#SVGID_35_);}
+ .st42{fill:url(#SVGID_36_);}
+ .st43{opacity:0.4;fill:url(#SVGID_37_);}
+ .st44{fill:url(#SVGID_38_);}
+ .st45{fill:url(#SVGID_39_);}
+ .st46{fill:url(#SVGID_40_);}
+ .st47{fill:url(#SVGID_41_);}
+ .st48{fill:url(#SVGID_42_);}
+ .st49{fill:url(#SVGID_43_);}
+ .st50{fill:url(#SVGID_44_);}
+ .st51{display:inline;opacity:0.29;}
+ .st52{display:inline;fill:url(#SVGID_45_);}
+ .st53{display:inline;fill:url(#SVGID_46_);}
+ .st54{display:inline;fill:#FFFFFF;}
+ .st55{display:inline;fill:url(#SVGID_47_);}
+ .st56{display:inline;fill:url(#SVGID_48_);}
+ .st57{display:inline;fill:url(#SVGID_49_);}
+ .st58{display:inline;fill:url(#SVGID_50_);}
+ .st59{display:inline;fill:url(#SVGID_51_);}
+ .st60{display:inline;fill:url(#SVGID_52_);}
+ .st61{opacity:0.4;fill:url(#SVGID_53_);}
+ .st62{fill:url(#SVGID_54_);}
+ .st63{fill:url(#SVGID_55_);}
+ .st64{fill:url(#SVGID_56_);}
+ .st65{fill:url(#SVGID_57_);}
+ .st66{fill:url(#SVGID_58_);}
+ .st67{opacity:0.4;fill:url(#SVGID_59_);}
+ .st68{fill:url(#SVGID_60_);}
+ .st69{fill:url(#SVGID_61_);}
+ .st70{fill:url(#SVGID_62_);}
+ .st71{fill:url(#SVGID_63_);}
+ .st72{fill:url(#SVGID_64_);}
+ .st73{fill:url(#SVGID_65_);}
+ .st74{fill:url(#SVGID_66_);}
+ .st75{fill:url(#SVGID_67_);}
+ .st76{fill:url(#SVGID_68_);}
+ .st77{fill:url(#SVGID_69_);}
+ .st78{fill:url(#SVGID_70_);}
+ .st79{fill:url(#SVGID_71_);}
+ .st80{fill:url(#SVGID_72_);}
+ .st81{fill:url(#SVGID_73_);}
+ .st82{fill:url(#SVGID_74_);}
+ .st83{fill:url(#SVGID_75_);}
+ .st84{fill:url(#SVGID_76_);}
+ .st85{fill:url(#SVGID_77_);}
+ .st86{fill:url(#SVGID_78_);}
+ .st87{fill:url(#SVGID_79_);}
+ .st88{fill:url(#SVGID_80_);}
+ .st89{fill:url(#SVGID_81_);}
+ .st90{fill:url(#SVGID_82_);}
+ .st91{fill:url(#SVGID_83_);}
+ .st92{fill:url(#SVGID_84_);}
+ .st93{fill:url(#SVGID_85_);}
+ .st94{fill:url(#SVGID_86_);}
+ .st95{opacity:0.4;fill:url(#SVGID_87_);}
+ .st96{fill:url(#SVGID_88_);}
+ .st97{fill:url(#SVGID_89_);}
+ .st98{fill:url(#SVGID_90_);}
+ .st99{fill:url(#SVGID_91_);}
+ .st100{fill:url(#SVGID_92_);}
+ .st101{fill:url(#SVGID_93_);}
+ .st102{fill:url(#SVGID_94_);}
+ .st103{opacity:0.4;fill:url(#SVGID_95_);}
+ .st104{fill:url(#SVGID_96_);}
+ .st105{fill:url(#SVGID_97_);}
+ .st106{fill:url(#SVGID_98_);}
+ .st107{fill:url(#SVGID_99_);}
+ .st108{fill:url(#SVGID_100_);}
+ .st109{fill:url(#SVGID_101_);}
+ .st110{display:inline;fill:url(#SVGID_102_);}
+ .st111{display:inline;fill:url(#SVGID_103_);}
+ .st112{fill:url(#SVGID_104_);}
+ .st113{fill:url(#SVGID_105_);}
+ .st114{fill:url(#SVGID_106_);}
+ .st115{fill:url(#SVGID_107_);}
+ .st116{fill:url(#SVGID_108_);}
+ .st117{opacity:0.4;fill:url(#SVGID_109_);}
+ .st118{fill:url(#SVGID_110_);}
+ .st119{fill:url(#SVGID_111_);}
+ .st120{fill:url(#SVGID_112_);}
+ .st121{fill:url(#SVGID_113_);}
+ .st122{fill:url(#SVGID_114_);}
+ .st123{opacity:0.4;fill:url(#SVGID_115_);}
+ .st124{fill:url(#SVGID_116_);}
+ .st125{fill:url(#SVGID_117_);}
+ .st126{fill:url(#SVGID_118_);}
+ .st127{display:inline;fill:url(#SVGID_119_);}
+ .st128{display:inline;fill:url(#SVGID_120_);}
+ .st129{fill:url(#SVGID_121_);}
+ .st130{fill:url(#SVGID_122_);}
+</style><switch
+ id="switch6"><g
+ i:extraneous="self"
+ id="g8"><g
+ id="Multimedia_Inactive_copy"><circle
+ class="st24"
+ cx="159.7"
+ cy="133.4"
+ r="101.9"
+ id="circle884" /><linearGradient
+ id="SVGID_91_"
+ gradientUnits="userSpaceOnUse"
+ x1="115.9317"
+ y1="254.1836"
+ x2="256.3852"
+ y2="-133.5267"><stop
+ offset="0"
+ style="stop-color:#8BC53F"
+ id="stop887" /><stop
+ offset="2.015080e-02"
+ style="stop-color:#7CCB56;stop-opacity:0.9678"
+ id="stop889" /><stop
+ offset="6.089833e-02"
+ style="stop-color:#62D67D;stop-opacity:0.9028"
+ id="stop891" /><stop
+ offset="0.1057"
+ style="stop-color:#4BDFA0;stop-opacity:0.8312"
+ id="stop893" /><stop
+ offset="0.1543"
+ style="stop-color:#38E7BE;stop-opacity:0.7537"
+ id="stop895" /><stop
+ offset="0.2077"
+ style="stop-color:#28EED6;stop-opacity:0.6684"
+ id="stop897" /><stop
+ offset="0.2681"
+ style="stop-color:#1CF3E8;stop-opacity:0.572"
+ id="stop899" /><stop
+ offset="0.3394"
+ style="stop-color:#13F6F5;stop-opacity:0.4581"
+ id="stop901" /><stop
+ offset="0.4323"
+ style="stop-color:#0EF8FD;stop-opacity:0.3098"
+ id="stop903" /><stop
+ offset="0.6264"
+ style="stop-color:#0DF9FF;stop-opacity:0"
+ id="stop905" /></linearGradient><circle
+ class="st99"
+ cx="159.7"
+ cy="133.4"
+ r="101.9"
+ id="circle907" /><linearGradient
+ id="SVGID_92_"
+ gradientUnits="userSpaceOnUse"
+ x1="4.0481"
+ y1="287.9492"
+ x2="320.4859"
+ y2="-15.4029"
+ gradientTransform="matrix(1 5.464556e-03 -5.464556e-03 1 -2.0192 -3.0212)"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop910" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop912" /></linearGradient><path
+ class="st100"
+ d="M160,238.8c-0.2,0-0.4,0-0.6,0c-58-0.3-104.9-47.7-104.6-105.7C55.2,75.3,102.3,28.5,160,28.5 c0.2,0,0.4,0,0.6,0c58,0.3,104.9,47.7,104.6,105.7l0,0C264.8,192,217.7,238.8,160,238.8z M160,32.2 c-55.7,0-101.2,45.2-101.5,100.9c-0.3,55.9,45,101.7,100.9,102c0.2,0,0.4,0,0.6,0c55.7,0,101.2-45.2,101.5-100.9 c0.3-55.9-45-101.7-100.9-102C160.4,32.2,160.2,32.2,160,32.2z"
+ id="path914" /><g
+ id="g916"><text
+ transform="matrix(1 0 0 1 53.5841 284.7119)"
+ class="st4 st5 st6 st7"
+ id="text918">MULTIMEDIA</text>
+<linearGradient
+ id="SVGID_93_"
+ gradientUnits="userSpaceOnUse"
+ x1="140.5445"
+ y1="202.2363"
+ x2="186.8444"
+ y2="68.7049"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop921" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop923" /></linearGradient><path
+ class="st101"
+ d="M114.5,190.9c-6.4,0-12-2.6-14.8-7.5c-2.9-4.9-5.4-14.5,9.6-23.2c4.8-2.8,17.1-3.9,20.8-4l0.1,3.6 c-4.6,0.1-15.5,1.4-19.1,3.5c-9.4,5.4-12.1,11.5-8.3,18.3c3.8,6.6,14.6,7.6,24,2.2c6.6-3.8,10.6-10.5,10.7-17.9l-0.1-0.7V95.4 l71.9-14.2l0.1,71.3c0,6.7-3.3,16.4-12.5,21.8c-11.1,6.4-24.1,4.8-28.9-3.5c-2.9-4.9-5.4-14.5,9.6-23.2 c4.4-2.5,14.4-3.8,18.8-3.9l0.1,3.6c-4.2,0.1-13.5,1.4-17.1,3.5c-6.4,3.7-13.1,9.9-8.3,18.3c3.8,6.6,14.6,7.6,24,2.2 c7.9-4.5,10.7-12.8,10.7-18.5l-0.1-0.8V85.6l-64.7,12.7v66.8l0.1,0.7c0,8.7-4.7,16.6-12.5,21.1 C123.9,189.6,119,190.9,114.5,190.9z"
+ id="path925" /><linearGradient
+ id="SVGID_94_"
+ gradientUnits="userSpaceOnUse"
+ x1="145.3286"
+ y1="203.8951"
+ x2="191.6285"
+ y2="70.3637"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop928" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop930" /></linearGradient><polygon
+ class="st102"
+ points="155.6,123.3 154.8,119.8 195.5,110.2 196.3,113.7 "
+ id="polygon932" /></g></g></g></switch></svg> \ No newline at end of file
diff --git a/package/package.pro b/package/package.pro
new file mode 100644
index 0000000..68aa56a
--- /dev/null
+++ b/package/package.pro
@@ -0,0 +1,19 @@
+
+DISTFILES = icon.svg config.xml
+
+copy_icon.target = $$OUT_PWD/root/icon.svg
+copy_icon.depends = $$_PRO_FILE_PWD_/icon.svg
+copy_icon.commands = $(COPY_FILE) \"$$replace(copy_icon.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_icon.target, /, $$QMAKE_DIR_SEP)\"
+QMAKE_EXTRA_TARGETS += copy_icon
+PRE_TARGETDEPS += $$copy_icon.target
+
+copy_config.target = $$OUT_PWD/root/config.xml
+copy_config.depends = $$_PRO_FILE_PWD_/config.xml
+copy_config.commands = $(COPY_FILE) \"$$replace(copy_config.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_config.target, /, $$QMAKE_DIR_SEP)\"
+QMAKE_EXTRA_TARGETS += copy_config
+PRE_TARGETDEPS += $$copy_config.target
+
+wgt.target = package
+wgt.commands = wgtpkg-pack -f -o navigation.wgt root
+
+QMAKE_EXTRA_TARGETS += wgt
diff --git a/package/root/config.xml b/package/root/config.xml
new file mode 100644
index 0000000..94aafd8
--- /dev/null
+++ b/package/root/config.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="navigation" version="0.1">
+ <name>Navigation</name>
+ <icon src="icon.svg"/>
+ <content src="bin/navigation" type="application/vnd.agl.native"/>
+ <description>This is a demo application for navigation</description>
+ <author>Matt Ranostay &lt;matt.ranostay@konsulko.com&gt;</author>
+ <license>APL 2.0</license>
+ <feature name="urn:AGL:widget:required-api">
+ <param name="gps" value="ws" />
+ <param name="geoclue" value="ws" />
+ <param name="windowmanager" value="ws" />
+ <param name="homescreen" value="ws" />
+ </feature>
+ <feature name="urn:AGL:widget:required-permission">
+ <param name="urn:AGL:permission::public:no-htdocs" value="required" />
+ </feature>
+</widget>
diff --git a/package/root/icon.svg b/package/root/icon.svg
new file mode 100644
index 0000000..91661a7
--- /dev/null
+++ b/package/root/icon.svg
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ xmlns:i="&amp;ns_ai;"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 320 320"
+ style="enable-background:new 0 0 320 320;"
+ xml:space="preserve"
+ id="svg2"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="icon.svg"><metadata
+ id="metadata1292"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs1290" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2560"
+ inkscape:window-height="1464"
+ id="namedview1288"
+ showgrid="false"
+ inkscape:zoom="0.7375"
+ inkscape:cx="-572.20339"
+ inkscape:cy="160"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg2" /><style
+ type="text/css"
+ id="style4">
+ .st0{display:none;}
+ .st1{display:inline;}
+ .st2{opacity:0.4;fill:url(#SVGID_1_);}
+ .st3{fill:url(#SVGID_2_);}
+ .st4{fill:#FFFFFF;}
+ .st5{font-family:'Roboto-Regular';}
+ .st6{font-size:25px;}
+ .st7{letter-spacing:6;}
+ .st8{fill:url(#SVGID_3_);}
+ .st9{fill:url(#SVGID_4_);}
+ .st10{fill:url(#SVGID_5_);}
+ .st11{fill:url(#SVGID_6_);}
+ .st12{fill:url(#SVGID_7_);}
+ .st13{fill:url(#SVGID_8_);}
+ .st14{fill:url(#SVGID_9_);}
+ .st15{fill:url(#SVGID_10_);}
+ .st16{fill:url(#SVGID_11_);}
+ .st17{fill:url(#SVGID_12_);}
+ .st18{fill:url(#SVGID_13_);}
+ .st19{fill:url(#SVGID_14_);}
+ .st20{fill:url(#SVGID_15_);}
+ .st21{fill:url(#SVGID_16_);}
+ .st22{fill:url(#SVGID_17_);}
+ .st23{fill:url(#SVGID_18_);}
+ .st24{opacity:0.29;}
+ .st25{fill:url(#SVGID_19_);}
+ .st26{fill:url(#SVGID_20_);}
+ .st27{fill:url(#SVGID_21_);}
+ .st28{fill:url(#SVGID_22_);}
+ .st29{fill:url(#SVGID_23_);}
+ .st30{fill:url(#SVGID_24_);}
+ .st31{fill:url(#SVGID_25_);}
+ .st32{fill:url(#SVGID_26_);}
+ .st33{fill:url(#SVGID_27_);}
+ .st34{fill:url(#SVGID_28_);}
+ .st35{fill:url(#SVGID_29_);}
+ .st36{fill:url(#SVGID_30_);}
+ .st37{fill:url(#SVGID_31_);}
+ .st38{fill:url(#SVGID_32_);}
+ .st39{fill:url(#SVGID_33_);}
+ .st40{fill:url(#SVGID_34_);}
+ .st41{fill:url(#SVGID_35_);}
+ .st42{fill:url(#SVGID_36_);}
+ .st43{opacity:0.4;fill:url(#SVGID_37_);}
+ .st44{fill:url(#SVGID_38_);}
+ .st45{fill:url(#SVGID_39_);}
+ .st46{fill:url(#SVGID_40_);}
+ .st47{fill:url(#SVGID_41_);}
+ .st48{fill:url(#SVGID_42_);}
+ .st49{fill:url(#SVGID_43_);}
+ .st50{fill:url(#SVGID_44_);}
+ .st51{display:inline;opacity:0.29;}
+ .st52{display:inline;fill:url(#SVGID_45_);}
+ .st53{display:inline;fill:url(#SVGID_46_);}
+ .st54{display:inline;fill:#FFFFFF;}
+ .st55{display:inline;fill:url(#SVGID_47_);}
+ .st56{display:inline;fill:url(#SVGID_48_);}
+ .st57{display:inline;fill:url(#SVGID_49_);}
+ .st58{display:inline;fill:url(#SVGID_50_);}
+ .st59{display:inline;fill:url(#SVGID_51_);}
+ .st60{display:inline;fill:url(#SVGID_52_);}
+ .st61{opacity:0.4;fill:url(#SVGID_53_);}
+ .st62{fill:url(#SVGID_54_);}
+ .st63{fill:url(#SVGID_55_);}
+ .st64{fill:url(#SVGID_56_);}
+ .st65{fill:url(#SVGID_57_);}
+ .st66{fill:url(#SVGID_58_);}
+ .st67{opacity:0.4;fill:url(#SVGID_59_);}
+ .st68{fill:url(#SVGID_60_);}
+ .st69{fill:url(#SVGID_61_);}
+ .st70{fill:url(#SVGID_62_);}
+ .st71{fill:url(#SVGID_63_);}
+ .st72{fill:url(#SVGID_64_);}
+ .st73{fill:url(#SVGID_65_);}
+ .st74{fill:url(#SVGID_66_);}
+ .st75{fill:url(#SVGID_67_);}
+ .st76{fill:url(#SVGID_68_);}
+ .st77{fill:url(#SVGID_69_);}
+ .st78{fill:url(#SVGID_70_);}
+ .st79{fill:url(#SVGID_71_);}
+ .st80{fill:url(#SVGID_72_);}
+ .st81{fill:url(#SVGID_73_);}
+ .st82{fill:url(#SVGID_74_);}
+ .st83{fill:url(#SVGID_75_);}
+ .st84{fill:url(#SVGID_76_);}
+ .st85{fill:url(#SVGID_77_);}
+ .st86{fill:url(#SVGID_78_);}
+ .st87{fill:url(#SVGID_79_);}
+ .st88{fill:url(#SVGID_80_);}
+ .st89{fill:url(#SVGID_81_);}
+ .st90{fill:url(#SVGID_82_);}
+ .st91{fill:url(#SVGID_83_);}
+ .st92{fill:url(#SVGID_84_);}
+ .st93{fill:url(#SVGID_85_);}
+ .st94{fill:url(#SVGID_86_);}
+ .st95{opacity:0.4;fill:url(#SVGID_87_);}
+ .st96{fill:url(#SVGID_88_);}
+ .st97{fill:url(#SVGID_89_);}
+ .st98{fill:url(#SVGID_90_);}
+ .st99{fill:url(#SVGID_91_);}
+ .st100{fill:url(#SVGID_92_);}
+ .st101{fill:url(#SVGID_93_);}
+ .st102{fill:url(#SVGID_94_);}
+ .st103{opacity:0.4;fill:url(#SVGID_95_);}
+ .st104{fill:url(#SVGID_96_);}
+ .st105{fill:url(#SVGID_97_);}
+ .st106{fill:url(#SVGID_98_);}
+ .st107{fill:url(#SVGID_99_);}
+ .st108{fill:url(#SVGID_100_);}
+ .st109{fill:url(#SVGID_101_);}
+ .st110{display:inline;fill:url(#SVGID_102_);}
+ .st111{display:inline;fill:url(#SVGID_103_);}
+ .st112{fill:url(#SVGID_104_);}
+ .st113{fill:url(#SVGID_105_);}
+ .st114{fill:url(#SVGID_106_);}
+ .st115{fill:url(#SVGID_107_);}
+ .st116{fill:url(#SVGID_108_);}
+ .st117{opacity:0.4;fill:url(#SVGID_109_);}
+ .st118{fill:url(#SVGID_110_);}
+ .st119{fill:url(#SVGID_111_);}
+ .st120{fill:url(#SVGID_112_);}
+ .st121{fill:url(#SVGID_113_);}
+ .st122{fill:url(#SVGID_114_);}
+ .st123{opacity:0.4;fill:url(#SVGID_115_);}
+ .st124{fill:url(#SVGID_116_);}
+ .st125{fill:url(#SVGID_117_);}
+ .st126{fill:url(#SVGID_118_);}
+ .st127{display:inline;fill:url(#SVGID_119_);}
+ .st128{display:inline;fill:url(#SVGID_120_);}
+ .st129{fill:url(#SVGID_121_);}
+ .st130{fill:url(#SVGID_122_);}
+</style><switch
+ id="switch6"><g
+ i:extraneous="self"
+ id="g8"><g
+ id="Multimedia_Inactive_copy"><circle
+ class="st24"
+ cx="159.7"
+ cy="133.4"
+ r="101.9"
+ id="circle884" /><linearGradient
+ id="SVGID_91_"
+ gradientUnits="userSpaceOnUse"
+ x1="115.9317"
+ y1="254.1836"
+ x2="256.3852"
+ y2="-133.5267"><stop
+ offset="0"
+ style="stop-color:#8BC53F"
+ id="stop887" /><stop
+ offset="2.015080e-02"
+ style="stop-color:#7CCB56;stop-opacity:0.9678"
+ id="stop889" /><stop
+ offset="6.089833e-02"
+ style="stop-color:#62D67D;stop-opacity:0.9028"
+ id="stop891" /><stop
+ offset="0.1057"
+ style="stop-color:#4BDFA0;stop-opacity:0.8312"
+ id="stop893" /><stop
+ offset="0.1543"
+ style="stop-color:#38E7BE;stop-opacity:0.7537"
+ id="stop895" /><stop
+ offset="0.2077"
+ style="stop-color:#28EED6;stop-opacity:0.6684"
+ id="stop897" /><stop
+ offset="0.2681"
+ style="stop-color:#1CF3E8;stop-opacity:0.572"
+ id="stop899" /><stop
+ offset="0.3394"
+ style="stop-color:#13F6F5;stop-opacity:0.4581"
+ id="stop901" /><stop
+ offset="0.4323"
+ style="stop-color:#0EF8FD;stop-opacity:0.3098"
+ id="stop903" /><stop
+ offset="0.6264"
+ style="stop-color:#0DF9FF;stop-opacity:0"
+ id="stop905" /></linearGradient><circle
+ class="st99"
+ cx="159.7"
+ cy="133.4"
+ r="101.9"
+ id="circle907" /><linearGradient
+ id="SVGID_92_"
+ gradientUnits="userSpaceOnUse"
+ x1="4.0481"
+ y1="287.9492"
+ x2="320.4859"
+ y2="-15.4029"
+ gradientTransform="matrix(1 5.464556e-03 -5.464556e-03 1 -2.0192 -3.0212)"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop910" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop912" /></linearGradient><path
+ class="st100"
+ d="M160,238.8c-0.2,0-0.4,0-0.6,0c-58-0.3-104.9-47.7-104.6-105.7C55.2,75.3,102.3,28.5,160,28.5 c0.2,0,0.4,0,0.6,0c58,0.3,104.9,47.7,104.6,105.7l0,0C264.8,192,217.7,238.8,160,238.8z M160,32.2 c-55.7,0-101.2,45.2-101.5,100.9c-0.3,55.9,45,101.7,100.9,102c0.2,0,0.4,0,0.6,0c55.7,0,101.2-45.2,101.5-100.9 c0.3-55.9-45-101.7-100.9-102C160.4,32.2,160.2,32.2,160,32.2z"
+ id="path914" /><g
+ id="g916"><text
+ transform="matrix(1 0 0 1 53.5841 284.7119)"
+ class="st4 st5 st6 st7"
+ id="text918">MULTIMEDIA</text>
+<linearGradient
+ id="SVGID_93_"
+ gradientUnits="userSpaceOnUse"
+ x1="140.5445"
+ y1="202.2363"
+ x2="186.8444"
+ y2="68.7049"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop921" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop923" /></linearGradient><path
+ class="st101"
+ d="M114.5,190.9c-6.4,0-12-2.6-14.8-7.5c-2.9-4.9-5.4-14.5,9.6-23.2c4.8-2.8,17.1-3.9,20.8-4l0.1,3.6 c-4.6,0.1-15.5,1.4-19.1,3.5c-9.4,5.4-12.1,11.5-8.3,18.3c3.8,6.6,14.6,7.6,24,2.2c6.6-3.8,10.6-10.5,10.7-17.9l-0.1-0.7V95.4 l71.9-14.2l0.1,71.3c0,6.7-3.3,16.4-12.5,21.8c-11.1,6.4-24.1,4.8-28.9-3.5c-2.9-4.9-5.4-14.5,9.6-23.2 c4.4-2.5,14.4-3.8,18.8-3.9l0.1,3.6c-4.2,0.1-13.5,1.4-17.1,3.5c-6.4,3.7-13.1,9.9-8.3,18.3c3.8,6.6,14.6,7.6,24,2.2 c7.9-4.5,10.7-12.8,10.7-18.5l-0.1-0.8V85.6l-64.7,12.7v66.8l0.1,0.7c0,8.7-4.7,16.6-12.5,21.1 C123.9,189.6,119,190.9,114.5,190.9z"
+ id="path925" /><linearGradient
+ id="SVGID_94_"
+ gradientUnits="userSpaceOnUse"
+ x1="145.3286"
+ y1="203.8951"
+ x2="191.6285"
+ y2="70.3637"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop928" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop930" /></linearGradient><polygon
+ class="st102"
+ points="155.6,123.3 154.8,119.8 195.5,110.2 196.3,113.7 "
+ id="polygon932" /></g></g></g></switch></svg> \ No newline at end of file