Name Description Size Coverage
qdeclarativecirclemapitem.cpp ! \qmltype MapCircle \nativetype QDeclarativeCircleMapItem \inqmlmodule QtLocation \ingroup qml-QtLocation5-maps \since QtLocation 5.5 \brief The MapCircle type displays a geographic circle on a Map. The MapCircle type displays a geographic circle on a Map, which consists of all points that are within a set distance from one central point. Depending on map projection, a geographic circle may not always be a perfect circle on the screen: for instance, in the Mercator projection, circles become ovoid in shape as they near the poles. To display a perfect screen circle around a point, use a MapQuickItem containing a relevant Qt Quick type instead. By default, the circle is displayed as a 1 pixel black border with no fill. To change its appearance, use the \l {color}, \l {border.color} and \l {border.width} properties. Internally, a MapCircle is implemented as a many-sided polygon. To calculate the radius points it uses a spherical model of the Earth, similar to the atDistanceAndAzimuth method of \l [QtPositioning]{geoCoordinate}. These two things can occasionally have implications for the accuracy of the circle's shape, depending on position and map projection. \note Dragging a MapCircle (through the use of \l {MouseArea} or \l {PointHandler}) causes new points to be generated at the same distance (in meters) from the center. This is in contrast to other map items which store their dimensions in terms of latitude and longitude differences between vertices. \section2 Example Usage The following snippet shows a map containing a MapCircle, centered at the coordinate (-27, 153) with a radius of 5km. The circle is filled in green, with a 3 pixel black border. \code Map { MapCircle { center { latitude: -27.5 longitude: 153.0 } radius: 5000.0 color: 'green' border.width: 3 } } \endcode \image api-mapcircle.png {Green circle on a map} 20638 -
qdeclarativecirclemapitem_p.h QDECLARATIVECIRCLEMAPITEM_H 2980 -
qdeclarativecirclemapitem_p_p.h 4685 -
qdeclarativegeomap.cpp ! \qmltype Map \nativetype QDeclarativeGeoMap \inqmlmodule QtLocation \ingroup qml-QtLocation5-maps \since QtLocation 5.0 \brief The Map type displays a map. The Map type is used to display a map or image of the Earth, with the capability to also display interactive objects tied to the map's surface. There are a variety of different ways to visualize the Earth's surface in a 2-dimensional manner, but all of them involve some kind of projection: a mathematical relationship between the 3D coordinates (latitude, longitude and altitude) and 2D coordinates (X and Y in pixels) on the screen. Different sources of map data can use different projections, and from the point of view of the Map type, we treat these as one replaceable unit: the Map plugin. A Map plugin consists of a data source, as well as all other details needed to display its data on-screen. The current Map plugin in use is contained in the \l plugin property of the Map item. In order to display any image in a Map item, you will need to set this property. See the \l Plugin type for a description of how to retrieve an appropriate plugin for use. The geographic region displayed in the Map item is referred to as its viewport, and this is defined by the properties \l center, and \l zoomLevel. The \l center property contains a \l [QtPositioning]{geoCoordinate} specifying the center of the viewport, while \l zoomLevel controls the scale of the map. See each of these properties for further details about their values. When the map is displayed, each possible geographic coordinate that is visible will map to some pixel X and Y coordinate on the screen. To perform conversions between these two, Map provides the \l toCoordinate and \l fromCoordinate functions, which are of general utility. \section2 Map Objects Map related objects can be declared within the body of a Map object in Qt Quick and will automatically appear on the Map. To add an object programmatically, first be sure it is created with the Map as its parent (for example in an argument to Component::createObject). Then call the \l addMapItem method on the Map, if the type of this object is one of \l MapCircle, \l MapRectangle, \l MapPolyline, \l MapPolygon, \l MapRoute or \l MapQuickItem. A corresponding \l removeMapItem method also exists to do the opposite and remove any of the above types of map objects from the Map. Moving Map objects around, resizing them or changing their shape normally does not involve any special interaction with Map itself -- changing these properties in a map object will automatically update the display. \section2 Performance Maps are rendered using OpenGL (ES) and the Qt Scene Graph stack, and as a result perform quite well where GL accelerated hardware is available. For "online" Maps, network bandwidth and latency can be major contributors to the user's perception of performance. Extensive caching is performed to mitigate this, but such mitigation is not always perfect. In general, large and complex Map items such as polygons and polylines with large numbers of vertices can have an adverse effect on UI performance. \section2 Example Usage The following snippet shows a simple Map and the necessary Plugin type to use it. The map is centered over Oslo, Norway, with zoom level 14. \quotefromfile minimal_map/main.qml \skipto import \printuntil Window { \dots \skipto Plugin \printuntil \image minimal_map.png {Map item centered on Oslo at zoom level 14} 71471 -
qdeclarativegeomap_p.h 11603 -
qdeclarativegeomapcopyrightsnotice.cpp ! \qmltype MapCopyrightNotice \nativetype QDeclarativeGeoMapCopyrightNotice \inqmlmodule QtLocation \ingroup qml-QtLocation5-maps \since QtLocation 5.9 \brief The MapCopyrightNotice item displays the current valid copyright notice for a Map element. This object can be used to place an additional copyright notices programmatically. Note that declaring a MapCopyrightNotice inside a QtLocation::Map element is not possible, like for any other QQuickItem. The release of this API with Qt 5.9 is a Technology Preview. 10366 -
qdeclarativegeomapcopyrightsnotice_p.h 2880 -
qdeclarativegeomapitembase.cpp ! \internal 8973 -
qdeclarativegeomapitembase_p.h 5386 -
qdeclarativegeomapitemgroup.cpp ! \qmltype MapItemGroup \nativetype QDeclarativeGeoMapItemGroup \inqmlmodule QtLocation \ingroup qml-QtLocation5-maps \since QtLocation 5.9 \brief The MapItemGroup type is a container for map items. Its purpose is to enable code modularization by allowing the usage of qml files containing map elements related to each other, and the associated bindings. \note The release of this API with Qt 5.9 is a Technology Preview. \section2 Example Usage The following snippet shows how to use a MapItemGroup to create a MapCircle, centered at the coordinate (63, -18) with a radius of 100km, filled in red, surrounded by an ondulated green border, both contained in a semitransparent blue circle with a MouseArea that moves the whole group. This group is defined in a separate file named PolygonGroup.qml: \code import QtQuick import QtPositioning import QtLocation MapItemGroup { id: itemGroup property alias position: mainCircle.center property var radius: 100 * 1000 property var borderHeightPct : 0.3 MapCircle { id: mainCircle center : QtPositioning.coordinate(40, 0) radius: itemGroup.radius * (1.0 + borderHeightPct) opacity: 0.05 visible: true color: 'blue' MouseArea{ anchors.fill: parent drag.target: parent id: maItemGroup } } MapCircle { id: groupCircle center: itemGroup.position radius: itemGroup.radius color: 'crimson' onCenterChanged: { groupPolyline.populateBorder(); } } MapPolyline { id: groupPolyline line.color: 'green' line.width: 3 function populateBorder() { groupPolyline.path = [] // clearing the path var waveLength = 8.0; var waveAmplitude = groupCircle.radius * borderHeightPct; for (var i=0; i <= 360; i++) { var wavePhase = (i/360.0 * 2.0 * Math.PI )* waveLength var waveHeight = (Math.cos(wavePhase) + 1.0) / 2.0 groupPolyline.addCoordinate(groupCircle.center.atDistanceAndAzimuth(groupCircle.radius + waveAmplitude * waveHeight , i)) } } Component.onCompleted: { populateBorder() } } } \endcode PolygonGroup.qml is now a reusable component that can then be used in a Map as: \code Map { id: map PolygonGroup { id: polygonGroup position: QtPositioning.coordinate(63,-18) } } \endcode \image api-mapitemgroup.png {Overlapping red and green polygons drawn on a map of Iceland} 5717 -
qdeclarativegeomapitemgroup_p.h 1889 -
qdeclarativegeomapitemtransitionmanager.cpp 1265 -
qdeclarativegeomapitemtransitionmanager_p.h 2823 -
qdeclarativegeomapitemutils.cpp 10407 -
qdeclarativegeomapitemutils_p.h 3487 -
qdeclarativegeomapitemview.cpp ! \qmltype MapItemView \nativetype QDeclarativeGeoMapItemView \inqmlmodule QtLocation \ingroup qml-QtLocation5-maps \since QtLocation 5.5 \inherits QtObject \brief The MapItemView is used to populate Map from a model. The MapItemView is used to populate Map with MapItems from a model. The MapItemView type only makes sense when contained in a Map, meaning that it has no standalone presentation. \section2 Example Usage This example demonstrates how to use the MapViewItem object to display a \l{route}{route} on a \l{Map}{map}: \snippet declarative/maps.qml QtQuick import \snippet declarative/maps.qml QtLocation import \codeline \snippet declarative/maps.qml MapRoute 20523 -
qdeclarativegeomapitemview_p.h 5094 -
qdeclarativegeomapquickitem.cpp ! \qmltype MapQuickItem \nativetype QDeclarativeGeoMapQuickItem \inqmlmodule QtLocation \ingroup qml-QtLocation5-maps \since QtLocation 5.5 \brief The MapQuickItem type displays an arbitrary Qt Quick object on a Map. The MapQuickItem type is used to place an arbitrary Qt Quick object on a Map at a specified location and size. Compared to floating an item above the Map, a MapQuickItem will follow the panning (and optionally, the zooming) of the Map as if it is on the Map surface. The \l{sourceItem} property contains the Qt Quick item to be drawn, which can be any kind of visible type. \section2 Positioning and Sizing The positioning of the MapQuickItem on the Map is controlled by two properties: \l coordinate and \l anchorPoint. If only \l coordinate is set, it specifies a longitude/latitude coordinate for the item to be placed at. The set coordinate will line up with the top-left corner of the contained item when shown on the screen. The \l anchorPoint property provides a way to line up the coordinate with other parts of the item than just the top-left corner, by setting a number of pixels the item will be offset by. A simple way to think about it is to note that the point given by \l anchorPoint on the item itself is the point that will line up with the given \l coordinate when displayed. In addition to being anchored to the map, the MapQuickItem can optionally follow the scale of the map, and change size when the Map is zoomed in or zoomed out. This behaviour is controlled by the \l zoomLevel property. The default behaviour if \l zoomLevel is not set is for the item to be drawn "on the screen" rather than "on the map", so that its size remains the same regardless of the zoom level of the Map. \section2 Performance Performance of a MapQuickItem is normally in the same ballpark as the contained Qt Quick item alone. Overheads added amount to a translation and (possibly) scaling of the original item, as well as a transformation from longitude and latitude to screen position. \section2 Limitations \note Due to an implementation detail, items placed inside a MapQuickItem will have a \c{parent} item which is not the MapQuickItem. Refer to the MapQuickItem by its \c{id}, and avoid the use of \c{anchor} in the \c{sourceItem}. \section2 Example Usage The following snippet shows a MapQuickItem containing an Image object, to display a Marker on the Map. This strategy is used to show the map markers in the MapViewer example. \snippet mapviewer/map/Marker.qml mqi-top \snippet mapviewer/map/Marker.qml mqi-anchor \snippet mapviewer/map/Marker.qml mqi-closeimage \snippet mapviewer/map/Marker.qml mqi-close \image api-mapquickitem.png {Marker rendered as a teardrop pin on a map} 15179 -
qdeclarativegeomapquickitem_p.h 3194 -
qdeclarativepolygonmapitem.cpp ! \qmltype MapPolygon \nativetype QDeclarativePolygonMapItem \inqmlmodule QtLocation \ingroup qml-QtLocation5-maps \since QtLocation 5.5 \brief The MapPolygon type displays a polygon on a Map. The MapPolygon type displays a polygon on a Map, specified in terms of an ordered list of \l {QtPositioning::coordinate}{coordinates}. For best appearance and results, polygons should be simple (not self-intersecting). Coordinates can be added or removed at any time using the \l addCoordinate and \l removeCoordinate methods. They can also be modified like any other list element in QML: \code mapPolygon.path[0].latitude = 5; \endcode For drawing rectangles with "straight" edges (same latitude across one edge, same latitude across the other), the \l MapRectangle type provides a simpler, two-point API. By default, the polygon is displayed as a 1 pixel black border with no fill. To change its appearance, use the \l color, \l border.color and \l border.width properties. \note Since MapPolygons are geographic items, dragging a MapPolygon (through the use of \l MouseArea or \l PointHandler) causes its vertices to be recalculated in the geographic coordinate space. The edges retain the same geographic lengths (latitude and longitude differences between the vertices), but they remain straight. Apparent stretching of the item occurs when dragged to a different latitude. \section2 Example Usage The following snippet shows a MapPolygon being used to display a triangle, with three vertices near Brisbane, Australia. The triangle is filled in green, with a 1 pixel black border. \code Map { MapPolygon { color: 'green' path: [ { latitude: -27, longitude: 153.0 }, { latitude: -27, longitude: 154.1 }, { latitude: -28, longitude: 153.5 } ] } } \endcode \image api-mappolygon.png {Green triangle on a map} 21233 -
qdeclarativepolygonmapitem_p.h QDECLARATIVEPOLYGONMAPITEM_H_ 2825 -
qdeclarativepolygonmapitem_p_p.h 7038 -
qdeclarativepolylinemapitem.cpp 28430 -
qdeclarativepolylinemapitem_p.h QDECLARATIVEPOLYLINEMAPITEM_H_ 3884 -
qdeclarativepolylinemapitem_p_p.h data 3751 -
qdeclarativerectanglemapitem.cpp ! \qmltype MapRectangle \nativetype QDeclarativeRectangleMapItem \inqmlmodule QtLocation \ingroup qml-QtLocation5-maps \since QtLocation 5.5 \brief The MapRectangle type displays a rectangle on a Map. The MapRectangle type displays a rectangle on a Map. Rectangles are a special case of Polygon with exactly 4 vertices and 4 "straight" edges. In this case, "straight" means that the top-left point has the same latitude as the top-right point (the top edge), and the bottom-left point has the same latitude as the bottom-right point (the bottom edge). Similarly, the points on the left side have the same longitude, and the points on the right side have the same longitude. To specify the rectangle, it requires a \l topLeft and \l bottomRight point, both given by a \l [QtPositioning]{geoCoordinate}. By default, the rectangle is displayed with transparent fill and a 1-pixel thick black border. This can be changed using the \l color, \l border.color and \l border.width properties. \note Similar to the \l MapPolygon type, MapRectangles are geographic items, thus dragging a MapRectangle causes its vertices to be recalculated in the geographic coordinate space. Apparent stretching of the item occurs when dragged to the a different latitude, however, its edges remain straight. \section2 Example Usage The following snippet shows a map containing a MapRectangle, spanning from (-27, 153) to (-28, 153.5), near Brisbane, Australia. The rectangle is filled in green, with a 2 pixel black border. \code Map { MapRectangle { color: 'green' border.width: 2 topLeft { latitude: -27 longitude: 153 } bottomRight { latitude: -28 longitude: 153.5 } } } \endcode \image api-maprectangle.png {Green rectangle on a map} 13553 -
qdeclarativerectanglemapitem_p.h QDECLARATIVERECTANGLEMAPITEM_H_ 3258 -
qdeclarativerectanglemapitem_p_p.h 2977 -
qdeclarativeroutemapitem.cpp ! \qmltype MapRoute \nativetype QDeclarativeRouteMapItem \inqmlmodule QtLocation \ingroup qml-QtLocation5-maps \since QtLocation 5.0 \brief The MapRoute type displays a Route on a Map. The MapRoute type displays a Route obtained through a RouteModel or other means, on the Map as a Polyline following the path of the Route. MapRoute is really a \l MapPolyline, but with the path specified using the \l route property instead of directly in \l [QtPositioning]{geoCoordinate}{coordinates}. By default, the route is displayed as a 1-pixel thick black line. This can be changed using the \l line.width and \l line.color properties. \section2 Example Usage Here is how to draw a \l{route}{route} on a \l{Map}{map}: \snippet declarative/maps.qml QtQuick import \snippet declarative/maps.qml QtLocation import \codeline \snippet declarative/maps.qml MapRoute 2910 -
qdeclarativeroutemapitem_p.h QDECLARATIVEROUTEMAPITEM_H_ 1569 -
qgeomapitemgeometry.cpp 626 -
qgeomapitemgeometry_p.h Size is # of triangles 4318 -