QGeoPolygon Class

The QGeoPolygon class defines a geographic polygon. 更多...

头: #include <QGeoPolygon>
qmake: QT += positioning
Since: Qt 5.10
继承: QGeoShape

特性

公共函数

QGeoPolygon ()
QGeoPolygon (const QList<QGeoCoordinate> & path )
QGeoPolygon (const QGeoPolygon & other )
QGeoPolygon (const QGeoShape & other )
~QGeoPolygon ()
void addCoordinate (const QGeoCoordinate & coordinate )
void addHole (const QVariant & holePath )
void addHole (const QList<QGeoCoordinate> & holePath )
bool containsCoordinate (const QGeoCoordinate & coordinate ) const
QGeoCoordinate coordinateAt (int index ) const
const QVariantList hole (int index ) const
const QList<QGeoCoordinate> holePath (int index ) const
int holesCount () const
void insertCoordinate (int index , const QGeoCoordinate & coordinate )
double length (int indexFrom = 0, int indexTo = -1) const
const QList<QGeoCoordinate> & path () const
void removeCoordinate (const QGeoCoordinate & coordinate )
void removeCoordinate (int index )
void removeHole (int index )
void replaceCoordinate (int index , const QGeoCoordinate & coordinate )
void setPath (const QList<QGeoCoordinate> & path )
int size () const
QString toString () const
void translate (double degreesLatitude , double degreesLongitude )
QGeoPolygon translated (double degreesLatitude , double degreesLongitude ) const
bool operator!= (const QGeoPolygon & other ) const
QGeoPolygon & operator= (const QGeoPolygon & other )
bool operator== (const QGeoPolygon & other ) const

静态公共成员

const QMetaObject staticMetaObject

保护函数

QVariantList perimeter () const
void setPerimeter (const QVariantList & path )

详细描述

The QGeoPolygon class defines a geographic polygon.

The polygon is defined by an ordered list of QGeoCoordinates representing its perimeter.

Each two adjacent elements in this list are intended to be connected together by the shortest line segment of constant bearing passing through both elements. This type of connection can cross the date line in the longitudinal direction, but never crosses the poles.

This is relevant for the calculation of the bounding box returned by QGeoShape::boundingGeoRectangle () for this shape, which will have the latitude of the top left corner set to the maximum latitude in the path point set. Similarly, the latitude of the bottom right corner will be the minimum latitude in the path point set.

This class is a Q_GADGET . It can be directly used from C++ and QML .

特性文档编制

perimeter : const QVariantList

成员函数文档编制

QGeoPolygon:: QGeoPolygon ()

Constructs a new, empty geo polygon.

QGeoPolygon:: QGeoPolygon (const QList < QGeoCoordinate > & path )

Constructs a new geo polygon from a list of coordinates.

QGeoPolygon:: QGeoPolygon (const QGeoPolygon & other )

Constructs a new geo polygon from the contents of other .

QGeoPolygon:: QGeoPolygon (const QGeoShape & other )

Constructs a new geo polygon from the contents of other .

QGeoPolygon:: ~QGeoPolygon ()

Destroys this polygon.

void QGeoPolygon:: addCoordinate (const QGeoCoordinate & coordinate )

追加 coordinate to the polygon.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

void QGeoPolygon:: addHole (const QVariant & holePath )

设置 path for a hole inside the polygon. The hole is a QVariant 包含 QList < QGeoCoordinate >.

该函数在 Qt 5.12 引入。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

void QGeoPolygon:: addHole (const QList < QGeoCoordinate > & holePath )

Overloaded method. Sets the path for a hole inside the polygon. The hole is a QList < QGeoCoordinate >.

该函数在 Qt 5.12 引入。

bool QGeoPolygon:: containsCoordinate (const QGeoCoordinate & coordinate ) const

Returns true if the polygon's perimeter contains coordinate as one of the elements.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

QGeoCoordinate QGeoPolygon:: coordinateAt ( int index ) const

Returns the coordinate at index .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

const QVariantList QGeoPolygon:: hole ( int index ) const

返回 QVariant 包含 QVariant 包含 QList < QGeoCoordinate > which represents the hole at index.

该函数在 Qt 5.12 引入。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

const QList < QGeoCoordinate > QGeoPolygon:: holePath ( int index ) const

返回 QList < QGeoCoordinate > which represents the hole at index .

该函数在 Qt 5.12 引入。

int QGeoPolygon:: holesCount () const

Returns the number of holes.

该函数在 Qt 5.12 引入。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

void QGeoPolygon:: insertCoordinate ( int index , const QGeoCoordinate & coordinate )

插入 coordinate at the specified index .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

double QGeoPolygon:: length ( int indexFrom = 0, int indexTo = -1) const

Returns the length of the polygon's perimeter, in meters, from the element indexFrom to the element indexTo . The length is intended to be the sum of the shortest distances for each pair of adjacent points.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

const QList < QGeoCoordinate > &QGeoPolygon:: path () const

Returns all the elements of the polygon's boundary.

另请参阅 setPath ().

[protected] QVariantList QGeoPolygon:: perimeter () const

Returns all the elements of the polygon's perimeter.

This function was introduced in QtPositioning 5.12.

另请参阅 setPerimeter ().

void QGeoPolygon:: removeCoordinate (const QGeoCoordinate & coordinate )

Removes the last occurrence of coordinate from the polygon.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

void QGeoPolygon:: removeCoordinate ( int index )

Removes element at position index from the polygon.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

void QGeoPolygon:: removeHole ( int index )

Removes element at position index from the holes QList .

该函数在 Qt 5.12 引入。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

void QGeoPolygon:: replaceCoordinate ( int index , const QGeoCoordinate & coordinate )

Replaces the path element at the specified index with coordinate .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

void QGeoPolygon:: setPath (const QList < QGeoCoordinate > & path )

设置 polygon 's boundary from a list of coordinates.

另请参阅 path ().

[protected] void QGeoPolygon:: setPerimeter (const QVariantList & path )

Sets all the elements of the polygon's perimeter.

This function was introduced in QtPositioning 5.12.

另请参阅 perimeter ().

int QGeoPolygon:: size () const

Returns the number of elements in the polygon.

该函数在 Qt 5.10 引入。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

QString QGeoPolygon:: toString () const

Returns the geo polygon properties as a string.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

void QGeoPolygon:: translate ( double degreesLatitude , double degreesLongitude )

Translates this geo polygon by degreesLatitude northwards and degreesLongitude eastwards.

Negative values of degreesLatitude and degreesLongitude correspond to southward and westward translation respectively.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

QGeoPolygon QGeoPolygon:: translated ( double degreesLatitude , double degreesLongitude ) const

Returns a copy of this geo polygon translated by degreesLatitude northwards and degreesLongitude eastwards.

Negative values of degreesLatitude and degreesLongitude correspond to southward and westward translation respectively.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 translate ().

bool QGeoPolygon:: operator!= (const QGeoPolygon & other ) const

Returns whether this geo polygon is not equal to other .

QGeoPolygon &QGeoPolygon:: operator= (const QGeoPolygon & other )

赋值 other to this geo polygon and returns a reference to this geo polygon.

bool QGeoPolygon:: operator== (const QGeoPolygon & other ) const

Returns whether this geo polygon is equal to other .