geoShape QML Value Type

A geoShape type represents an abstract geographic area. 更多...

import 语句: import QtPositioning

特性

方法

详细描述

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 shape represents a valid geographic area.

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

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

用法范例

To create a geoShape value, use the QtPositioning.shape () 函数:

import QtPositioning
Item {
    property geoShape region: QtPositioning.shape()
}
					

集成 C++ 时,注意任何 QGeoShape value passed into QML from C++ is automatically converted into a geoShape value, and vice-versa.

特性文档编制

isEmpty : bool

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

isValid : bool

Returns whether this shape is valid.

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

type : ShapeType

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.

方法文档编制

bool contains ( geoCoordinate coord )

返回 true 若 coordinate 指定通过 coord is within this shape; otherwise returns false.