This file is indexed.

/usr/share/qt5/doc/qtlocation/qml-location5-maps.html is in qtlocation5-doc-html 5.5.1-3ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qml-maps.qdoc -->
  <title>QML Maps | Qt Location 5.5</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
    <div class="main">
    <div class="main-rounded">
        <div class="navigationbar">
        <ul>
<li>Qt 5.5</li>
<li><a href="qtlocation-index.html">Qt Location</a></li>
<li>QML Maps</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
    </ul>
    </div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#overview">Overview</a></li>
<li class="level2"><a href="#position-on-map">Position on map</a></li>
<li class="level2"><a href="#geocoding">Geocoding</a></li>
<li class="level2"><a href="#navigation">Navigation</a></li>
<li class="level2"><a href="#zoom-pinch-and-flickable">Zoom, Pinch and Flickable</a></li>
<li class="level1"><a href="#qml-types">QML Types</a></li>
<li class="level1"><a href="#example">Example</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QML Maps</h1>
<span class="subtitle"></span>
<!-- $$$qml-location5-maps.html-description -->
<div class="descr"> <a name="details"></a>
<a name="overview"></a>
<h2 id="overview">Overview</h2>
<p>The <a href="qml-qtlocation-map.html">Map</a> type allows the display of a map and placing objects within the map. Various points of interest can be defined and added to the map for display. Also the <a href="qml-qtlocation-map.html">Map</a> has features to control how the map is displayed. With the Map item you can center the map, zoom, pinch and make the item flickable.</p>
<p>The places to be added to the map are <a href="location-maps-qml.html#putting-objects-on-a-map-map-overlay-objects">MapItems</a>. The item's position is defined by a coordinate which includes latitude, longitude and altitude. The item is then displayed automatically after it is added to the Map. <a href="location-maps-qml.html#putting-objects-on-a-map-map-overlay-objects">MapItems</a> or <a href="qml-qtlocation-map.html">Map</a>.</p>
<a name="position-on-map"></a>
<h3 >Position on map</h3>
<p>All position APIs are part of the QtPositioning module. The basic piece of position information is the 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 coordinate. The coordinate type may also be held within a Location element, this will also have information on a bounding box size to determine sufficient proximity to the location and a location address.</p>
<p>Here is an example of a client that uses a position source to center a <a href="qml-qtlocation-map.html">map</a> on the current position:</p>
<pre class="cpp">Rectangle {

    import <span class="type">QtPositioning</span> <span class="number">5.2</span>
    import <span class="type"><a href="qtlocation-module.html">QtLocation</a></span> <span class="number">5.3</span>
    <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>

    Map {
        id: map
        <span class="comment">// initialize map</span>
        <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
    }

    PositionSource {
        onPositionChanged: {
            <span class="comment">// center the map on the current position</span>
            map<span class="operator">.</span>center <span class="operator">=</span> position<span class="operator">.</span>coordinate
        }
    }
}</pre>
<a name="geocoding"></a>
<h3 >Geocoding</h3>
<p><a href="http://en.wikipedia.org/wiki/Geocoding">Geocoding</a> is the derivation of geographical coordinates (latitude and longitude) from other geographical references to the locations. For example, this can be a street address. Reverse geocoding is also possible with a street address being used to determine a geographical coordinate. Geocoding is performed by using the <a href="qml-qtlocation-geocodemodel.html">GeocodeModel</a> type.</p>
<p>The following code examples are a small part of the <code>map</code> component in the <a href="qtlocation-mapviewer-example.html">Map Viewer (QML)</a> example. The snippets demonstrate the declaration of the <a href="qml-qtlocation-geocodemodel.html">GeocodeModel</a> component.</p>
<p>In the snippet we see that the [QML]{<a href="qml-qtlocation-geocodemodel.html">GeocodeModel</a>} contains the plugin and two signal handlers. One for changes in status <a href="qml-qtlocation-geocodemodel.html#status-prop"><code>onStatusChanged</code></a> and the other to update the centering of the Map object <a href="qml-qtlocation-geocodemodel.html#locationsChanged-signal"><code>onLocationsChanged</code></a>.</p>
<pre class="qml"><span class="type"><a href="qml-qtlocation-geocodemodel.html">GeocodeModel</a></span> {
    <span class="name">id</span>: <span class="name">geocodeModel</span>
    <span class="name">plugin</span>: <span class="name">map</span>.<span class="name">plugin</span>
    <span class="name">onStatusChanged</span>: {
        <span class="keyword">if</span> ((<span class="name">status</span> <span class="operator">==</span> <span class="name">GeocodeModel</span>.<span class="name">Ready</span>) <span class="operator">||</span> (<span class="name">status</span> <span class="operator">==</span> <span class="name">GeocodeModel</span>.<span class="name">Error</span>))
            <span class="name">map</span>.<span class="name">geocodeFinished</span>()
    }
    <span class="name">onLocationsChanged</span>:
    {
        <span class="keyword">if</span> (<span class="name">count</span> <span class="operator">==</span> <span class="number">1</span>) {
            <span class="name">map</span>.<span class="name">center</span>.<span class="name">latitude</span> <span class="operator">=</span> <span class="name">get</span>(<span class="number">0</span>).<span class="name">coordinate</span>.<span class="name">latitude</span>
            <span class="name">map</span>.<span class="name">center</span>.<span class="name">longitude</span> <span class="operator">=</span> <span class="name">get</span>(<span class="number">0</span>).<span class="name">coordinate</span>.<span class="name">longitude</span>
        }
    }
}

