diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2013-10-22 14:37:37 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2013-10-22 14:38:06 +0200 |
commit | 71dffcd319c2641e1022bf857f9c72671cb1446a (patch) | |
tree | 84a7685d0c174a6c461c06aed60a2961a7d3f8fb /src/location | |
parent | 2867f1efc989478667ea7ae56ff91cd991d74121 (diff) | |
parent | 654b01af941ec620ca8a9b98be8542dda862d4a8 (diff) | |
download | qtlocation-71dffcd319c2641e1022bf857f9c72671cb1446a.tar.gz |
Merge branch 'stable' into dev
Conflicts:
src/imports/location/qdeclarativegeomap.cpp
src/imports/location/qdeclarativegeoroute.cpp
src/imports/location/qdeclarativegeoroutemodel.cpp
src/imports/location/qdeclarativegeoroutesegment.cpp
src/imports/location/qdeclarativepolygonmapitem.cpp
src/imports/location/qdeclarativepolylinemapitem.cpp
src/imports/positioning/positioning.cpp
Change-Id: Ieaa5f567d2144d0267e7eef5bd75bde7e0079fbe
Diffstat (limited to 'src/location')
-rw-r--r-- | src/location/doc/snippets/declarative/declarative-location.qml | 2 | ||||
-rw-r--r-- | src/location/doc/snippets/declarative/maps.qml | 2 | ||||
-rw-r--r-- | src/location/doc/snippets/declarative/places.qml | 2 | ||||
-rw-r--r-- | src/location/doc/snippets/declarative/places_loader.qml | 2 | ||||
-rw-r--r-- | src/location/doc/src/examples/declarative-mapviewer.qdoc | 20 | ||||
-rw-r--r-- | src/location/doc/src/examples/declarative-places.qdoc | 4 | ||||
-rw-r--r-- | src/location/doc/src/maps.qdoc | 62 | ||||
-rw-r--r-- | src/location/doc/src/qml-maps.qdoc | 6 | ||||
-rw-r--r-- | src/location/doc/src/qtlocation-qml.qdoc | 6 | ||||
-rw-r--r-- | src/location/maps/qgeocameratiles.cpp | 74 |
10 files changed, 125 insertions, 55 deletions
diff --git a/src/location/doc/snippets/declarative/declarative-location.qml b/src/location/doc/snippets/declarative/declarative-location.qml index 9b0efa42..b98de5a7 100644 --- a/src/location/doc/snippets/declarative/declarative-location.qml +++ b/src/location/doc/snippets/declarative/declarative-location.qml @@ -40,7 +40,7 @@ //![0] import QtQuick 2.0 -import QtPositioning 5.0 +import QtPositioning 5.2 Rectangle { id: page diff --git a/src/location/doc/snippets/declarative/maps.qml b/src/location/doc/snippets/declarative/maps.qml index eb5d5bc1..1a6d78fc 100644 --- a/src/location/doc/snippets/declarative/maps.qml +++ b/src/location/doc/snippets/declarative/maps.qml @@ -41,7 +41,7 @@ //! [QtQuick import] import QtQuick 2.0 //! [QtQuick import] -import QtPositioning 5.0 +import QtPositioning 5.2 //! [QtLocation import] import QtLocation 5.0 //! [QtLocation import] diff --git a/src/location/doc/snippets/declarative/places.qml b/src/location/doc/snippets/declarative/places.qml index 862ab182..6f32ddaf 100644 --- a/src/location/doc/snippets/declarative/places.qml +++ b/src/location/doc/snippets/declarative/places.qml @@ -42,7 +42,7 @@ import QtQuick 2.0 //! [QtQuick import] //! [QtLocation import] -import QtPositioning 5.0 +import QtPositioning 5.2 import QtLocation 5.0 //! [QtLocation import] diff --git a/src/location/doc/snippets/declarative/places_loader.qml b/src/location/doc/snippets/declarative/places_loader.qml index 06301064..13bfc74b 100644 --- a/src/location/doc/snippets/declarative/places_loader.qml +++ b/src/location/doc/snippets/declarative/places_loader.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtPositioning 5.0 +import QtPositioning 5.2 import QtLocation 5.0 Rectangle { diff --git a/src/location/doc/src/examples/declarative-mapviewer.qdoc b/src/location/doc/src/examples/declarative-mapviewer.qdoc index 6fbec0e9..ff7ff7db 100644 --- a/src/location/doc/src/examples/declarative-mapviewer.qdoc +++ b/src/location/doc/src/examples/declarative-mapviewer.qdoc @@ -38,8 +38,8 @@ covering each of these areas of functionality with snippets from the code. The Map Viewer example can work with any of the available geo services plugins. However, some - plugins may require additional \l {QtLocation5::PluginParameter}{plugin parameters} in order to - function correctly. \l {QtLocation5::PluginParameter}{Plugin parameters} can be passed on the + plugins may require additional \l {QtLocation::PluginParameter}{plugin parameters} in order to + function correctly. \l {QtLocation::PluginParameter}{Plugin parameters} can be passed on the command line using the \c {--plugin} argument, which takes the form: \code @@ -55,20 +55,20 @@ \list \li Displaying a map \list - \li \l{QtLocation5::Map}{Map} - \li \l{QtLocation5::MapGestureArea}{MapGestureArea} + \li \l{QtLocation::Map}{Map} + \li \l{QtLocation::MapGestureArea}{MapGestureArea} \li \l{coordinate} \endlist \li Finding an address \list - \li \l{QtLocation5::GeocodeModel}{GeocodeModel} - \li \l{QtLocation5::MapItemView}{MapItemView} - \li \l{QtLocation5::MapCircle}{MapCircle} + \li \l{QtLocation::GeocodeModel}{GeocodeModel} + \li \l{QtLocation::MapItemView}{MapItemView} + \li \l{QtLocation::MapCircle}{MapCircle} \endlist \li Directions and travel routes \list - \li \l{QtLocation5::RouteModel}{RouteModel} - \li \l{QtLocation5::MapRoute}{MapRoute} + \li \l{QtLocation::RouteModel}{RouteModel} + \li \l{QtLocation::MapRoute}{MapRoute} \endlist \endlist @@ -186,7 +186,7 @@ \snippet mapviewer/content/map/MapComponent.qml routeinfomodel Inside the RouteModel, we add an - \l{QtLocation5::RouteModel::status}{onStatusChanged} handler, which + \l{QtLocation::RouteModel::status}{onStatusChanged} handler, which calls the \c{update()} function we defined on the model: \snippet mapviewer/content/map/MapComponent.qml routemodel1 diff --git a/src/location/doc/src/examples/declarative-places.qdoc b/src/location/doc/src/examples/declarative-places.qdoc index 30848740..f73d2bee 100644 --- a/src/location/doc/src/examples/declarative-places.qdoc +++ b/src/location/doc/src/examples/declarative-places.qdoc @@ -61,8 +61,8 @@ from the "New" menu and fill in the fields. Click "Go!" to save the category. The Places example can work with any of the available geo services plugins. However, some - plugins may require additional \l {QtLocation5::PluginParameter}{plugin parameters} in order to - function correctly. \l {QtLocation5::PluginParameter}{Plugin parameters} can be passed on the + plugins may require additional \l {QtLocation::PluginParameter}{plugin parameters} in order to + function correctly. \l {QtLocation::PluginParameter}{Plugin parameters} can be passed on the command line using the \c {--plugin} argument, which takes the form: \code diff --git a/src/location/doc/src/maps.qdoc b/src/location/doc/src/maps.qdoc index a97f28f9..a9816f52 100644 --- a/src/location/doc/src/maps.qdoc +++ b/src/location/doc/src/maps.qdoc @@ -47,26 +47,26 @@ A more hands-on introduction of the Maps and Navigation types can be found in th \section2 Displaying Maps -Displaying a map is done using the \l{QtLocation5::Map}{Map} QML types. The Map type supports -user interaction through the \l{QtLocation5::MapGestureArea}{MapGestureArea} QML type. The Map +Displaying a map is done using the \l{QtLocation::Map}{Map} QML types. The Map type supports +user interaction through the \l{QtLocation::MapGestureArea}{MapGestureArea} QML type. The Map object draws the map on-screen using OpenGL (ES), allowing for hardware-accelerated rendering where available. \b{Key Types} \table \row - \li \l{QtLocation5::Plugin}{Plugin} + \li \l{QtLocation::Plugin}{Plugin} \li A location-based services plugin provides data including map data which is then displayed in a Map object. \row - \li \l{QtLocation5::Map}{Map} + \li \l{QtLocation::Map}{Map} \li QtQuick item to display a map on-screen. \row - \li \l{QtLocation5::MapGestureArea}{MapGestureArea} + \li \l{QtLocation::MapGestureArea}{MapGestureArea} \li Interaction helper for panning, flicking and pinch-to-zoom gesture on a Map. \endtable -Note that the client must create a \l{QtLocation5::Plugin}{Plugin} object -prior to using a \l{QtLocation5::Map}{Map} type in order to have access +Note that the client must create a \l{QtLocation::Plugin}{Plugin} object +prior to using a \l{QtLocation::Map}{Map} type in order to have access to map data to display. \section2 Putting Objects on a Map (Map Overlay Objects) @@ -74,47 +74,47 @@ to map data to display. Maps can also contain map overlay objects, which are used to display information on its surface. There is a set of basic pre-defined map overlay objects, as well as the ability to implement custom map overlay objects using the -\l{QtLocation5::MapQuickItem}{MapQuickItem} type, which can contain any +\l{QtLocation::MapQuickItem}{MapQuickItem} type, which can contain any standard QtQuick item. \b{Key Types} \table \row - \li \l{QtLocation5::MapCircle}{MapCircle} + \li \l{QtLocation::MapCircle}{MapCircle} \li A geographic circle (all points at a set distance from a center), optionally with a border. \row - \li \l{QtLocation5::MapRectangle}{MapRectangle} + \li \l{QtLocation::MapRectangle}{MapRectangle} \li A rectangle whose top left and bottom right points are specified as \l {coordinate} types, optionally with a border. \row - \li \l{QtLocation5::MapPolygon}{MapPolygon} + \li \l{QtLocation::MapPolygon}{MapPolygon} \li A polygon made of an arbitrary list of \l {coordinate}{coordinates}. \row - \li \l{QtLocation5::MapPolyline}{MapPolyline} + \li \l{QtLocation::MapPolyline}{MapPolyline} \li A polyline made of an arbitrary list of \l {coordinate}{coordinates}. \row - \li \l{QtLocation5::MapQuickItem}{MapQuickItem} + \li \l{QtLocation::MapQuickItem}{MapQuickItem} \li Turns any arbitrary QtQuick Item into a map overlay object. MapQuickItem is an enabler for specifying custom map overlay objects. \endtable \section2 Model-View Design with Map Overlay Objects To automatically generate map overlay objects based on the contents of a QtQuick -model (for example a ListModel item), the \l{QtLocation5::MapItemView}{MapItemView} +model (for example a ListModel item), the \l{QtLocation::MapItemView}{MapItemView} type is available. It accepts any map overlay object as its delegate, and can -only be created within a \l{QtLocation5::Map}{Map}. +only be created within a \l{QtLocation::Map}{Map}. \b{Key Types} \table \row - \li \l{QtLocation5::MapItemView}{MapItemView} + \li \l{QtLocation::MapItemView}{MapItemView} \li Populates a Map with map overlay objects based on the data provided by a model. \endtable \section2 Interaction with Map Overlay Objects Interaction with the pre-defined map overlay object types is done using the -\l{QtLocation5::MapMouseArea}{MapMouseArea} type, which behaves much like a +\l{QtLocation::MapMouseArea}{MapMouseArea} type, which behaves much like a normal QtQuick MouseArea. MapQuickItems can also contain MapMouseArea objects, but can additionally use normal QtQuick MouseAreas to provide interaction. @@ -126,10 +126,10 @@ available. \b{Key Types} \table \row - \li \l{QtLocation5::MapMouseArea}{MapMouseArea} + \li \l{QtLocation::MapMouseArea}{MapMouseArea} \li Accepts mouse events for a pre-defined map overlay object (for example MapCircle). \row - \li \l{QtLocation5::MapMouseEvent}{MapMouseEvent} + \li \l{QtLocation::MapMouseEvent}{MapMouseEvent} \li Provides additional information unique to mouse events on a Map. \endtable @@ -138,16 +138,16 @@ available. Geocoding is the translation of geographic coordinates into addresses, or vice versa. Such a translation usually involves sending the source data to a server which then performs the translation and returns the results, although some -location-based service provider \l{QtLocation5::Plugin}{plugins} may be able to +location-based service provider \l{QtLocation::Plugin}{plugins} may be able to provide some geocoding functionality without sending data to a remote server. The availability and accuracy of the translation usually depends on the location or address being translated, as different areas of the Earth are mapped to varying degrees of accuracy. A geocoding query in QML is performed using the -\l{QtLocation5::GeocodeModel}{GeocodeModel} type. For an address-to-coordinate +\l{QtLocation::GeocodeModel}{GeocodeModel} type. For an address-to-coordinate query, its \c{query} property may be set to either an -\l{QtPositioning5::Address}{Address} object or a string containing the textual +\l{QtPositioning::Address}{Address} object or a string containing the textual form of the address to search for. To perform the reverse, the same property can be set to a \l {coordinate} instead. Results are made available in the contents of the model. @@ -155,18 +155,18 @@ contents of the model. \b{Key Types} \table \row - \li \l{QtLocation5::Plugin}{Plugin} + \li \l{QtLocation::Plugin}{Plugin} \li A location-based services plugin provides data including geocoding translation results which are exposed to clients via a GeocodeModel. \row - \li \l{QtLocation5::GeocodeModel}{GeocodeModel} + \li \l{QtLocation::GeocodeModel}{GeocodeModel} \li Queries the Plugin for geocoding translations and provides access to results via indexes in the model. \row - \li \l{QtPositioning5::Address}{Address} + \li \l{QtPositioning::Address}{Address} \li Structured address for use in queries and results of geocoding. \endtable -Note that the client must create a \l{QtLocation5::Plugin}{Plugin} object -prior to using a \l{QtLocation5::GeocodeModel}{GeocodeModel} object. This +Note that the client must create a \l{QtLocation::Plugin}{Plugin} object +prior to using a \l{QtLocation::GeocodeModel}{GeocodeModel} object. This will enable access to geocoding translation services and thus data to display. \section1 Routing and Navigation @@ -181,16 +181,16 @@ between the segments. \b{Key Types} \table \row - \li \l{QtLocation5::Route}{Route} + \li \l{QtLocation::Route}{Route} \li The entire path to be navigated. \row - \li \l{QtLocation5::RouteSegment}{RouteSegment} + \li \l{QtLocation::RouteSegment}{RouteSegment} \li The individual components of a route. \row - \li \l{QtLocation5::RouteManeuver}{RouteManeuver} + \li \l{QtLocation::RouteManeuver}{RouteManeuver} \li The navigation information that joins segments. \row - \li \l{QtLocation5::RouteModel}{RouteModel} + \li \l{QtLocation::RouteModel}{RouteModel} \li The means of making requests on the backend to supply route information. \endtable diff --git a/src/location/doc/src/qml-maps.qdoc b/src/location/doc/src/qml-maps.qdoc index f63cc5a4..84ccfbf4 100644 --- a/src/location/doc/src/qml-maps.qdoc +++ b/src/location/doc/src/qml-maps.qdoc @@ -60,7 +60,7 @@ The basic piece of position information is the \l {coordinate}. A coordinate encapsulates data for the latitude, longitude and altitude of the location. Altitude is in meters. It also has a method to determine distance to another \l {coordinate}. The \l {coordinate} type may -also be held within a \l {QtPositioning5::Location}{Location} element, this will also have information +also be held within a \l {QtPositioning::Location}{Location} element, this will also have information on a bounding box size to determine sufficient proximity to the location and a location address. @@ -70,7 +70,7 @@ to center a \l{Map}{map} on the current position: \code Rectangle { - import QtPositioning 5.0 + import QtPositioning 5.2 import QtLocation 5.0 ... @@ -216,7 +216,7 @@ Enabling and configuring pinch and flickable is easy within the \l Map type. Zoom can also be controlled by other objects like sliders, as shown in the example, by implementing the \c onValueChanged handler to update the Map -\l {QtLocation5::Map::}{zoomLevel}. +\l {QtLocation::Map::}{zoomLevel}. \section1 Types diff --git a/src/location/doc/src/qtlocation-qml.qdoc b/src/location/doc/src/qtlocation-qml.qdoc index a24820bd..ed280dfb 100644 --- a/src/location/doc/src/qtlocation-qml.qdoc +++ b/src/location/doc/src/qtlocation-qml.qdoc @@ -41,14 +41,14 @@ statement in the QML file. \section2 Location QML Concepts Provided that a position has been obtained this module can -add a \l {QtLocation5::Map}{Map} with positions of interest and -\l {QtLocation5::Place}{Places}. The user can be made aware of nearby features and related +add a \l {QtLocation::Map}{Map} with positions of interest and +\l {QtLocation::Place}{Places}. The user can be made aware of nearby features and related information, displayed graphically. Features on the \l Map may be places of business, entertainment and so on. They may include paths, roads, or forms of transport leading so that navigation optimization and assistance are possible. To perform navigation we need \l {Route}s from start to destination. These routes -are made up of segments. Each \l {QtLocation5::RouteSegment}{RouteSegment} +are made up of segments. Each \l {QtLocation::RouteSegment}{RouteSegment} can be considered a navigation sub-task: drive 100 meters, turn left. The beginning and end of each segment is a \e waypoint, that is, one part of our journey. diff --git a/src/location/maps/qgeocameratiles.cpp b/src/location/maps/qgeocameratiles.cpp index 050e7fc3..32bbae36 100644 --- a/src/location/maps/qgeocameratiles.cpp +++ b/src/location/maps/qgeocameratiles.cpp @@ -53,6 +53,7 @@ #include <QDebug> +#include <algorithm> #include <cmath> QT_BEGIN_NAMESPACE @@ -413,6 +414,74 @@ void QGeoCameraTilesPrivate::appendZIntersects(const QDoubleVector3D &start, } } +/***************************************************/ +/* Local copy of qSort & qSortHelper to suppress deprecation warnings + * following the deprecation of QtAlgorithms. The comparison has subtle + * differences which eluded detection so far. We just reuse old qSort for now. + **/ + +template <typename RandomAccessIterator, typename LessThan> +inline void localqSort(RandomAccessIterator start, RandomAccessIterator end, LessThan lessThan) +{ + if (start != end) + localqSortHelper(start, end, *start, lessThan); +} + +template <typename RandomAccessIterator, typename T, typename LessThan> +void localqSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan) +{ +top: + int span = int(end - start); + if (span < 2) + return; + + --end; + RandomAccessIterator low = start, high = end - 1; + RandomAccessIterator pivot = start + span / 2; + + if (lessThan(*end, *start)) + qSwap(*end, *start); + if (span == 2) + return; + + if (lessThan(*pivot, *start)) + qSwap(*pivot, *start); + if (lessThan(*end, *pivot)) + qSwap(*end, *pivot); + if (span == 3) + return; + + qSwap(*pivot, *end); + + while (low < high) { + while (low < high && lessThan(*low, *end)) + ++low; + + while (high > low && lessThan(*end, *high)) + --high; + + if (low < high) { + qSwap(*low, *high); + ++low; + --high; + } else { + break; + } + } + + if (lessThan(*low, *end)) + ++low; + + qSwap(*end, *low); + localqSortHelper(start, low, t, lessThan); + + start = low + 1; + ++end; + goto top; +} +/***************************************************/ + + // Returns the intersection of the plane of the map and the camera frustum as a right handed polygon Polygon QGeoCameraTilesPrivate::frustumFootprint(const Frustum &frustum) const { @@ -443,7 +512,8 @@ Polygon QGeoCameraTilesPrivate::frustumFootprint(const Frustum &frustum) const // - initial sort to remove duplicates sorter.base = points.first(); - qSort(points.begin(), points.end(), sorter); + localqSort(points.begin(), points.end(), sorter); + //std::sort(points.begin(), points.end(), sorter); for (int i = points.size() - 1; i > 0; --i) { if (points.at(i) == points.at(i - 1)) points.remove(i); @@ -457,7 +527,7 @@ Polygon QGeoCameraTilesPrivate::frustumFootprint(const Frustum &frustum) const for (i = points.begin(); i != points.end(); ++i) { sorter.base = *i; if (i + 1 != points.end()) - qSort(i + 1, points.end(), sorter); + std::sort(i + 1, points.end(), sorter) ; } // - determine if what we have is right handed |