Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgeomaptype.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// Qt-Security score:significant reason:default
4
7
8QT_BEGIN_NAMESPACE
9
10QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoMapTypePrivate)
11
12/*!
13 \qmltype mapType
14 \inqmlmodule QtLocation
15 \ingroup qml-QtLocation5-maps
16 \since QtLocation 5.5
17
18 \brief The mapType type holds information about a map type.
19
20 This includes the map type's \l name and \l description, the \l style and
21 a flag to indicate if the map type is optimized for mobile devices (\l mobile).
22*/
23
24QGeoMapType::QGeoMapType()
25 : d_ptr(new QGeoMapTypePrivate()) {}
26
27QGeoMapType::QGeoMapType(const QGeoMapType &other) noexcept = default;
28
29QGeoMapType::QGeoMapType(QGeoMapType::MapStyle style, const QString &name,
30 const QString &description, bool mobile, bool night, int mapId,
31 const QByteArray &pluginName,
32 const QGeoCameraCapabilities &cameraCapabilities,
33 const QVariantMap &metadata)
34: d_ptr(new QGeoMapTypePrivate(style, name, description, mobile, night, mapId, pluginName, cameraCapabilities, metadata))
35{
36}
37
38QGeoMapType::~QGeoMapType() = default;
39
40QGeoMapType &QGeoMapType::operator=(const QGeoMapType &other) noexcept
41{
42 if (this == &other)
43 return *this;
44
45 d_ptr = other.d_ptr;
46 return *this;
47}
48
49bool QGeoMapType::isEqual(const QGeoMapType &other) const noexcept
50{
51 return (*d_ptr.constData() == *other.d_ptr.constData());
52}
53
54/*!
55 \qmlproperty enumeration mapType::style
56
57 This read-only property gives access to the style of the map type.
58
59 \list
60 \li MapType.NoMap - No map.
61 \li MapType.StreetMap - A street map.
62 \li MapType.SatelliteMapDay - A map with day-time satellite imagery.
63 \li MapType.SatelliteMapNight - A map with night-time satellite imagery.
64 \li MapType.TerrainMap - A terrain map.
65 \li MapType.HybridMap - A map with satellite imagery and street information.
66 \li MapType.GrayStreetMap - A gray-shaded street map.
67 \li MapType.PedestrianMap - A street map suitable for pedestriants.
68 \li MapType.CarNavigationMap - A street map suitable for car navigation.
69 \li MapType.CycleMap - A street map suitable for cyclists.
70 \li MapType.CustomMap - A custom map type.
71 \endlist
72*/
73
74QGeoMapType::MapStyle QGeoMapType::style() const
75{
76 return d_ptr->style_;
77}
78
79/*!
80 \qmlproperty string mapType::name
81
82 This read-only property holds the name of the map type as a single formatted string.
83*/
84
85QString QGeoMapType::name() const
86{
87 return d_ptr->name_;
88}
89
90/*!
91 \qmlproperty string mapType::description
92
93 This read-only property holds the description of the map type as a single formatted string.
94*/
95
96QString QGeoMapType::description() const
97{
98 return d_ptr->description_;
99}
100
101/*!
102 \qmlproperty bool mapType::mobile
103
104 \brief Whether the map type is optimized for the use on a mobile device.
105
106 Map types for mobile devices usually have higher constrast to counteract the
107 effects of sunlight and a reduced color for improved readability.
108*/
109bool QGeoMapType::mobile() const
110{
111 return d_ptr->mobile_;
112}
113
114/*!
115 \qmlproperty bool mapType::night
116 \since QtLocation 5.4
117
118 \brief Whether the map type is optimized for use at night.
119
120 Map types suitable for use at night usually have a dark background.
121*/
122bool QGeoMapType::night() const
123{
124 return d_ptr->night_;
125}
126
127int QGeoMapType::mapId() const
128{
129 return d_ptr->mapId_;
130}
131
132QByteArray QGeoMapType::pluginName() const
133{
134 return d_ptr->pluginName_;
135}
136
137/*!
138 \qmlproperty CameraCapabilities mapType::cameraCapabilities
139 \since QtLocation 5.10
140
141 This property holds the camera capabilities for this map type.
142*/
143
144QGeoCameraCapabilities QGeoMapType::cameraCapabilities() const
145{
146 return d_ptr->cameraCapabilities_;
147}
148
149/*!
150 \qmlproperty VariantMap mapType::metadata
151 \since QtLocation 5.10
152
153 This property holds optional, extra metadata related to a specific map type.
154 The content of this property is entirely plugin-specific.
155*/
156QVariantMap QGeoMapType::metadata() const
157{
158 return d_ptr->metadata_;
159}
160
162
163QGeoMapTypePrivate::QGeoMapTypePrivate(QGeoMapType::MapStyle style, const QString &name,
164 const QString &description, bool mobile, bool night,
165 int mapId, const QByteArray &pluginName,
166 const QGeoCameraCapabilities &cameraCapabilities,
167 const QVariantMap &metadata)
168: name_(name), description_(description), pluginName_(pluginName),
169 cameraCapabilities_(cameraCapabilities), metadata_(metadata),
170 style_(style), mapId_(mapId), mobile_(mobile), night_(night)
171{
172}
173
175{
176 return pluginName_ == other.pluginName_ && style_ == other.style_ && name_ == other.name_ &&
177 description_ == other.description_ && mobile_ == other.mobile_ && night_ == other.night_ &&
178 mapId_ == other.mapId_ && cameraCapabilities_ == other.cameraCapabilities_ &&
179 metadata_ == other.metadata_;
180}
181
182QT_END_NAMESPACE
183
184#include "moc_qgeomaptype_p.cpp"
bool operator==(const QGeoMapTypePrivate &other) const