<span class="type"><a href="qml-qtlocation-mapitemview.html">MapItemView</a></span> {
    <span class="name">model</span>: <span class="name">geocodeModel</span>
    <span class="name">delegate</span>: <span class="name">pointDelegate</span>
}</pre>
<p>The geocoding features are called from a higher level piece of code. In this snippet we see an <a href="../qtcore/qt.html#modal">Address</a> object filled with the desired parameters.</p>
<pre class="qml"><span class="type">Address</span> {
    <span class="name">id</span> :<span class="name">fromAddress</span>
    <span class="name">street</span>: <span class="string">&quot;Sandakerveien 116&quot;</span>
    <span class="name">city</span>: <span class="string">&quot;Oslo&quot;</span>
    <span class="name">country</span>: <span class="string">&quot;Norway&quot;</span>
    <span class="name">state</span> : <span class="string">&quot;&quot;</span>
    <span class="name">postalCode</span>: <span class="string">&quot;0484&quot;</span>
}</pre>
<p>The <a href="../qtcore/qt.html#modal">Address</a> is later used in a query for the <a href="qml-qtlocation-geocodemodel.html">GeocodeModel</a> to process and determine the geographical <a href="../qtcore/qt.html#modal">coordinates</a>.</p>
<pre class="qml"><span class="comment">// send the geocode request</span>
<span class="name">geocodeModel</span>.<span class="name">query</span> <span class="operator">=</span> <span class="name">fromAddress</span>
<span class="name">geocodeModel</span>.<span class="name">update</span>()</pre>
<a name="navigation"></a>
<h3 >Navigation</h3>
<p>A very important function of the <a href="qml-qtlocation-map.html">Map</a> type is navigation from one place to a destination with possible waypoints along the route. The route will be divided up into a series of segments. At the end of each segment is a vertex called a <i>maneuver</i>. The <i>segments</i> contain information about the time and distance to the end of the segment. The <i>maneuvers</i> contain information about what to do next, how to get onto the next segment, if there is one. So a <i>maneuver</i> contains navigational information, for example &quot;turn right now&quot;.</p>
<p>To find a suitable route we will need to use a <a href="qml-qtlocation-routequery.html">RouteQuery</a> to define the selection criteria and adding any required waypoints. The <a href="qml-qtlocation-routemodel.html">RouteModel</a> should return a list of <a href="qml-qtlocation-routesegment.html">RouteSegment</a>s that defines the route to the destination complete with navigation advice at the joins between segments, called <a href="qml-qtlocation-routemaneuver.html">RouteManeuver</a>s</p>
<p>There are many options that you can add to the query to narrow the criteria. The <a href="qml-qtlocation-routequery.html">RouteQuery</a> properties can include</p>
<div class="table"><table class="generic" width="60%">
 <tr valign="top" class="odd"><td ><a href="qml-qtlocation-routequery.html#numberAlternativeRoutes-prop">numberAlternativeRoutes</a></td><td >The number of alternative routes</td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtlocation-routequery.html#travelModes-prop">travelModes</a></td><td >Travel modes</td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtlocation-routequery.html#routeOptimizations-prop">routeOptimizations</a></td><td >Required route optimizations</td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtlocation-routequery.html#segmentDetail-prop">segmentDetail</a></td><td >Level of detail in segments</td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtlocation-routequery.html#maneuverDetail-prop">maneuverDetail</a></td><td >Level of detail in maneuvers between segments</td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtlocation-routequery.html#waypoints-prop">waypoints</a></td><td >A list of waypoints</td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtlocation-routequery.html#excludedAreas-prop">excludedAreas</a></td><td >A list of excluded areas that the route must not cross</td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtlocation-routequery.html#featureTypes-prop">featureTypes</a></td><td >Relevant map features, for example highway, ferry</td></tr>
