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

geoshape QML Value Type

A geoshape type represents an abstract geographic area.

This type was introduced in Qt 5.2.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

geoshape QML Value Type

  • Import Statement: import QtPositioning 6.4

  • Since:: Qt 5.2

  • Group: geoshape is part of qmlvaluetypes, qml-QtPositioning5-basictypes

Detailed Description

This type is a QML representation of QGeoShape which is an abstract geographic area. It includes attributes and methods common to all geographic areas. To create objects that represent a valid geographic area use georectangle or geocircle.

The isValid attribute can be used to test if the geoshape represents a valid geographic area.

The isEmpty attribute can be used to test if the geoshape represents a region with a geometrical area of 0.

The contains() method can be used to test if a coordinate is within the geoshape.

Example Usage

Use properties of type var to store a geoshape. To create a geoshape use one of the methods described below.

To create a geoshape value, specify it as a "shape()" string:

 
Sélectionnez
import QtPositioning

Item {
    property var region: "shape()"
}

or with the QtPositioning.shape() function:

 
Sélectionnez
import QtPositioning

Item {
    property var region: QtPositioning.shape()
}

When integrating with C++, note that any QGeoShape value passed into QML from C++ is automatically converted into a geoshape value, and vice-versa.

Properties

 
isEmpty
 
Sélectionnez
bool isEmpty

Returns whether this geoshape is empty. An empty geoshape is a region which has a geometrical area of 0.

isValid
 
Sélectionnez
bool isValid

Returns whether this geoshape is valid.

A geoshape is considered to be invalid if some of the data that is required to unambiguously describe the geoshape has not been set or has been set to an unsuitable value.

type
 
Sélectionnez
ShapeType type

Returns the current type of the shape.

  • GeoShape.UnknownType - The shape's type is not known.

  • GeoShape.RectangleType - The shape is a georectangle.

  • GeoShape.CircleType - The shape is a geocircle.

  • GeoShape.PathType - The shape is a geopath. (Since Qt 5.9)

  • GeoShape.PolygonType - The shape is a geopolygon. (Since Qt 5.10)

This QML property was introduced by Qt 5.5.

Methods

 
contains()
 
Sélectionnez
bool contains(coordinate coord)

Returns true if the coordinate specified by coord is within this geoshape; Otherwise returns false.

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