QGeoCoordinate Class
QGeoCoordinate 클래스는 지구 표면의 지리적 위치를 정의합니다. 더 보기...
Header: | #include <QGeoCoordinate> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Positioning) target_link_libraries(mytarget PRIVATE Qt6::Positioning) |
qmake: | QT += positioning |
공용 유형
enum | CoordinateFormat { Degrees, DegreesWithHemisphere, DegreesMinutes, DegreesMinutesWithHemisphere, DegreesMinutesSeconds, DegreesMinutesSecondsWithHemisphere } |
enum | CoordinateType { InvalidCoordinate, Coordinate2D, Coordinate3D } |
속성
공공 기능
QGeoCoordinate() | |
QGeoCoordinate(double latitude, double longitude) | |
QGeoCoordinate(double latitude, double longitude, double altitude) | |
QGeoCoordinate(const QGeoCoordinate &other) | |
(since 6.2) | QGeoCoordinate(QGeoCoordinate &&other) |
~QGeoCoordinate() | |
double | altitude() const |
QGeoCoordinate | atDistanceAndAzimuth(qreal distance, qreal azimuth, qreal distanceUp = 0.0) const |
qreal | azimuthTo(const QGeoCoordinate &other) const |
qreal | distanceTo(const QGeoCoordinate &other) const |
bool | isValid() const |
double | latitude() const |
double | longitude() const |
void | setAltitude(double altitude) |
void | setLatitude(double latitude) |
void | setLongitude(double longitude) |
(since 6.2) void | swap(QGeoCoordinate &other) |
QString | toString(QGeoCoordinate::CoordinateFormat format = DegreesMinutesSecondsWithHemisphere) const |
QGeoCoordinate::CoordinateType | type() const |
(since 6.2) QGeoCoordinate & | operator=(QGeoCoordinate &&other) |
QGeoCoordinate & | operator=(const QGeoCoordinate &other) |
관련 비회원
bool | operator!=(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs) |
QDataStream & | operator<<(QDataStream &stream, const QGeoCoordinate &coordinate) |
bool | operator==(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs) |
QDataStream & | operator>>(QDataStream &stream, QGeoCoordinate &coordinate) |
상세 설명
위도, 경도 및 선택적으로 고도로 정의된 좌표입니다.
type()를 사용하여 좌표가 2D 좌표(위도와 경도만 포함)인지 3D 좌표(위도, 경도 및 고도 포함)인지 확인합니다. distanceTo () 및 azimuthTo()을 사용하여 좌표 사이의 거리와 방위를 계산합니다.
좌표 값은 WGS84 데이텀을 사용하여 지정해야 합니다. 지리적 용어에 대한 자세한 내용은 좌표에 대한 이 문서와 WGS84를 포함한 측지계에 대한 다른 문서를 참조하세요.
이 맥락에서 방위각은 진북을 기준으로 한 나침반 방위와 같습니다.
이 클래스는 Qt 5.5부터 Q_GADGET. C++와 QML에서 직접 사용할 수 있습니다.
멤버 유형 문서
enum QGeoCoordinate::CoordinateFormat
toString()에 사용할 수 있는 서식 옵션을 정의합니다.
Constant | 값 | 설명 |
---|---|---|
QGeoCoordinate::Degrees | 0 | 좌표의 문자열 표현을 십진수 도 형식으로 반환합니다. |
QGeoCoordinate::DegreesWithHemisphere | 1 | 좌표의 반구를 나타내는 'N', 'S', 'E' 또는 'W'를 사용하여 십진수 도 형식으로 좌표의 문자열 표현을 반환합니다. |
QGeoCoordinate::DegreesMinutes | 2 | 좌표의 문자열 표현을 도-분 형식으로 반환합니다. |
QGeoCoordinate::DegreesMinutesWithHemisphere | 3 | 좌표의 반구를 나타내는 'N', 'S', 'E' 또는 'W'를 사용하여 도-분 형식으로 좌표의 문자열 표현을 반환합니다. |
QGeoCoordinate::DegreesMinutesSeconds | 4 | 좌표의 문자열 표현을 도-분-초 형식으로 반환합니다. |
QGeoCoordinate::DegreesMinutesSecondsWithHemisphere | 5 | 좌표의 반구를 나타내는 'N', 'S', 'E' 또는 'W'를 사용하여 도-분-초 형식의 좌표 문자열 표현을 반환합니다. |
toString()도 참조하세요 .
enum QGeoCoordinate::CoordinateType
좌표의 유형을 정의합니다.
상수 | 값 | 설명 |
---|---|---|
QGeoCoordinate::InvalidCoordinate | 0 | 유효하지 않은 좌표입니다. 좌표의 위도 또는 경도 값이 유효하지 않은 경우 좌표가 유효하지 않습니다. |
QGeoCoordinate::Coordinate2D | 1 | 위도 및 경도 값이 유효한 좌표입니다. |
QGeoCoordinate::Coordinate3D | 2 | 위도 및 경도 값이 유효하고 고도 값도 포함된 좌표입니다. |
속성 문서
altitude : double
이 속성은 해발 미터 단위의 고도를 보유합니다.
고도가 설정되지 않은 경우 이 프로퍼티는 정의되지 않습니다(qQNaN()).
이 프로퍼티는 Qt 5.5에 도입되었지만, 관련 접근자 함수는 이 클래스의 첫 번째 버전부터 존재했습니다.
액세스 함수:
double | altitude() const |
void | setAltitude(double altitude) |
[read-only]
isValid : const bool
이 속성은 이 지리적 좌표의 유효성을 유지합니다.
longitude 및 latitude 속성이 유효한 값으로 설정된 경우 지리적 좌표가 유효합니다.
이 프로퍼티는 Qt 5.5에 도입되었지만, 관련 접근자 함수는 이 클래스의 첫 번째 버전부터 존재했습니다.
액세스 함수:
bool | isValid() const |
latitude : double
이 속성은 위도를 소수점 단위로 저장합니다.
위도가 설정되지 않은 경우 속성은 정의되지 않음(qQNaN())입니다. 양수 위도는 북반구를 나타내고 음수 위도는 남반구를 나타냅니다. 위도를 설정할 때 새 값은 WGS84 데이텀 형식이어야 합니다.
위도가 유효하려면 위도가 -90에서 90 사이여야 합니다.
이 프로퍼티는 Qt 5.5에 도입되었지만 관련 접근자 함수는 이 클래스의 첫 번째 버전부터 존재했습니다.
액세스 함수:
double | latitude() const |
void | setLatitude(double latitude) |
longitude : double
이 속성은 경도를 소수점으로 저장합니다.
경도가 설정되지 않은 경우 이 속성은 정의되지 않습니다(qQNaN()). 양수 경도는 동반구를 나타내고 음수 경도는 서반구를 나타냅니다. 경도를 설정할 때 새 값은 WGS84 데이텀 형식이어야 합니다.
경도가 유효하려면 경도는 -180에서 180 사이여야 합니다.
이 프로퍼티는 Qt 5.5에 도입되었지만, 관련 접근자 함수는 이 클래스의 첫 번째 버전부터 존재했습니다.
액세스 함수:
double | longitude() const |
void | setLongitude(double longitude) |
멤버 함수 문서
QGeoCoordinate::QGeoCoordinate()
좌표를 생성합니다. 좌표는 setLatitude() 및 setLongitude()이 호출될 때까지 유효하지 않습니다.
QGeoCoordinate::QGeoCoordinate(double latitude, double longitude)
주어진 latitude 와 longitude 로 좌표를 구축합니다.
위도가 -90에서 90 사이가 아니거나 경도가 -180에서 180 사이가 아닌 경우 아무 값도 설정되지 않으며 type()는 QGeoCoordinate::InvalidCoordinate 이 됩니다.
isValid()도 참조하세요 .
QGeoCoordinate::QGeoCoordinate(double latitude, double longitude, double altitude)
주어진 latitude, longitude 및 altitude 로 좌표를 생성합니다.
위도가 -90에서 90 사이가 아니거나 경도가 -180에서 180 사이가 아닌 경우 아무 값도 설정되지 않으며 type()는 QGeoCoordinate::InvalidCoordinate 이 됩니다.
altitude 은 해발 미터를 지정합니다.
isValid()도 참조하세요 .
QGeoCoordinate::QGeoCoordinate(const QGeoCoordinate &other)
other 의 콘텐츠로부터 좌표를 생성합니다.
[noexcept, since 6.2]
QGeoCoordinate::QGeoCoordinate(QGeoCoordinate &&other)
other 에서 이동하여 좌표를 생성합니다.
참고: QGeoCoordinate에서 이동한 객체는 소멸하거나 할당할 수만 있습니다. 소멸자나 할당 연산자 중 하나가 아닌 다른 함수를 호출하는 효과는 정의되지 않았습니다.
이 함수는 Qt 6.2에 도입되었습니다.
[noexcept]
QGeoCoordinate::~QGeoCoordinate()
좌표 개체를 파괴합니다.
double QGeoCoordinate::altitude() const
고도(해발 미터)를 반환합니다.
고도가 설정되지 않은 경우 반환 값은 정의되지 않습니다.
참고: 속성 고도에 대한 게터 함수입니다.
setAltitude() 및 type()도 참조하세요 .
[invokable]
QGeoCoordinate QGeoCoordinate::atDistanceAndAzimuth(qreal distance, qreal azimuth, qreal distanceUp = 0.0) const
현재 좌표 azimuth (또는 방위)에서 큰 원을 따라 distance 미터를 이동하여 도달한 좌표를 반환합니다. 이 계산을 위해 지구가 구형이라는 가정이 있습니다.
고도에는 distanceUp 가 추가됩니다.
이 좌표가 유효하지 않은 경우 유효하지 않은 좌표를 반환합니다.
참고: 이 함수는 메타 객체 시스템과 QML을 통해 호출할 수 있습니다. Q_INVOKABLE 을 참조하세요.
[invokable]
qreal QGeoCoordinate::azimuthTo(const QGeoCoordinate &other) const
이 좌표에서 other 에 지정된 좌표까지의 방위각(또는 방위)을 도 단위로 반환합니다. 고도는 계산에 사용되지 않습니다.
반환되는 방위각은 두 좌표 사이의 큰 원을 따라 원점에서 other 까지의 방위각입니다. 이 계산의 목적상 지구는 구형이라는 가정이 있습니다.
이 좌표의 유형 또는 other 의 유형이 QGeoCoordinate::InvalidCoordinate 인 경우 0을 반환합니다.
참고: 이 함수는 메타 객체 시스템과 QML을 통해 호출할 수 있습니다. Q_INVOKABLE 을 참조하세요.
[invokable]
qreal QGeoCoordinate::distanceTo(const QGeoCoordinate &other) const
이 좌표에서 other 에 지정된 좌표까지의 거리(미터)를 반환합니다. 고도는 계산에 사용되지 않습니다.
이 계산에서는 지구가 구형이라는 가정 하에 두 좌표 사이의 큰 원 거리를 반환합니다.
이 좌표의 유형 또는 other 의 유형이 QGeoCoordinate::InvalidCoordinate 인 경우 0을 반환합니다.
참고: 이 함수는 메타 객체 시스템과 QML을 통해 호출할 수 있습니다. Q_INVOKABLE 을 참조하세요.
bool QGeoCoordinate::isValid() const
longitude 및 latitude 가 유효하면 true
를 반환합니다.
참고: 프로퍼티 isValid에 대한 게터 함수.
double QGeoCoordinate::latitude() const
위도를 소수점 단위로 반환합니다. 위도가 설정되지 않은 경우 반환 값은 정의되지 않습니다.
양수 위도는 북반구를 나타내고 음수 위도는 남반구를 나타냅니다.
참고: 속성 위도에 대한 겟터 함수입니다.
setLatitude() 및 type()도 참조하세요 .
double QGeoCoordinate::longitude() const
경도를 십진수로 반환합니다. 경도가 설정되지 않은 경우 반환 값은 정의되지 않습니다.
경도가 양수이면 동반구를 나타내고 경도가 음수이면 서반구를 나타냅니다.
참고: 속성 경도에 대한 게터 함수입니다.
setLongitude() 및 type()도 참조하세요 .
void QGeoCoordinate::setAltitude(double altitude)
고도(해발 미터)를 altitude 로 설정합니다.
참고: 속성에 대한 설정자 함수 altitude.
altitude()도 참조하세요 .
void QGeoCoordinate::setLatitude(double latitude)
위도(소수점 단위)를 latitude 로 설정합니다. 이 값은 WGS84 데이텀을 사용해야 합니다.
위도가 유효하려면 위도가 -90에서 90 사이여야 합니다.
참고: 속성에 대한 설정자 함수 latitude.
latitude()도 참조하세요 .
void QGeoCoordinate::setLongitude(double longitude)
경도를 longitude 으로 설정합니다. 이 값은 WGS84 데이텀을 사용해야 합니다.
경도가 유효하려면 경도는 -180에서 180 사이여야 합니다.
참고: 속성에 대한 설정자 함수 longitude.
longitude()도 참조하세요 .
[noexcept, since 6.2]
void QGeoCoordinate::swap(QGeoCoordinate &other)
이 좌표를 other 로 바꿉니다. 이 작업은 매우 빠르며 실패하지 않습니다.
이 함수는 Qt 6.2에 도입되었습니다.
[invokable]
QString QGeoCoordinate::toString(QGeoCoordinate::CoordinateFormat format = DegreesMinutesSecondsWithHemisphere) const
이 좌표를 지정된 format 의 문자열로 반환합니다.
예를 들어 이 좌표의 위도가 -27.46758, 경도가 153.027892, 고도가 28.1인 경우 format 에 따라 반환되는 문자열은 다음과 같습니다:
format 값 | 반환된 문자열 |
---|---|
Degrees | -27.46758°, 153.02789°, 28.1m |
DegreesWithHemisphere | 27.46758° S, 153.02789° E, 28.1m |
DegreesMinutes | -27° 28.054', 153° 1.673', 28.1m |
DegreesMinutesWithHemisphere | 27° 28.054', 153° 1.673' E, 28.1m |
DegreesMinutesSeconds | -27° 28' 3.2", 153° 1' 40.4", 28.1m |
DegreesMinutesSecondsWithHemisphere | 27° 28' 3.2" S, 153° 1' 40.4" E, 28.1m |
고도가 설정되지 않은 경우 고도 필드는 생략됩니다.
좌표가 유효하지 않은 경우 빈 문자열이 반환됩니다.
참고: 이 함수는 메타 객체 시스템과 QML을 통해 호출할 수 있습니다. Q_INVOKABLE 을 참조하세요.
QGeoCoordinate::CoordinateType QGeoCoordinate::type() const
이 좌표의 유형을 반환합니다.
[noexcept, since 6.2]
QGeoCoordinate &QGeoCoordinate::operator=(QGeoCoordinate &&other)
Move-이 좌표에 other 을 할당하고 이 좌표에 대한 참조를 반환합니다.
참고: QGeoCoordinate 에서 이동한 객체는 소멸하거나 할당할 수만 있습니다. 소멸자나 할당 연산자 중 하나가 아닌 다른 함수를 호출하는 효과는 정의되지 않았습니다.
이 함수는 Qt 6.2에 도입되었습니다.
QGeoCoordinate &QGeoCoordinate::operator=(const QGeoCoordinate &other)
이 좌표에 other 을 할당하고 이 좌표에 대한 참조를 반환합니다.
관련 비회원
bool operator!=(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs)
lhs 좌표의 위도, 경도 또는 고도가 rhs 좌표의 위도, 경도 또는 고도와 같지 않으면 true
을 반환합니다. 그렇지 않으면 false
을 반환합니다.
QDataStream &operator<<(QDataStream &stream, const QGeoCoordinate &coordinate)
주어진 coordinate 을 지정된 stream 에 씁니다.
Qt 데이터 형 직렬화도참조하십시오 .
bool operator==(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs)
lhs 좌표의 위도, 경도, 고도가 rhs 좌표의 위도, 경도, 고도와 같으면 true
을 반환합니다. 그렇지 않으면 false
을 반환합니다.
위도가 +/- 90도인 경우 경도는 무시됩니다.
QDataStream &operator>>(QDataStream &stream, QGeoCoordinate &coordinate)
지정된 stream 에서 주어진 coordinate 으로 좌표를 읽습니다.
Qt 데이터형 직렬화도참조하십시오 .
© 2025 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.