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

QGeoPath Class

The QGeoPath class defines a geographic path.

This class was introduced in Qt 5.9.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QGeoPath Class

  • Header: QGeoPath

  • Since: Qt 5.9

  • qmake: QT += positioning

  • Inherits: QGeoShape

  • Group: QGeoPath is part of QtPositioning-positioning

Detailed Description

The path is defined by an ordered list of QGeoCoordinates.

Each two adjacent elements in the path 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 dateline 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.

A QGeoPath is both invalid and empty if it contains no coordinate.

A default constructed QGeoPath is both invalid and empty as it does not contain any coordinates.

Property Documentation

 

path : const QVariantList

This property holds the list of coordinates for the geo path.

The coordinates cannot be processed in place. To change the value of this property, retrieve the complete list of coordinates, process them, and assign the new value to the property.

width : qreal

This property holds the width of the path in meters.

Access functions:

  • width() const

  • void setWidth(const &width)

Member Function Documentation

 

QGeoPath::QGeoPath()

Constructs a new, empty geo path.

QGeoPath::QGeoPath(const QList<QGeoCoordinate> &path, const qreal &width = 0.0)

Constructs a new geo path from a list of coordinates (path and width).

QGeoPath::QGeoPath(const QGeoShape &other)

Constructs a new geo path from the contents of other.

QGeoPath::QGeoPath(const QGeoPath &other)

Constructs a new geo path from the contents of other.

QGeoPath::~QGeoPath()

Destroys this path.

void QGeoPath::addCoordinate(const QGeoCoordinate &coordinate)

Appends coordinate to the path.

[since 5.12] void QGeoPath::clearPath()

Clears the path.

This function was introduced in Qt 5.12.

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

Returns true if the path contains coordinate as one of the elements.

QGeoCoordinate QGeoPath::coordinateAt(int index) const

Returns the coordinate at index .

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

Inserts coordinate at the specified index.

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

Returns the length of the path, 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.

If indexTo is -1 (the default value), the length will be including the distance between last coordinate and the first (closed loop). To retrieve the length for the path, use 0 for indexFrom and QGeoPath::size() - 1 for indexTo.

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

Returns all the elements of the path.

See Also

See also setPath()

void QGeoPath::removeCoordinate(const QGeoCoordinate &coordinate)

Removes the last occurrence of coordinate from the path.

void QGeoPath::removeCoordinate(int index)

Removes element at position index from the path.

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

Replaces the path element at the specified index with coordinate.

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

Sets all the elements of the path.

See Also

See also path()

[since 5.10] int QGeoPath::size() const

Returns the number of elements in the path.

This function was introduced in Qt 5.10.

QString QGeoPath::toString() const

Returns the geo path properties as a string.

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

Translates this geo path by degreesLatitude northwards and degreesLongitude eastwards.

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

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

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

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

See Also

See also translate()

qreal QGeoPath::width() const

Returns the width of the path, in meters. This information is used in the contains method. The default value is 0.

Getter function for property width.

See Also

See also setWidth()

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

Returns whether this geo path is not equal to other.

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

Assigns other to this geo path and returns a reference to this geo path.

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

Returns whether this geo path is equal to other.

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