このページでは

QGeoPath Class

QGeoPath クラスは、地理的な経路を定義します。詳細...

ヘッダー: #include <QGeoPath>
CMake: find_package(Qt6 REQUIRED COMPONENTS Positioning)
target_link_libraries(mytarget PRIVATE Qt6::Positioning)
qmake: QT += positioning
継承元: QGeoShape

プロパティ

公開関数

QGeoPath()
QGeoPath(const QGeoShape &other)
QGeoPath(const QList<QGeoCoordinate> &path, const qreal &width = 0.0)
QGeoPath(const QGeoPath &other)
~QGeoPath()
void addCoordinate(const QGeoCoordinate &coordinate)
void clearPath()
bool containsCoordinate(const QGeoCoordinate &coordinate) const
QGeoCoordinate coordinateAt(qsizetype index) const
void insertCoordinate(qsizetype index, const QGeoCoordinate &coordinate)
double length(qsizetype indexFrom = 0, qsizetype indexTo = -1) const
const QList<QGeoCoordinate> &path() const
void removeCoordinate(const QGeoCoordinate &coordinate)
void removeCoordinate(qsizetype index)
void replaceCoordinate(qsizetype index, const QGeoCoordinate &coordinate)
void setPath(const QList<QGeoCoordinate> &path)
void setWidth(const qreal &width)
qsizetype size() const
QString toString() const
void translate(double degreesLatitude, double degreesLongitude)
QGeoPath translated(double degreesLatitude, double degreesLongitude) const
qreal width() const
QGeoPath &operator=(const QGeoPath &other)

詳細な説明

パスは、QGeoCoordinate オブジェクトの順序付きリストによって定義されます。

パス内の隣接する 2 つの要素は、両方の要素を通る、方位角が一定で最短の線分によって連結されることを想定しています。この種の連結は、経線方向で日付変更線を横断することはありますが、極点を横断することは決してありません。

これは、この形状に対して `QGeoShape::boundingGeoRectangle()` が返すバウンディングボックスの計算に関連しており、そのバウンディングボックスの左上隅の緯度は、パスポイントセット内の最大緯度に設定されます。同様に、右下隅の緯度は、パスポイントセット内の最小緯度になります。

このクラスは、QML でも `geoPath` として利用可能です。

QGeoPathは、座標を一切含まない場合、無効かつ空となります。

注: デフォルトで生成された QGeoPathは 、座標を一切含まないため、無効かつ空となります。

プロパティのドキュメント

path : QVariantList

このプロパティには、ジオパスの座標のリストが格納されます。

注:座標はその 場で処理することはできません。このプロパティの値を変更するには、座標の完全なリストを取得し、それらを処理してから、新しい値をプロパティに割り当てる必要があります。

width : qreal

このプロパティには、パスの幅(メートル単位)が格納されます。

アクセス関数:

qreal width() const
void setWidth(const qreal &width)

メンバ関数のドキュメント

QGeoPath::QGeoPath()

新しい空のジオパスを作成します。

QGeoPath::QGeoPath(const QGeoShape &other)

other の内容から、新しいジオパスを作成します。

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

座標のリスト(path およびwidth )から、新しいジオパスを作成します。

QGeoPath::QGeoPath(const QGeoPath &other)

other の内容から、新しいジオパスを作成します。

[noexcept] QGeoPath::~QGeoPath()

このパスを削除します。

[invokable] void QGeoPath::addCoordinate(const QGeoCoordinate &coordinate)

パスに「coordinate 」を追加します。

注:この関数は 、メタオブジェクトシステムやQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

void QGeoPath::clearPath()

道を切り開く。

[invokable] bool QGeoPath::containsCoordinate(const QGeoCoordinate &coordinate) const

パスに「coordinate 」が含まれている場合、true を返します。

注:この関数は 、メタオブジェクトシステムを介して、またはQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] QGeoCoordinate QGeoPath::coordinateAt(qsizetype index) const

index における座標を返します。

注:この関数は 、メタオブジェクトシステムおよびQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QGeoPath::insertCoordinate(qsizetype index, const QGeoCoordinate &coordinate)

指定されたindex にcoordinate を挿入します。

注:この関数は 、メタオブジェクトシステムおよびQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] double QGeoPath::length(qsizetype indexFrom = 0, qsizetype indexTo = -1) const

要素 `indexFrom ` から要素 `indexTo` までの経路の長さをメートル単位で返します。この長さは、隣接する各点間の最短距離の合計となるよう設計されています。

indexTo が -1(デフォルト値)の場合、長さには最後の座標と最初の座標間の距離が含まれます(閉ループ)。パスの長さを取得するには、indexFrom に 0 を、indexTo にQGeoPath::size() - 1 を指定してください。

注:この関数は 、メタオブジェクトシステムおよびQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

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

パスのすべての要素を返します。

setPath()も参照してください 。

[invokable] void QGeoPath::removeCoordinate(const QGeoCoordinate &coordinate)

パスから「coordinate 」の最後の出現箇所を削除します。

注:この関数は 、メタオブジェクトシステムやQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QGeoPath::removeCoordinate(qsizetype index)

パス上の位置index にある要素を削除します。

注:この関数は 、メタオブジェクトシステムおよびQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QGeoPath::replaceCoordinate(qsizetype index, const QGeoCoordinate &coordinate)

指定されたindex にあるpath要素を、coordinate に置き換えます。

注:この関数は 、メタオブジェクトシステムおよびQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

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

path のすべての要素を設定します。

path()も参照してください 。

[invokable] qsizetype QGeoPath::size() const

パスに含まれる要素の数を返します。

注:この関数は 、メタオブジェクトシステムおよびQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] QString QGeoPath::toString() const

geoパスプロパティを文字列として返します。

注:この関数は 、メタオブジェクトシステムやQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] void QGeoPath::translate(double degreesLatitude, double degreesLongitude)

このジオパスを、degreesLatitude 分北へ、degreesLongitude 分東へ移動させます。

degreesLatitude およびdegreesLongitude の負の値は、それぞれ南方向および西方向への移動に対応します。

注:この関数は 、メタオブジェクトシステムおよびQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

[invokable] QGeoPath QGeoPath::translated(double degreesLatitude, double degreesLongitude) const

degreesLatitude によって北方向へ、degreesLongitude によって東方向へ変換された、このジオパスのコピーを返します。

degreesLatitude およびdegreesLongitude の負の値は、それぞれ南方向および西方向への移動に対応します。

注:この関数は 、メタオブジェクトシステムを介して、およびQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

translate()も参照してください 。

qreal QGeoPath::width() const

パスの幅をメートル単位で返します。この情報は、contains メソッドで使用されます。デフォルト値は 0 です。

注: プロパティ `width`のゲッター 関数です。

関連項目: setWidth()。

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

このジオパスにother を割り当て、このジオパスへの参照を返します。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.