From 243be754315c052a5626a640be9eca4f7055704e Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 20 Feb 2015 16:16:31 +0100 Subject: Clean up files in mapviewer example. Rename files, move the subdirectories, remove obsolete dependencies to location examples plugin. Conflicts: examples/location/mapviewer/mapviewer.pro Change-Id: Id85dfffc32761eb9d2999b8e07b87f9912700659 Reviewed-by: Alex Blasche --- examples/location/mapviewer/Geocode.qml | 88 --- examples/location/mapviewer/ItemPopupMenu.qml | 53 -- examples/location/mapviewer/Locale.qml | 83 --- examples/location/mapviewer/MainMenu.qml | 130 ----- examples/location/mapviewer/MapPopupMenu.qml | 64 --- examples/location/mapviewer/MarkerPopupMenu.qml | 76 --- examples/location/mapviewer/Message.qml | 59 --- examples/location/mapviewer/ReverseGeocode.qml | 76 --- examples/location/mapviewer/RouteAddress.qml | 143 ----- examples/location/mapviewer/RouteCoordinate.qml | 85 --- examples/location/mapviewer/RouteList.qml | 84 --- examples/location/mapviewer/RouteListDelegate.qml | 82 --- examples/location/mapviewer/RouteListHeader.qml | 84 --- .../location/mapviewer/content/map/CircleItem.qml | 58 -- .../location/mapviewer/content/map/ImageItem.qml | 61 --- .../mapviewer/content/map/MapComponent.qml | 589 --------------------- examples/location/mapviewer/content/map/Marker.qml | 117 ---- .../location/mapviewer/content/map/MiniMap.qml | 80 --- .../location/mapviewer/content/map/PolygonItem.qml | 63 --- .../mapviewer/content/map/PolylineItem.qml | 56 -- .../mapviewer/content/map/RectangleItem.qml | 74 --- examples/location/mapviewer/forms/Geocode.qml | 87 +++ examples/location/mapviewer/forms/Locale.qml | 82 +++ examples/location/mapviewer/forms/Message.qml | 58 ++ .../location/mapviewer/forms/ReverseGeocode.qml | 75 +++ examples/location/mapviewer/forms/RouteAddress.qml | 142 +++++ .../location/mapviewer/forms/RouteCoordinate.qml | 84 +++ examples/location/mapviewer/forms/RouteList.qml | 84 +++ .../location/mapviewer/forms/RouteListDelegate.qml | 82 +++ .../location/mapviewer/forms/RouteListHeader.qml | 84 +++ examples/location/mapviewer/icon.png | Bin 5312 -> 0 bytes examples/location/mapviewer/main.cpp | 111 ++++ examples/location/mapviewer/map/CircleItem.qml | 58 ++ examples/location/mapviewer/map/ImageItem.qml | 61 +++ examples/location/mapviewer/map/MapComponent.qml | 589 +++++++++++++++++++++ examples/location/mapviewer/map/Marker.qml | 116 ++++ examples/location/mapviewer/map/MiniMap.qml | 80 +++ examples/location/mapviewer/map/PolygonItem.qml | 63 +++ examples/location/mapviewer/map/PolylineItem.qml | 56 ++ examples/location/mapviewer/map/RectangleItem.qml | 74 +++ examples/location/mapviewer/mapviewer.pro | 59 ++- examples/location/mapviewer/mapviewer.qml | 23 +- examples/location/mapviewer/mapviewer.qrc | 39 ++ examples/location/mapviewer/mapviewerwrapper.qrc | 34 -- .../location/mapviewer/menus/ItemPopupMenu.qml | 53 ++ examples/location/mapviewer/menus/MainMenu.qml | 130 +++++ examples/location/mapviewer/menus/MapPopupMenu.qml | 64 +++ .../location/mapviewer/menus/MarkerPopupMenu.qml | 76 +++ .../location/mapviewer/qmlmapviewerwrapper.cpp | 111 ---- examples/location/mapviewer/resources/icon.png | Bin 0 -> 5312 bytes examples/location/mapviewer/resources/marker.png | Bin 0 -> 2341 bytes .../mapviewer/resources/marker_hovered.png | Bin 0 -> 2358 bytes .../mapviewer/resources/marker_selected.png | Bin 0 -> 2355 bytes examples/location/mapviewer/resources/scale.png | Bin 0 -> 176 bytes .../location/mapviewer/resources/scale_end.png | Bin 0 -> 208 bytes 55 files changed, 2392 insertions(+), 2388 deletions(-) delete mode 100644 examples/location/mapviewer/Geocode.qml delete mode 100644 examples/location/mapviewer/ItemPopupMenu.qml delete mode 100644 examples/location/mapviewer/Locale.qml delete mode 100644 examples/location/mapviewer/MainMenu.qml delete mode 100644 examples/location/mapviewer/MapPopupMenu.qml delete mode 100644 examples/location/mapviewer/MarkerPopupMenu.qml delete mode 100644 examples/location/mapviewer/Message.qml delete mode 100644 examples/location/mapviewer/ReverseGeocode.qml delete mode 100644 examples/location/mapviewer/RouteAddress.qml delete mode 100644 examples/location/mapviewer/RouteCoordinate.qml delete mode 100644 examples/location/mapviewer/RouteList.qml delete mode 100644 examples/location/mapviewer/RouteListDelegate.qml delete mode 100644 examples/location/mapviewer/RouteListHeader.qml delete mode 100644 examples/location/mapviewer/content/map/CircleItem.qml delete mode 100644 examples/location/mapviewer/content/map/ImageItem.qml delete mode 100644 examples/location/mapviewer/content/map/MapComponent.qml delete mode 100644 examples/location/mapviewer/content/map/Marker.qml delete mode 100644 examples/location/mapviewer/content/map/MiniMap.qml delete mode 100644 examples/location/mapviewer/content/map/PolygonItem.qml delete mode 100644 examples/location/mapviewer/content/map/PolylineItem.qml delete mode 100644 examples/location/mapviewer/content/map/RectangleItem.qml create mode 100644 examples/location/mapviewer/forms/Geocode.qml create mode 100644 examples/location/mapviewer/forms/Locale.qml create mode 100644 examples/location/mapviewer/forms/Message.qml create mode 100644 examples/location/mapviewer/forms/ReverseGeocode.qml create mode 100644 examples/location/mapviewer/forms/RouteAddress.qml create mode 100644 examples/location/mapviewer/forms/RouteCoordinate.qml create mode 100644 examples/location/mapviewer/forms/RouteList.qml create mode 100644 examples/location/mapviewer/forms/RouteListDelegate.qml create mode 100644 examples/location/mapviewer/forms/RouteListHeader.qml delete mode 100644 examples/location/mapviewer/icon.png create mode 100644 examples/location/mapviewer/main.cpp create mode 100644 examples/location/mapviewer/map/CircleItem.qml create mode 100644 examples/location/mapviewer/map/ImageItem.qml create mode 100644 examples/location/mapviewer/map/MapComponent.qml create mode 100644 examples/location/mapviewer/map/Marker.qml create mode 100644 examples/location/mapviewer/map/MiniMap.qml create mode 100644 examples/location/mapviewer/map/PolygonItem.qml create mode 100644 examples/location/mapviewer/map/PolylineItem.qml create mode 100644 examples/location/mapviewer/map/RectangleItem.qml create mode 100644 examples/location/mapviewer/mapviewer.qrc delete mode 100644 examples/location/mapviewer/mapviewerwrapper.qrc create mode 100644 examples/location/mapviewer/menus/ItemPopupMenu.qml create mode 100644 examples/location/mapviewer/menus/MainMenu.qml create mode 100644 examples/location/mapviewer/menus/MapPopupMenu.qml create mode 100644 examples/location/mapviewer/menus/MarkerPopupMenu.qml delete mode 100644 examples/location/mapviewer/qmlmapviewerwrapper.cpp create mode 100644 examples/location/mapviewer/resources/icon.png create mode 100644 examples/location/mapviewer/resources/marker.png create mode 100644 examples/location/mapviewer/resources/marker_hovered.png create mode 100644 examples/location/mapviewer/resources/marker_selected.png create mode 100644 examples/location/mapviewer/resources/scale.png create mode 100644 examples/location/mapviewer/resources/scale_end.png (limited to 'examples/location') diff --git a/examples/location/mapviewer/Geocode.qml b/examples/location/mapviewer/Geocode.qml deleted file mode 100644 index 55e94fc0..00000000 --- a/examples/location/mapviewer/Geocode.qml +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import QtPositioning 5.2 -import "forms" - -//Geocode Dialog -//! [geocode0] -GeocodeForm { - //! [geocode0] - property variant address - signal showPlace(variant address) - signal closeForm() - - //! [geocode1] - 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) - } - //! [geocode1] - - clearButton.onClicked: { - street.text = "" - city.text = "" - state.text = "" - country.text = "" - postalCode.text = "" - } - //! [geocode2] - - 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 - } -} -//! [geocode2] - - diff --git a/examples/location/mapviewer/ItemPopupMenu.qml b/examples/location/mapviewer/ItemPopupMenu.qml deleted file mode 100644 index 6b604aaa..00000000 --- a/examples/location/mapviewer/ItemPopupMenu.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import QtQuick.Controls 1.3 - -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/examples/location/mapviewer/Locale.qml b/examples/location/mapviewer/Locale.qml deleted file mode 100644 index 14fa1b9d..00000000 --- a/examples/location/mapviewer/Locale.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import QtPositioning 5.2 -import "forms" - -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/examples/location/mapviewer/MainMenu.qml b/examples/location/mapviewer/MainMenu.qml deleted file mode 100644 index 31c4a53b..00000000 --- a/examples/location/mapviewer/MainMenu.qml +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import QtQuick.Controls 1.3 -import QtLocation 5.3 - -MenuBar { - property variant providerMenu: providerMenu - property variant mapTypeMenu: mapTypeMenu - property variant toolsMenu: toolsMenu - property alias isFollowMe: toolsMenu.isFollowMe - property alias isMiniMap: toolsMenu.isMiniMap - - 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 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/examples/location/mapviewer/MarkerPopupMenu.qml b/examples/location/mapviewer/MarkerPopupMenu.qml deleted file mode 100644 index c5bc5740..00000000 --- a/examples/location/mapviewer/MarkerPopupMenu.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import QtQuick.Controls 1.3 - -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/examples/location/mapviewer/Message.qml b/examples/location/mapviewer/Message.qml deleted file mode 100644 index 8bf01530..00000000 --- a/examples/location/mapviewer/Message.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import "forms" - -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/examples/location/mapviewer/ReverseGeocode.qml b/examples/location/mapviewer/ReverseGeocode.qml deleted file mode 100644 index f5ac9a9e..00000000 --- a/examples/location/mapviewer/ReverseGeocode.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import QtPositioning 5.2 -import "forms" - -//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/examples/location/mapviewer/RouteAddress.qml b/examples/location/mapviewer/RouteAddress.qml deleted file mode 100644 index a040abc3..00000000 --- a/examples/location/mapviewer/RouteAddress.qml +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import QtLocation 5.3 -import QtPositioning 5.3 -import "forms" - -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/examples/location/mapviewer/RouteCoordinate.qml b/examples/location/mapviewer/RouteCoordinate.qml deleted file mode 100644 index 40d8fd4a..00000000 --- a/examples/location/mapviewer/RouteCoordinate.qml +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import QtPositioning 5.2 -import "forms" - -//Route Dialog -//! [routedialog0] -RouteCoordinateForm { - property variant toCoordinate - property variant fromCoordinate - signal showRoute(variant startCoordinate,variant endCoordinate) - signal closeForm() - - //! [routedialog0] - 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 - } - //! [routedialog1] -} -//! [routedialog1] - diff --git a/examples/location/mapviewer/RouteList.qml b/examples/location/mapviewer/RouteList.qml deleted file mode 100644 index d9a26b6c..00000000 --- a/examples/location/mapviewer/RouteList.qml +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import QtQuick.Controls 1.3 -import "helper.js" as Helper - -ListView { - property variant routeModel - property string totalTravelTime - property string totalDistance - signal closeForm() - - interactive: true - - model: ListModel { id: routeList } - - header: RouteListHeader {} - - delegate: RouteListDelegate{ - routeIndex.text: index + 1 - routeInstruction.text: instruction - routeDistance.text: distance - } - - footer: Button { - anchors.horizontalCenter: parent.horizontalCenter - text: qsTr("Close") - onClicked: { - closeForm() - } - } - - Component.onCompleted: { - routeList.clear() - if (routeModel.count > 0) { - for (var i = 0; i < routeModel.get(0).segments.length; i++) { - routeList.append({ - "instruction": routeModel.get(0).segments[i].maneuver.instructionText, - "distance": Helper.formatDistance(routeModel.get(0).segments[i].maneuver.distanceToNextInstruction) - }); - } - } - totalTravelTime = routeModel.count == 0 ? "" : Helper.formatTime(routeModel.get(0).travelTime) - totalDistance = routeModel.count == 0 ? "" : Helper.formatDistance(routeModel.get(0).distance) - } -} diff --git a/examples/location/mapviewer/RouteListDelegate.qml b/examples/location/mapviewer/RouteListDelegate.qml deleted file mode 100644 index 16dca34a..00000000 --- a/examples/location/mapviewer/RouteListDelegate.qml +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import QtQuick.Controls 1.3 -import QtQuick.Layouts 1.1 - -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: "#f36910" - } -} - - - diff --git a/examples/location/mapviewer/RouteListHeader.qml b/examples/location/mapviewer/RouteListHeader.qml deleted file mode 100644 index a907214f..00000000 --- a/examples/location/mapviewer/RouteListHeader.qml +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import QtQuick.Controls 1.3 - -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: "#f36910" - 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/examples/location/mapviewer/content/map/CircleItem.qml b/examples/location/mapviewer/content/map/CircleItem.qml deleted file mode 100644 index cc5e6faa..00000000 --- a/examples/location/mapviewer/content/map/CircleItem.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** 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.0 -import QtLocation 5.3 - -//TODO: remove/refactor me when items are integrated - -MapCircle { - - color: "yellow" - border.color: "red" - border.width: 5 - smooth: true - opacity: 0.5 - - 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/examples/location/mapviewer/content/map/ImageItem.qml b/examples/location/mapviewer/content/map/ImageItem.qml deleted file mode 100644 index c5a554b0..00000000 --- a/examples/location/mapviewer/content/map/ImageItem.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** 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.0; -import QtLocation 5.3 - -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: "../../icon.png" - opacity: 0.7 - } -} diff --git a/examples/location/mapviewer/content/map/MapComponent.qml b/examples/location/mapviewer/content/map/MapComponent.qml deleted file mode 100644 index eea6b86f..00000000 --- a/examples/location/mapviewer/content/map/MapComponent.qml +++ /dev/null @@ -1,589 +0,0 @@ -/**************************************************************************** -** -** 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.4 -import QtQuick.Controls 1.3 -import QtLocation 5.3 -import QtPositioning 5.2 -import "../../helper.js" as Helper - -//! [top] -Map { - id: map - //! [top] - property variant markers - property variant mapItems - 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: false - property variant scaleLengths: [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000, 2000000] - //! [routemodel0] - property RouteQuery routeQuery: RouteQuery {} - - property RouteModel routeModel: RouteModel { - plugin : map.plugin - query: routeQuery - //! [routemodel0] - - //! [routemodel1] - onStatusChanged: { - if (status == RouteModel.Ready) { - switch (count) { - case 0: - // technically not an error - map.routeError() - break - case 1: - showRouteList() - break - } - } else if (status == RouteModel.Error) { - map.routeError() - } - } - //! [routemodel1] - - //! [routemodel2] - - //! [routemodel2] - //! [routemodel3] - } - //! [routemodel3] - - //! [geocodemodel0] - property GeocodeModel geocodeModel: GeocodeModel { - //! [geocodemodel0] - //! [geocodemodel0 body] - 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 body] - //! [geocodemodel1] - } - //! [geocodemodel1] - - 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 = "Latitude: " + latitude + "
" - text +="Longitude: " + longitude + "
" + "
" - if (street) text +="Street: "+ street + "
" - if (district) text +="District: "+ district +"
" - if (city) text +="City: "+ city + "
" - if (county) text +="County: "+ county + "
" - if (state) text +="State: "+ state + "
" - if (countryCode) text +="Country code: "+ countryCode + "
" - if (country) text +="Country: "+ country + "
" - if (postalCode) text +="PostalCode: "+ postalCode + "
" - 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 map.jitterThreshold || - Math.abs(map.pressY - parent.y -mouse.y ) > map.jitterThreshold) { - map.state = "" - } - if ((mouse.button == Qt.LeftButton) & (map.state == "")) { - 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] - - //! [pointdel0] - Component { - id: pointDelegate - - MapCircle { - id: point - radius: 1000 - color: circleMouseArea.containsMouse ? "lime" : "red" - opacity: 0.6 - 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) { - map.state = "" - if (pressed) parent.radius = parent.center.distanceTo( - map.toCoordinate(Qt.point(mouse.x, mouse.y))) - } - if ((mouse.button == Qt.LeftButton) & (map.state == "")) { - 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] - - //! [routeview] - MapItemView { - model: routeModel - delegate: routeDelegate - autoFitViewport: true - } - //! [routeview] - - //! [geocodeview] - MapItemView { - model: geocodeModel - delegate: pointDelegate - } - //! [geocodeview] - - Item {//scale - id: scale - parent: zoomSlider.parent - visible: scaleText.text != "0 m" - z: map.z + 2 - opacity: 0.6 - anchors { - bottom: zoomSlider.top; - bottomMargin: 8; - left: zoomSlider.left - } - Image { - id: scaleImageLeft - source: "../../resources/scale_end.png" - anchors.bottom: parent.bottom - anchors.left: parent.left - } - Image { - id: scaleImage - source: "../../resources/scale.png" - anchors.bottom: parent.bottom - anchors.left: scaleImageLeft.right - } - Image { - id: scaleImageRight - source: "../../resources/scale_end.png" - anchors.bottom: parent.bottom - anchors.left: scaleImage.right - } - Text { - id: scaleText - color: "#004EAE" - horizontalAlignment: Text.AlignHCenter - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.bottomMargin: 3 - text: "0 m" - font.pixelSize: 14 - } - Component.onCompleted: { - map.calculateScale(); - } - } - - Timer { - id: scaleTimer - interval: 100 - running: false - repeat: false - onTriggered: { - map.calculateScale() - } - } - - MouseArea { - id: mouseArea - property variant lastCoordinate - anchors.fill: parent - - 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)) - // if (mouse.button == Qt.MiddleButton) - // addMarker() - } - - onPositionChanged: { - if (map.state != "PopupMenu" || - Math.abs(map.pressX - mouse.x ) > map.jitterThreshold || - Math.abs(map.pressY - mouse.y ) > map.jitterThreshold) { - map.state = "" - } - if ((mouse.button == Qt.LeftButton) & (map.state == "")) { - // if ((map.lastX != -1) && (map.lastY != -1)) { - // var dx = mouse.x - map.lastX - // var dy = mouse.y - map.lastY - // map.pan(-dx, -dy) - // } - map.lastX = mouse.x - map.lastY = mouse.y - } - } - - onDoubleClicked: { - map.center = map.toCoordinate(Qt.point(mouse.x, mouse.y)) - if (mouse.button == Qt.LeftButton){ - map.zoomLevel += 1 - } else if (mouse.button == Qt.RightButton) map.zoomLevel -= 1 - 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/examples/location/mapviewer/content/map/Marker.qml b/examples/location/mapviewer/content/map/Marker.qml deleted file mode 100644 index 730b62f1..00000000 --- a/examples/location/mapviewer/content/map/Marker.qml +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** 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.0; -import QtLocation 5.3 -import QtLocation.examples 5.0 - -//! [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: markerMouseArea.containsMouse ? (markerMouseArea.pressed ? "../../resources/marker_selected.png" :"../../resources/marker_hovered.png") : "../../resources/marker.png" - 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 - } - } - map.state = "" - } - - 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/4 - color: "white" - font.bold: true - font.pixelSize: 14 - width:27 - 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/examples/location/mapviewer/content/map/MiniMap.qml b/examples/location/mapviewer/content/map/MiniMap.qml deleted file mode 100644 index fbd000ef..00000000 --- a/examples/location/mapviewer/content/map/MiniMap.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** 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.0 -import QtLocation 5.3 - -Rectangle{ - id: miniMapRect - width: 152 - height: 152 - anchors.right: (parent) ? parent.right : undefined - anchors.rightMargin: 10 - anchors.top: (parent) ? parent.top : undefined - anchors.topMargin: 10 - color: "#242424" - Map { - id: miniMap - anchors.top: parent.top - anchors.topMargin: 1 - anchors.left: parent.left - anchors.leftMargin: 1 - width: 150 - height: 150 - zoomLevel: (map.zoomLevel > minimumZoomLevel + 3) ? minimumZoomLevel + 3 : 2.5 - center: map.center - plugin: map.plugin - gesture.enabled: false - - MapRectangle { - color: "#44ff0000" - border.width: 1 - border.color: "red" - topLeft { - latitude: miniMap.center.latitude + 5 - longitude: miniMap.center.longitude - 5 - } - bottomRight { - latitude: miniMap.center.latitude - 5 - longitude: miniMap.center.longitude + 5 - } - } - } -} diff --git a/examples/location/mapviewer/content/map/PolygonItem.qml b/examples/location/mapviewer/content/map/PolygonItem.qml deleted file mode 100644 index 0d72f9d7..00000000 --- a/examples/location/mapviewer/content/map/PolygonItem.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** 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.0 -import QtLocation 5.3 - -//TODO: remove me when items are integrated - -MapPolygon { - - color: "green" - border.color: "darkgreen" - border.width: 4 - smooth: true - opacity: 0.5 - - function setGeometry(markers, index){ - for (var i = index; i 1 )) { + showMessage(qsTr("Ambiguous geocode"), + count + " " + qsTr("results found for the") + + " " + st + " " +qsTr("point, please specify location")) + goButton.enabled = true; + } + } + } + } +} diff --git a/examples/location/mapviewer/forms/RouteCoordinate.qml b/examples/location/mapviewer/forms/RouteCoordinate.qml new file mode 100644 index 00000000..9c593e0a --- /dev/null +++ b/examples/location/mapviewer/forms/RouteCoordinate.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.4 +import QtPositioning 5.2 + +//Route Dialog +//! [routedialog0] +RouteCoordinateForm { + property variant toCoordinate + property variant fromCoordinate + signal showRoute(variant startCoordinate,variant endCoordinate) + signal closeForm() + + //! [routedialog0] + 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 + } + //! [routedialog1] +} +//! [routedialog1] + diff --git a/examples/location/mapviewer/forms/RouteList.qml b/examples/location/mapviewer/forms/RouteList.qml new file mode 100644 index 00000000..200d10dd --- /dev/null +++ b/examples/location/mapviewer/forms/RouteList.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.4 +import QtQuick.Controls 1.3 +import "../helper.js" as Helper + +ListView { + property variant routeModel + property string totalTravelTime + property string totalDistance + signal closeForm() + + interactive: true + + model: ListModel { id: routeList } + + header: RouteListHeader {} + + delegate: RouteListDelegate{ + routeIndex.text: index + 1 + routeInstruction.text: instruction + routeDistance.text: distance + } + + footer: Button { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Close") + onClicked: { + closeForm() + } + } + + Component.onCompleted: { + routeList.clear() + if (routeModel.count > 0) { + for (var i = 0; i < routeModel.get(0).segments.length; i++) { + routeList.append({ + "instruction": routeModel.get(0).segments[i].maneuver.instructionText, + "distance": Helper.formatDistance(routeModel.get(0).segments[i].maneuver.distanceToNextInstruction) + }); + } + } + totalTravelTime = routeModel.count == 0 ? "" : Helper.formatTime(routeModel.get(0).travelTime) + totalDistance = routeModel.count == 0 ? "" : Helper.formatDistance(routeModel.get(0).distance) + } +} diff --git a/examples/location/mapviewer/forms/RouteListDelegate.qml b/examples/location/mapviewer/forms/RouteListDelegate.qml new file mode 100644 index 00000000..16dca34a --- /dev/null +++ b/examples/location/mapviewer/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.4 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 + +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: "#f36910" + } +} + + + diff --git a/examples/location/mapviewer/forms/RouteListHeader.qml b/examples/location/mapviewer/forms/RouteListHeader.qml new file mode 100644 index 00000000..a907214f --- /dev/null +++ b/examples/location/mapviewer/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.4 +import QtQuick.Controls 1.3 + +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: "#f36910" + 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/examples/location/mapviewer/icon.png b/examples/location/mapviewer/icon.png deleted file mode 100644 index 0954baf0..00000000 Binary files a/examples/location/mapviewer/icon.png and /dev/null differ diff --git a/examples/location/mapviewer/main.cpp b/examples/location/mapviewer/main.cpp new file mode 100644 index 00000000..cda642ec --- /dev/null +++ b/examples/location/mapviewer/main.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** 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 +#include +#include +#include +#include +#include +#include + +static bool parseArgs(QStringList& args, QVariantMap& parameters) +{ + + while (!args.isEmpty()) { + + QString param = args.takeFirst(); + + if (param.startsWith("--help")) { + QTextStream out(stdout); + out << "Usage: " << endl; + out << "--plugin. - Sets parameter = value for plugin" << endl; + out.flush(); + return true; + } + + if (param.startsWith("--plugin.")) { + + param.remove(0, 9); + + if (args.isEmpty() || args.first().startsWith("--")) { + parameters[param] = true; + } else { + + QString value = args.takeFirst(); + + if (value == "true" || value == "on" || value == "enabled") { + parameters[param] = true; + } else if (value == "false" || value == "off" + || value == "disable") { + parameters[param] = false; + } else { + parameters[param] = value; + } + } + } + } + return false; +} + +int main(int argc, char *argv[]) +{ + QGuiApplication application(argc, argv); + + QVariantMap parameters; + QStringList args(QCoreApplication::arguments()); + + if (parseArgs(args, parameters)) exit(0); + + const QString mainQmlApp = QLatin1String("qrc:///mapviewer.qml"); + + QQmlApplicationEngine engine; + + engine.addImportPath(QLatin1String(":/imports")); + engine.rootContext()->setContextProperty("appDirPath", QCoreApplication::applicationDirPath()); + engine.load(QUrl(mainQmlApp)); + QObject *item = engine.rootObjects().first(); + Q_ASSERT(item); + QMetaObject::invokeMethod(item, "initializeProvders", + Q_ARG(QVariant, QVariant::fromValue(parameters))); + + QObject::connect(&engine, SIGNAL(quit()), qApp, SLOT(quit())); + return application.exec(); +} diff --git a/examples/location/mapviewer/map/CircleItem.qml b/examples/location/mapviewer/map/CircleItem.qml new file mode 100644 index 00000000..cc5e6faa --- /dev/null +++ b/examples/location/mapviewer/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.0 +import QtLocation 5.3 + +//TODO: remove/refactor me when items are integrated + +MapCircle { + + color: "yellow" + border.color: "red" + border.width: 5 + smooth: true + opacity: 0.5 + + 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/examples/location/mapviewer/map/ImageItem.qml b/examples/location/mapviewer/map/ImageItem.qml new file mode 100644 index 00000000..9b213406 --- /dev/null +++ b/examples/location/mapviewer/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.0; +import QtLocation 5.3 + +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/examples/location/mapviewer/map/MapComponent.qml b/examples/location/mapviewer/map/MapComponent.qml new file mode 100644 index 00000000..c6855864 --- /dev/null +++ b/examples/location/mapviewer/map/MapComponent.qml @@ -0,0 +1,589 @@ +/**************************************************************************** +** +** 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.4 +import QtQuick.Controls 1.3 +import QtLocation 5.3 +import QtPositioning 5.2 +import "../helper.js" as Helper + +//! [top] +Map { + id: map + //! [top] + property variant markers + property variant mapItems + 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: false + property variant scaleLengths: [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000, 2000000] + //! [routemodel0] + property RouteQuery routeQuery: RouteQuery {} + + property RouteModel routeModel: RouteModel { + plugin : map.plugin + query: routeQuery + //! [routemodel0] + + //! [routemodel1] + onStatusChanged: { + if (status == RouteModel.Ready) { + switch (count) { + case 0: + // technically not an error + map.routeError() + break + case 1: + showRouteList() + break + } + } else if (status == RouteModel.Error) { + map.routeError() + } + } + //! [routemodel1] + + //! [routemodel2] + + //! [routemodel2] + //! [routemodel3] + } + //! [routemodel3] + + //! [geocodemodel0] + property GeocodeModel geocodeModel: GeocodeModel { + //! [geocodemodel0] + //! [geocodemodel0 body] + 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 body] + //! [geocodemodel1] + } + //! [geocodemodel1] + + 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 = "Latitude: " + latitude + "
" + text +="Longitude: " + longitude + "
" + "
" + if (street) text +="Street: "+ street + "
" + if (district) text +="District: "+ district +"
" + if (city) text +="City: "+ city + "
" + if (county) text +="County: "+ county + "
" + if (state) text +="State: "+ state + "
" + if (countryCode) text +="Country code: "+ countryCode + "
" + if (country) text +="Country: "+ country + "
" + if (postalCode) text +="PostalCode: "+ postalCode + "
" + 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 map.jitterThreshold || + Math.abs(map.pressY - parent.y -mouse.y ) > map.jitterThreshold) { + map.state = "" + } + if ((mouse.button == Qt.LeftButton) & (map.state == "")) { + 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] + + //! [pointdel0] + Component { + id: pointDelegate + + MapCircle { + id: point + radius: 1000 + color: circleMouseArea.containsMouse ? "lime" : "red" + opacity: 0.6 + 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) { + map.state = "" + if (pressed) parent.radius = parent.center.distanceTo( + map.toCoordinate(Qt.point(mouse.x, mouse.y))) + } + if ((mouse.button == Qt.LeftButton) & (map.state == "")) { + 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] + + //! [routeview] + MapItemView { + model: routeModel + delegate: routeDelegate + autoFitViewport: true + } + //! [routeview] + + //! [geocodeview] + MapItemView { + model: geocodeModel + delegate: pointDelegate + } + //! [geocodeview] + + Item {//scale + id: scale + parent: zoomSlider.parent + visible: scaleText.text != "0 m" + z: map.z + 2 + opacity: 0.6 + anchors { + bottom: zoomSlider.top; + bottomMargin: 8; + left: zoomSlider.left + } + Image { + id: scaleImageLeft + source: "../resources/scale_end.png" + anchors.bottom: parent.bottom + anchors.left: parent.left + } + Image { + id: scaleImage + source: "../resources/scale.png" + anchors.bottom: parent.bottom + anchors.left: scaleImageLeft.right + } + Image { + id: scaleImageRight + source: "../resources/scale_end.png" + anchors.bottom: parent.bottom + anchors.left: scaleImage.right + } + Text { + id: scaleText + color: "#004EAE" + horizontalAlignment: Text.AlignHCenter + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.bottomMargin: 3 + text: "0 m" + font.pixelSize: 14 + } + Component.onCompleted: { + map.calculateScale(); + } + } + + Timer { + id: scaleTimer + interval: 100 + running: false + repeat: false + onTriggered: { + map.calculateScale() + } + } + + MouseArea { + id: mouseArea + property variant lastCoordinate + anchors.fill: parent + + 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)) + // if (mouse.button == Qt.MiddleButton) + // addMarker() + } + + onPositionChanged: { + if (map.state != "PopupMenu" || + Math.abs(map.pressX - mouse.x ) > map.jitterThreshold || + Math.abs(map.pressY - mouse.y ) > map.jitterThreshold) { + map.state = "" + } + if ((mouse.button == Qt.LeftButton) & (map.state == "")) { + // if ((map.lastX != -1) && (map.lastY != -1)) { + // var dx = mouse.x - map.lastX + // var dy = mouse.y - map.lastY + // map.pan(-dx, -dy) + // } + map.lastX = mouse.x + map.lastY = mouse.y + } + } + + onDoubleClicked: { + map.center = map.toCoordinate(Qt.point(mouse.x, mouse.y)) + if (mouse.button == Qt.LeftButton){ + map.zoomLevel += 1 + } else if (mouse.button == Qt.RightButton) map.zoomLevel -= 1 + 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/examples/location/mapviewer/map/Marker.qml b/examples/location/mapviewer/map/Marker.qml new file mode 100644 index 00000000..192fdd80 --- /dev/null +++ b/examples/location/mapviewer/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.0; +import QtLocation 5.3 + +//! [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: markerMouseArea.containsMouse ? (markerMouseArea.pressed ? "../resources/marker_selected.png" :"../resources/marker_hovered.png") : "../resources/marker.png" + 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 + } + } + map.state = "" + } + + 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/4 + color: "white" + font.bold: true + font.pixelSize: 14 + width:27 + 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/examples/location/mapviewer/map/MiniMap.qml b/examples/location/mapviewer/map/MiniMap.qml new file mode 100644 index 00000000..fbd000ef --- /dev/null +++ b/examples/location/mapviewer/map/MiniMap.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** 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.0 +import QtLocation 5.3 + +Rectangle{ + id: miniMapRect + width: 152 + height: 152 + anchors.right: (parent) ? parent.right : undefined + anchors.rightMargin: 10 + anchors.top: (parent) ? parent.top : undefined + anchors.topMargin: 10 + color: "#242424" + Map { + id: miniMap + anchors.top: parent.top + anchors.topMargin: 1 + anchors.left: parent.left + anchors.leftMargin: 1 + width: 150 + height: 150 + zoomLevel: (map.zoomLevel > minimumZoomLevel + 3) ? minimumZoomLevel + 3 : 2.5 + center: map.center + plugin: map.plugin + gesture.enabled: false + + MapRectangle { + color: "#44ff0000" + border.width: 1 + border.color: "red" + topLeft { + latitude: miniMap.center.latitude + 5 + longitude: miniMap.center.longitude - 5 + } + bottomRight { + latitude: miniMap.center.latitude - 5 + longitude: miniMap.center.longitude + 5 + } + } + } +} diff --git a/examples/location/mapviewer/map/PolygonItem.qml b/examples/location/mapviewer/map/PolygonItem.qml new file mode 100644 index 00000000..0d72f9d7 --- /dev/null +++ b/examples/location/mapviewer/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.0 +import QtLocation 5.3 + +//TODO: remove me when items are integrated + +MapPolygon { + + color: "green" + border.color: "darkgreen" + border.width: 4 + smooth: true + opacity: 0.5 + + function setGeometry(markers, index){ + for (var i = index; i + + mapviewer.qml + map/MapComponent.qml + map/Marker.qml + map/PolylineItem.qml + map/RectangleItem.qml + map/CircleItem.qml + map/PolygonItem.qml + map/ImageItem.qml + map/MiniMap.qml + forms/Message.qml + forms/MessageForm.ui.qml + forms/Geocode.qml + forms/GeocodeForm.ui.qml + forms/ReverseGeocode.qml + forms/ReverseGeocodeForm.ui.qml + forms/RouteCoordinate.qml + forms/RouteCoordinateForm.ui.qml + forms/RouteAddress.qml + forms/RouteAddressForm.ui.qml + forms/Locale.qml + forms/LocaleForm.ui.qml + forms/RouteList.qml + forms/RouteListDelegate.qml + forms/RouteListHeader.qml + menus/MainMenu.qml + menus/MapPopupMenu.qml + menus/MarkerPopupMenu.qml + menus/ItemPopupMenu.qml + helper.js + resources/scale_end.png + resources/scale.png + resources/marker.png + resources/marker_hovered.png + resources/marker_selected.png + resources/icon.png + + diff --git a/examples/location/mapviewer/mapviewerwrapper.qrc b/examples/location/mapviewer/mapviewerwrapper.qrc deleted file mode 100644 index dcbbbcab..00000000 --- a/examples/location/mapviewer/mapviewerwrapper.qrc +++ /dev/null @@ -1,34 +0,0 @@ - - - mapviewer.qml - icon.png - content/map/MapComponent.qml - content/map/Marker.qml - content/map/PolylineItem.qml - content/map/RectangleItem.qml - content/map/CircleItem.qml - content/map/PolygonItem.qml - content/map/ImageItem.qml - content/map/MiniMap.qml - MainMenu.qml - forms/MessageForm.ui.qml - forms/GeocodeForm.ui.qml - forms/ReverseGeocodeForm.ui.qml - forms/RouteCoordinateForm.ui.qml - forms/RouteAddressForm.ui.qml - forms/LocaleForm.ui.qml - Message.qml - RouteCoordinate.qml - RouteAddress.qml - Geocode.qml - ReverseGeocode.qml - MapPopupMenu.qml - MarkerPopupMenu.qml - ItemPopupMenu.qml - Locale.qml - RouteList.qml - RouteListDelegate.qml - RouteListHeader.qml - helper.js - - diff --git a/examples/location/mapviewer/menus/ItemPopupMenu.qml b/examples/location/mapviewer/menus/ItemPopupMenu.qml new file mode 100644 index 00000000..6b604aaa --- /dev/null +++ b/examples/location/mapviewer/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.4 +import QtQuick.Controls 1.3 + +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/examples/location/mapviewer/menus/MainMenu.qml b/examples/location/mapviewer/menus/MainMenu.qml new file mode 100644 index 00000000..31c4a53b --- /dev/null +++ b/examples/location/mapviewer/menus/MainMenu.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** 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.4 +import QtQuick.Controls 1.3 +import QtLocation 5.3 + +MenuBar { + property variant providerMenu: providerMenu + property variant mapTypeMenu: mapTypeMenu + property variant toolsMenu: toolsMenu + property alias isFollowMe: toolsMenu.isFollowMe + property alias isMiniMap: toolsMenu.isMiniMap + + 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 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/examples/location/mapviewer/menus/MarkerPopupMenu.qml b/examples/location/mapviewer/menus/MarkerPopupMenu.qml new file mode 100644 index 00000000..c5bc5740 --- /dev/null +++ b/examples/location/mapviewer/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.4 +import QtQuick.Controls 1.3 + +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/examples/location/mapviewer/qmlmapviewerwrapper.cpp b/examples/location/mapviewer/qmlmapviewerwrapper.cpp deleted file mode 100644 index cda642ec..00000000 --- a/examples/location/mapviewer/qmlmapviewerwrapper.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** 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 -#include -#include -#include -#include -#include -#include - -static bool parseArgs(QStringList& args, QVariantMap& parameters) -{ - - while (!args.isEmpty()) { - - QString param = args.takeFirst(); - - if (param.startsWith("--help")) { - QTextStream out(stdout); - out << "Usage: " << endl; - out << "--plugin. - Sets parameter = value for plugin" << endl; - out.flush(); - return true; - } - - if (param.startsWith("--plugin.")) { - - param.remove(0, 9); - - if (args.isEmpty() || args.first().startsWith("--")) { - parameters[param] = true; - } else { - - QString value = args.takeFirst(); - - if (value == "true" || value == "on" || value == "enabled") { - parameters[param] = true; - } else if (value == "false" || value == "off" - || value == "disable") { - parameters[param] = false; - } else { - parameters[param] = value; - } - } - } - } - return false; -} - -int main(int argc, char *argv[]) -{ - QGuiApplication application(argc, argv); - - QVariantMap parameters; - QStringList args(QCoreApplication::arguments()); - - if (parseArgs(args, parameters)) exit(0); - - const QString mainQmlApp = QLatin1String("qrc:///mapviewer.qml"); - - QQmlApplicationEngine engine; - - engine.addImportPath(QLatin1String(":/imports")); - engine.rootContext()->setContextProperty("appDirPath", QCoreApplication::applicationDirPath()); - engine.load(QUrl(mainQmlApp)); - QObject *item = engine.rootObjects().first(); - Q_ASSERT(item); - QMetaObject::invokeMethod(item, "initializeProvders", - Q_ARG(QVariant, QVariant::fromValue(parameters))); - - QObject::connect(&engine, SIGNAL(quit()), qApp, SLOT(quit())); - return application.exec(); -} diff --git a/examples/location/mapviewer/resources/icon.png b/examples/location/mapviewer/resources/icon.png new file mode 100644 index 00000000..0954baf0 Binary files /dev/null and b/examples/location/mapviewer/resources/icon.png differ diff --git a/examples/location/mapviewer/resources/marker.png b/examples/location/mapviewer/resources/marker.png new file mode 100644 index 00000000..86ec960e Binary files /dev/null and b/examples/location/mapviewer/resources/marker.png differ diff --git a/examples/location/mapviewer/resources/marker_hovered.png b/examples/location/mapviewer/resources/marker_hovered.png new file mode 100644 index 00000000..902ae591 Binary files /dev/null and b/examples/location/mapviewer/resources/marker_hovered.png differ diff --git a/examples/location/mapviewer/resources/marker_selected.png b/examples/location/mapviewer/resources/marker_selected.png new file mode 100644 index 00000000..f4bf8921 Binary files /dev/null and b/examples/location/mapviewer/resources/marker_selected.png differ diff --git a/examples/location/mapviewer/resources/scale.png b/examples/location/mapviewer/resources/scale.png new file mode 100644 index 00000000..6e59ff08 Binary files /dev/null and b/examples/location/mapviewer/resources/scale.png differ diff --git a/examples/location/mapviewer/resources/scale_end.png b/examples/location/mapviewer/resources/scale_end.png new file mode 100644 index 00000000..5d3a471b Binary files /dev/null and b/examples/location/mapviewer/resources/scale_end.png differ -- cgit v1.2.1