Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QML MapPolyline Element

The MapPolyline element displays a polyline on a map. More...

  • List of all members, including inherited members
  • Properties

    Methods

    Detailed Description

    The polyline is specified in terms of an ordered list of coordinates. Any invalid coordinates in the list will be ignored.

    If the list contains less than 2 valid coordinates the polyline will not be displayed.

    Simplistic example to illustrate, this element could be defined in Map body:

     MapPolyline {
         id: polyline
         border {color: "red"; width: 4}
         Coordinate {
             id: polylineTopLeftCoordinate
             latitude: -28.35
             longitude: 153.4
         }
         Coordinate {
             id: polylineRightCoordinate
             latitude: -28.34
             longitude: 153.45
         }
         Coordinate {
             id: polylineBottomLeftCoordinate
             latitude: -28.33
             longitude: 153.4
         }
         onPathChanged: {
             console.log('Polyline pathChanged signal received')
         }
     }

    The MapPolyline element is part of the QtMobility.location 1.2 module.

    Property Documentation

    read-onlyborder.width : int

    read-onlyborder.color : color

    These properties hold the width and color used to draw the border of the circle.

    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.

    This documentation was introduced in Qt Mobility Mobility 1.2.


    read-onlydefaultpath : list<Coordinate>

    This property holds the ordered list of coordinates which define the polyline.

    This documentation was introduced in Qt Mobility Mobility 1.2.


    read-onlyvisible : bool

    This property holds a boolean corresponding to whether or not the polyline is visible.

    This documentation was introduced in Qt Mobility Mobility 1.2.


    read-onlyz : int

    This property holds the z-value of the polyline.

    Map objects are drawn in z-value order, and objects with the same z-value will be drawn in insertion order.

    This documentation was introduced in Qt Mobility Mobility 1.2.


    Method Documentation

    MapPolyline::addCoordinate ( Coordinate )

    Adds coordinate to the path. The resulting path is derived from values at the time of assignment, meaning that later changes in values are not reflected in the path.

    A basic example is to draw the path where one has been:

     PositionSource {
         id: myPositionSource
         active: true
         nmeaSource: "nmealog.txt"
         updateInterval: 2000
         onPositionChanged: {
             console.log("Position changed in PositionSource")
             myPathPolyline.addCoordinate(position.coordinate)
         }
     }

    This documentation was introduced in Qt Mobility Mobility 1.2.

    See also removeCoordinate.


    MapPolyline::removeCoordinate ( Coordinate )

    Remove coordinate from the path. If there are multiple instances of the same coordinate, the one added last is removed. Removed Coordinate is not deleted.

     onButton2Clicked: {
         polyline.removeCoordinate(map.center)
     }

    If more finetuned control is needed, one can also iterate and/or use the inherent index property of the path list.

     onButton1Clicked: {
         for (var index = 0; index < polyline.path.length; index++)  {
             console.log("Index, latitude:" + index + " , " + polyline.path[index].latitude);
         }
         polyline.removeCoordinate(polyline.path[2])
     }

    This documentation was introduced in Qt Mobility Mobility 1.2.

    See also addCoordinate.


    Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtmobility-1.2
    Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
    Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
     
     
     
     
    Partenaires

    Hébergement Web