</table></div>
<p>In the following example a default <a href="qml-qtlocation-routequery.html">RouteQuery</a> is declared within <a href="qml-qtlocation-routemodel.html">RouteModel</a>.</p>
<pre class="qml"><span class="type"><a href="qml-qtlocation-routemodel.html">RouteModel</a></span> {
    <span class="name">id</span>: <span class="name">routeModel</span>
    <span class="name">plugin</span> : <span class="name">map</span>.<span class="name">plugin</span>
    <span class="name">query</span>:  <span class="name">RouteQuery</span> {
        <span class="name">id</span>: <span class="name">routeQuery</span>
    }
    <span class="name">onStatusChanged</span>: {
        <span class="keyword">if</span> (<span class="name">status</span> <span class="operator">==</span> <span class="name">RouteModel</span>.<span class="name">Ready</span>) {
            <span class="keyword">switch</span> (<span class="name">count</span>) {
            <span class="keyword">case</span> <span class="number">0</span>:
                <span class="comment">// technically not an error</span>
                <span class="name">map</span>.<span class="name">routeError</span>()
                <span class="keyword">break</span>
            <span class="keyword">case</span> <span class="number">1</span>:
                <span class="name">map</span>.<span class="name">showRouteList</span>()
                <span class="keyword">break</span>
            }
        } <span class="keyword">else</span> <span class="keyword">if</span> (<span class="name">status</span> <span class="operator">==</span> <span class="name">RouteModel</span>.<span class="name">Error</span>) {
            <span class="name">map</span>.<span class="name">routeError</span>()
        }
    }
}</pre>
<p>The user enters some information such as the starting point of the route, some waypoints and the destination. All of these locations are waypoints so the locations from start to finish will be entered as a sequence of waypoints. Then other query properties can be set that may be specific to this trip.</p>
<pre class="qml"><span class="comment">// clear away any old data in the query</span>
<span class="name">routeQuery</span>.<span class="name">clearWaypoints</span>();

<span class="comment">// add the start and end coords as waypoints on the route</span>
<span class="name">routeQuery</span>.<span class="name">addWaypoint</span>(<span class="name">startCoordinate</span>)
<span class="name">routeQuery</span>.<span class="name">addWaypoint</span>(<span class="name">endCoordinate</span>)
<span class="name">routeQuery</span>.<span class="name">travelModes</span> <span class="operator">=</span> <span class="name">RouteQuery</span>.<span class="name">CarTravel</span>
<span class="name">routeQuery</span>.<span class="name">routeOptimizations</span> <span class="operator">=</span> <span class="name">RouteQuery</span>.<span class="name">FastestRoute</span>

