Kgapi

staticmapmarker.h
1/*
2 SPDX-FileCopyrightText: 2012 Jan Grulich <grulja@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#pragma once
8
9#include "kgapimaps_export.h"
10
11#include <QColor>
12
13#include <KContacts/Address>
14#include <KContacts/Geo>
15
16namespace KGAPI2
17{
18
19/**
20 * @brief Represents marker with defined label, color, size and markers
21 *
22 * @author: Jan Grulich <grulja@gmail.com>
23 * @since: 0.4
24 */
25class KGAPIMAPS_EXPORT StaticMapMarker
26{
27public:
28 enum MarkerSize { Tiny, Small, Middle, Normal };
29
30 enum LocationType { Undefined = -1, String, KABCAddress, KABCGeo };
31
32 /**
33 * @brief Constructs an empty marker
34 */
36
37 /**
38 * @brief Constructs a new marker
39 *
40 * @param address Location in QString where marker will be visible
41 * @param label Specifies a single uppercase alphanumeric character from
42 * set {A-Z, 0-9} which will be displayed in the marker
43 * @param size Specifies the size of marker
44 * @param color Color of marker
45 */
46 explicit StaticMapMarker(const QString &address, const QChar &label = QChar(), const MarkerSize size = Normal, const QColor &color = Qt::red);
47
48 /**
49 * @brief Constructs a new marker
50 *
51 * @param address Location in KContacts::Address where marker will be visible
52 * @param label Specifies a single uppercase alphanumeric character from
53 * set {A-Z, 0-9} which will be displayed in the marker
54 * @param size Specifies the size of marker
55 * @param color Color of marker
56 */
57 explicit StaticMapMarker(const KContacts::Address &address, QChar label = QChar(), const MarkerSize size = Normal, const QColor &color = Qt::red);
58
59 /**
60 * @brief Constructs a new marker
61 *
62 * @param address Location in KContacts::Geo where marker will be visible
63 * @param label Specifies a single uppercase alphanumeric character from
64 * set {A-Z, 0-9} which will be displayed in the marker
65 * @param size Specifies the size of marker
66 * @param color Color of marker
67 */
68 explicit StaticMapMarker(const KContacts::Geo &address, QChar label = QChar(), const MarkerSize size = Normal, const QColor &color = Qt::red);
69
70 /**
71 * @brief Constructs a new marker
72 *
73 * @param locations Locations as a QStringList where marker will be visible
74 * @param label Specifies a single uppercase alphanumeric character from
75 * set {A-Z, 0-9} which will be displayed in the marker
76 * @param size Specifies the size of marker
77 * @param color Color of marker
78 */
79 explicit StaticMapMarker(const QStringList &locations, QChar label = QChar(), const MarkerSize size = Normal, const QColor &color = Qt::red);
80
81 /**
82 * @brief Constructs a new marker
83 *
84 * @param locations Locations in KContacts::Address where marker will be visible
85 * @param label Specifies a single uppercase alphanumeric character from
86 * set {A-Z, 0-9} which will be displayed in the marker
87 * @param size Specifies the size of marker
88 * @param color Color of marker
89 */
90 explicit StaticMapMarker(const KContacts::Address::List &locations, QChar label = QChar(), const MarkerSize size = Normal, const QColor &color = Qt::red);
91
92 /**
93 * @brief Constructs a new marker
94 *
95 * @param locations Locations in KContacts::Geo where marker will be visible
96 * @param label Specifies a single uppercase alphanumeric character from
97 * set {A-Z, 0-9} which will be displayed in the marker
98 * @param size Specifies the size of marker
99 * @param color Color of marker
100 */
101 explicit StaticMapMarker(const QList<KContacts::Geo> &locations, QChar label = QChar(), const MarkerSize size = Normal, const QColor &color = Qt::red);
102
103 /**
104 * @brief Copy constructor
105 */
106 StaticMapMarker(const StaticMapMarker &other);
107
108 /**
109 * @brief Destructor
110 */
112
113 /**
114 * @brief Returns in which format is location saved.
115 */
116 [[nodiscard]] LocationType locationType() const;
117
118 /**
119 * @brief Returns color of marker
120 */
121 [[nodiscard]] QColor color() const;
122
123 /**
124 * @brief Sets color of marker
125 *
126 * @param color Color for marker
127 */
128 void setColor(const QColor &color);
129
130 /**
131 * @brief Returns if marker is valid. It means that marker needs defined location
132 */
133 [[nodiscard]] bool isValid() const;
134
135 /**
136 * @brief Returns label of marker
137 */
138 [[nodiscard]] QChar label() const;
139
140 /**
141 * @brief Sets label of marker
142 *
143 * @param label Specifies a single uppercase alphanumeric character from
144 * set {A-Z, 0-9} which will be displayed in the marker
145 */
146 void setLabel(QChar label);
147
148 /**
149 * @brief Returns locations in QString
150 */
151 [[nodiscard]] QStringList locationsString() const;
152
153 /**
154 * @brief Sets one location for marker
155 *
156 * @param location Location for marker in QString
157 */
158 void setLocation(const QString &location);
159
160 /**
161 * @brief Sets locations for marker
162 *
163 * @param locations Locations for marker in QString
164 */
165 void setLocations(const QStringList &locations);
166
167 /**
168 * @brief Returns locations in KContacts::Address
169 */
170 [[nodiscard]] KContacts::Address::List locationsAddress() const;
171
172 /**
173 * @brief Sets one location for marker
174 *
175 * @param location Location for marker in KContacts::Address
176 */
177 void setLocation(const KContacts::Address &location);
178
179 /**
180 * @brief Sets locations for marker
181 *
182 * @param locations Locations for marker in KContacts::Address
183 */
184 void setLocations(const KContacts::Address::List &locations);
185
186 /**
187 * @brief Returns locations in KContacts::Geo
188 */
189 [[nodiscard]] QList<KContacts::Geo> locationsGeo() const;
190
191 /**
192 * @brief Sets one location for marker
193 *
194 * @param location Location for marker in KContacts::Geo
195 */
196 void setLocation(const KContacts::Geo &location);
197
198 /**
199 * @brief Sets locations for marker
200 *
201 * @param locations Locations for marker in KContacts::Geo
202 */
203 void setLocations(const QList<KContacts::Geo> &locations);
204
205 /**
206 * @brief Returns all locations and markers preferences in format to URL query.
207 */
208 [[nodiscard]] QString toString() const;
209
210 /**
211 * @brief Returns size of marker
212 */
213 [[nodiscard]] MarkerSize size() const;
214
215 /**
216 * @brief Sets size of marker
217 *
218 * @param size Specifies the size of marker
219 */
220 void setSize(const MarkerSize size);
221
222 /**
223 * @brief Assignment operator
224 */
225 StaticMapMarker &operator=(const StaticMapMarker &other);
226
227private:
228 class Private;
229 Private *const d;
230 friend class Private;
231};
232
233} // namespace KGAPI2
Represents marker with defined label, color, size and markers.
A job to fetch a single map tile described by a StaticMapUrl.
Definition blog.h:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.