IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

MapRoute QML Type

The MapRoute type displays a Route on a Map.

This type was introduced in QtLocation 5.0.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

MapRoute QML Type

  • Import Statement: import QtLocation 6.5

  • Since: QtLocation 5.0

  • Group: MapRoute is part of QML Maps Plugin

Detailed Description

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 MapPolyline, but with the path specified using the route property instead of directly in coordinates.

By default, the route is displayed as a 1-pixel thick black line. This can be changed using the line.width and line.color properties.

Example Usage

Here is how to draw a route on a map:

 
Sélectionnez
import QtQuick
import QtPositioning
import QtLocation

Map {
    RouteModel {
        id: routeModel
    }

    MapItemView {
        model: routeModel
        delegate: routeDelegate
    }

    Component {
        id: routeDelegate

        MapRoute {
            route: routeData
            line.color: "blue"
            line.width: 5
            smooth: true
            opacity: 0.8
        }
    }
}

Property Documentation

 

line group

line.color : color

line.width : int

This property is part of the line property group. The line property group holds the width and color used to draw the line.

The width is in pixels and is independent of the zoom level of the map. The default values correspond to a black border with a width of 1 pixel.

For no line, use a width of 0 or a transparent color.

route : Route

This property holds the route to be drawn which can be used to represent one geographical route.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+