<span class="name">routeModel</span>.<span class="name">update</span>();</pre>
<p>The <code>routeInfoModel</code> ListModel is used to grab the results of the query and construct a suitable list for display.</p>
<pre class="qml"><span class="type">ListView</span> {
    <span class="name">interactive</span>: <span class="number">true</span>
    <span class="name">model</span>: <span class="name">ListModel</span> { <span class="name">id</span>: <span class="name">routeInfoModel</span> }
    <span class="name">header</span>: <span class="name">RouteListHeader</span> {}
    <span class="name">delegate</span>:  <span class="name">RouteListDelegate</span>{
        <span class="name">routeIndex</span>.text: <span class="name">index</span> <span class="operator">+</span> <span class="number">1</span>
        <span class="name">routeInstruction</span>.text: <span class="name">instruction</span>
        <span class="name">routeDistance</span>.text: <span class="name">distance</span>
    }
}</pre>
<p>The ListModel <code>routeInfoModel</code> can be filled with values using a code, that loops through the segments extracting the segment length, instruction text and distance to the next instruction. The extracted data is formatted for display as it is retrieved.</p>
<pre class="qml"><span class="name">routeInfoModel</span>.<span class="name">clear</span>()
<span class="keyword">if</span> (<span class="name">routeModel</span>.<span class="name">count</span> <span class="operator">&gt;</span> <span class="number">0</span>) {
    <span class="keyword">for</span> (<span class="keyword">var</span> <span class="name">i</span> = <span class="number">0</span>; <span class="name">i</span> <span class="operator">&lt;</span> <span class="name">routeModel</span>.<span class="name">get</span>(<span class="number">0</span>).<span class="name">segments</span>.<span class="name">length</span>; i++) {
        <span class="name">routeInfoModel</span>.<span class="name">append</span>({
            &quot;instruction&quot;: <span class="name">routeModel</span>.<span class="name">get</span>(<span class="number">0</span>).<span class="name">segments</span>[<span class="name">i</span>].<span class="name">maneuver</span>.<span class="name">instructionText</span>,
             &quot;distance&quot;: <span class="name">Helper</span>.<span class="name">formatDistance</span>(<span class="name">routeModel</span>.<span class="name">get</span>(<span class="number">0</span>).<span class="name">segments</span>[<span class="name">i</span>].<span class="name">maneuver</span>.<span class="name">distanceToNextInstruction</span>)
        });
    }
}</pre>
<p>For more information on the example see the <a href="qtlocation-mapviewer-example.html">Map Viewer (QML)</a> example.</p>
<a name="zoom-pinch-and-flickable"></a>
<h3 >Zoom, Pinch and Flickable</h3>
<p>The <a href="qml-qtlocation-map.html">Map</a> item also supports user interface interactions with the map using tactile and mouse gestures. That is features such as swiping to pan, pinching to zoom.</p>
<p>Enabling and configuring pinch and flickable is easy within the <a href="qml-qtlocation-map.html">Map</a> type.</p>
<pre class="qml"><span class="type"><a href="qml-qtlocation-map.html">Map</a></span> {
    <span class="name">id</span>: <span class="name">map</span>
    <span class="comment">// Enable pan, flick, and pinch gestures to zoom in and out</span>
    <span class="name">gesture</span>.activeGestures: <span class="name">MapGestureArea</span>.<span class="name">PanGesture</span> <span class="operator">|</span> <span class="name">MapGestureArea</span>.<span class="name">FlickGesture</span> <span class="operator">|</span> <span class="name">MapGestureArea</span>.<span class="name">ZoomGesture</span>
    <span class="name">gesture</span>.flickDeceleration: <span class="number">3000</span>
    <span class="name">gesture</span>.enabled: <span class="number">true</span>
}</pre>
<p>Zoom can also be controlled by other objects like sliders, with binding to the Map <a href="qml-qtlocation-map.html#zoomLevel-prop">zoomLevel</a>.</p>
<a name="qml-types"></a>
<h2 id="qml-types">QML Types</h2>
<a name="maps"></a>
<h4 >Maps</h4>
<div class="table"><table class="annotated">
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtlocation-map.html">Map</a></p></td><td class="tblDescr"><p>Type displays a map</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qml-qtlocation-mapcircle.html">MapCircle</a></p></td><td class="tblDescr"><p>Type displays a geographic circle on a Map</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtlocation-mapgesturearea.html">MapGestureArea</a></p></td><td class="tblDescr"><p>Type provides Map gesture interaction</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qml-qtlocation-mapitemview.html">MapItemView</a></p></td><td class="tblDescr"><p>Used to populate Map from a model</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtlocation-mappinchevent.html">MapPinchEvent</a></p></td><td class="tblDescr"><p>Type provides basic information about pinch event</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qml-qtlocation-mappolygon.html">MapPolygon</a></p></td><td class="tblDescr"><p>Type displays a polygon on a Map</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtlocation-mappolyline.html">MapPolyline</a></p></td><td class="tblDescr"><p>Type displays a polyline on a map</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qml-qtlocation-mapquickitem.html">MapQuickItem</a></p></td><td class="tblDescr"><p>Type displays an arbitrary Qt Quick object on a Map</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtlocation-maprectangle.html">MapRectangle</a></p></td><td class="tblDescr"><p>Type displays a rectangle on a Map</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qml-qtlocation-maproute.html">MapRoute</a></p></td><td class="tblDescr"><p>Type displays a Route on a Map</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtlocation-maptype.html">MapType</a></p></td><td class="tblDescr"><p>Type holds information about a map type</p></td></tr>
</table></div>
<a name="geocoding"></a>
<h4 >Geocoding</h4>
<div class="table"><table class="annotated">
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtlocation-geocodemodel.html">GeocodeModel</a></p></td><td class="tblDescr"><p>Type provides support for searching operations related to geographic information</p></td></tr>
</table></div>
<a name="routing"></a>
<h4 >Routing</h4>
<div class="table"><table class="annotated">
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtlocation-route.html">Route</a></p></td><td class="tblDescr"><p>Type represents one geographical route</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qml-qtlocation-routemaneuver.html">RouteManeuver</a></p></td><td class="tblDescr"><p>Type represents the information relevant to the point at which two RouteSegments meet</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtlocation-routemodel.html">RouteModel</a></p></td><td class="tblDescr"><p>Type provides access to routes</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qml-qtlocation-routequery.html">RouteQuery</a></p></td><td class="tblDescr"><p>Type is used to provide query parameters to a RouteModel</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtlocation-routesegment.html">RouteSegment</a></p></td><td class="tblDescr"><p>Type represents a segment of a Route</p></td></tr>
</table></div>
<a name="example"></a>
<h2 id="example">Example</h2>
<p>The above snippets are taken from the <a href="qtlocation-mapviewer-example.html">Map Viewer (QML)</a> example.</p>
</div>
<!-- @@@qml-location5-maps.html -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>