Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgeocameradata.cpp
Go to the documentation of this file.
1// Copyright (C) 2015 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qgeocameradata_p.h"
5
6#include <QtCore/QVariant>
7#include <QtCore/QVariantAnimation>
8
9#include <QtPositioning/private/qgeocoordinate_p.h>
10#include <QtPositioning/private/qwebmercator_p.h>
11
13
15{
16public:
17 bool operator==(const QGeoCameraDataPrivate &rhs) const noexcept;
18
20 double m_bearing = 0.0;
21 double m_tilt = 0.0;
22 double m_roll = 0.0;
23 double m_fieldOfView = 45.0;
24 double m_zoomLevel = 0.0;
25};
26
28
29bool QGeoCameraDataPrivate::operator==(const QGeoCameraDataPrivate &rhs) const noexcept
30{
31 return ((m_center == rhs.m_center)
32 && (m_bearing == rhs.m_bearing)
33 && (m_tilt == rhs.m_tilt)
34 && (m_roll == rhs.m_roll)
35 && (m_fieldOfView == rhs.m_fieldOfView)
36 && (m_zoomLevel == rhs.m_zoomLevel));
37}
38
40 const QGeoCameraData &end,
41 qreal progress)
42{
44 QGeoCoordinate from = start.center();
45 QGeoCoordinate to = end.center();
46
47 if (from == to) {
48 if (progress < 0.5) {
49 result.setCenter(from);
50 } else {
51 result.setCenter(to);
52 }
53 }
54 else {
55 QGeoCoordinate coordinateResult = QWebMercator::coordinateInterpolation(from, to, progress);
56 result.setCenter(coordinateResult);
57 }
58
59 double sf = 1.0 - progress;
60 double ef = progress;
61
62 result.setBearing(sf * start.bearing() + ef * end.bearing());
63 result.setTilt(sf * start.tilt() + ef * end.tilt());
64 result.setRoll(sf * start.roll() + ef * end.roll());
65 result.setFieldOfView(sf * start.fieldOfView() + ef * end.fieldOfView());
66 result.setZoomLevel(sf * start.zoomLevel() + ef * end.zoomLevel());
67
69}
70
73{
74 qRegisterMetaType<QGeoCameraData>();
75 qRegisterAnimationInterpolator<QGeoCameraData>(cameraInterpolator);
76}
77
78QGeoCameraData::QGeoCameraData(const QGeoCameraData &other) noexcept = default;
79
81
83{
84 if (this == &other)
85 return *this;
86
87 d = other.d;
88 return *this;
89}
90
91bool QGeoCameraData::isEqual(const QGeoCameraData &other) const
92{
93 return (*(d.constData()) == *(other.d.constData()));
94}
95
97{
98 d->m_center = center;
99}
100
102{
103 return d->m_center;
104}
105
106void QGeoCameraData::setBearing(double bearing)
107{
108 d->m_bearing = bearing;
109}
110
112{
113 return d->m_bearing;
114}
115
116void QGeoCameraData::setTilt(double tilt)
117{
118 d->m_tilt = tilt;
119}
120
122{
123 return d->m_tilt;
124}
125
126void QGeoCameraData::setRoll(double roll)
127{
128 d->m_roll = roll;
129}
130
132{
133 return d->m_roll;
134}
135
136void QGeoCameraData::setFieldOfView(double fieldOfView)
137{
139}
140
142{
143 return d->m_fieldOfView;
144}
145
146void QGeoCameraData::setZoomLevel(double zoomFactor)
147{
148 d->m_zoomLevel = zoomFactor;
149}
150
152{
153 return d->m_zoomLevel;
154}
155
bool operator==(const QGeoCameraDataPrivate &rhs) const noexcept
double zoomLevel() const
void setTilt(double tilt)
double tilt() const
void setZoomLevel(double zoomLevel)
void setCenter(const QGeoCoordinate &coordinate)
void setBearing(double bearing)
double roll() const
double fieldOfView() const
double bearing() const
QGeoCoordinate center() const
void setFieldOfView(double fieldOfView)
QGeoCameraData & operator=(const QGeoCameraData &other) noexcept
void setRoll(double roll)
\inmodule QtPositioning
const T * constData() const noexcept
Returns a const pointer to the shared data object.
Definition qshareddata.h:51
\inmodule QtCore
Definition qshareddata.h:19
\inmodule QtCore
Definition qvariant.h:65
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:536
static QGeoCoordinate coordinateInterpolation(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
Combined button and popup list for selecting options.
QVariant cameraInterpolator(const QGeoCameraData &start, const QGeoCameraData &end, qreal progress)
GLuint GLuint end
GLuint start
GLuint64EXT * result
[6]
#define QT_DEFINE_QSDP_SPECIALIZATION_DTOR(Class)
double qreal
Definition qtypes.h:187
QSharedPointer< T > other(t)
[5]