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