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  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

MapPolygon

The MapPolygon element displays a polygon on a Map More...

Inherits Item

This type was introduced in Qt Location 5.0.

Properties

Methods

Detailed Description

The MapPolygon element displays a polygon on a Map, specified in terms of an ordered list of Coordinate elements. For best appearance and results, polygons should be simple (not self-intersecting).

The Coordinate elements on the path can be changed after being added to the Polygon, and these changes will be reflected in the next frame on the display. Coordinates can also be added and removed at any time using the addCoordinate and removeCoordinate methods.

For drawing rectangles with "straight" edges (same latitude across one edge, same latitude across the other), the MapRectangle element 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 color, border.color and border.width properties.

Performance

MapPolygons have a rendering cost that is O(n) with respect to the number of vertices. This means that the per frame cost of having a Polygon on the Map grows in direct proportion to the number of points on the Polygon. There is an additional triangulation cost (approximately O(n log n)) which is currently paid with each frame, but in future may be paid only upon adding or removing points.

Like the other map objects, MapPolygon is normally drawn without a smooth appearance. Setting the opacity property will force the object to be blended, which decreases performance considerably depending on the hardware in use.

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.

 Map {
     MapPolygon {
         color: 'green'
         path: [
             Coordinate { latitude: -27; longitude: 153.0 },
             Coordinate { latitude: -27; longitude: 154.1 },
             Coordinate { latitude: -28; longitude: 153.5 }
         ]
     }
 }

Property Documentation

border.width : int

border.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.


color : color

This property holds the color used to fill the polygon.

The default value is transparent.


read-onlypath : list<Coordinate>

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

See also addCoordinate and removeCoordinate.


Method Documentation

MapPolygon::addCoordinate(Coordinate)

Adds a coordinate to the path.

See also removeCoordinate and path.


MapPolygon::removeCoordinate(Coordinate)

Removes a coordinate from the path. If there are multiple instances of the same coordinate, the one added last is removed.

See also addCoordinate and path.


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 5.0-snapshot
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