Kgapi

staticmappath.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 path with defined locations, weight, color and color for
21 * filled area
22 *
23 * @author Jan Grulich <grulja@gmail.com>
24 * @since 0.4
25 */
26class KGAPIMAPS_EXPORT StaticMapPath
27{
28public:
29 enum LocationType {
30 Undefined = -1,
31 String,
32 KABCAddress,
33 KABCGeo,
34 };
35
36 /**
37 * @brief Constructs an empty path
38 */
39 explicit StaticMapPath();
40
41 /**
42 * @brief Constructs a new path
43 *
44 * @param locations The path locations in QString
45 * @param weight The thickness of the path in pixels
46 * @param color The color of the path
47 * @param fillColor The color of filled area
48 */
49 explicit StaticMapPath(const QStringList &locations, const quint8 weight = 5, const QColor &color = Qt::blue, const QColor &fillColor = QColor());
50
51 /**
52 * @brief Constructs a new path
53 *
54 * @param locations The path locations in KContacts::Address
55 * @param weight The thickness of the path in pixels
56 * @param color Color of the path
57 * @param fillColor The color of filled area
58 */
59 explicit StaticMapPath(const KContacts::Address::List &locations,
60 const quint8 weight = 5,
61 const QColor &color = Qt::blue,
62 const QColor &fillColor = QColor());
63
64 /**
65 * @brief Constructs a new path
66 *
67 * @param locations The path locations in KContacts::Geo
68 * @param weight The thickness of the path in pixels
69 * @param color The color of the path
70 * @param fillColor The color of filled area
71 */
72 explicit StaticMapPath(const QList<KContacts::Geo> &locations, const quint8 weight = 5, const QColor &color = Qt::blue, const QColor &fillColor = QColor());
73
74 /**
75 * @brief Copy constructor
76 */
77 StaticMapPath(const StaticMapPath &other);
78
79 /**
80 * @brief Destructor
81 */
83
84 /**
85 * @brief Location type
86 */
87 [[nodiscard]] LocationType locationType() const;
88
89 /**
90 * @brief Returns the color of path
91 */
92 [[nodiscard]] QColor color() const;
93
94 /**
95 * @brief Sets color of the path
96 *
97 * @param color Color for path
98 */
99 void setColor(const QColor &color);
100
101 /**
102 * @brief Returns the color of filled area
103 */
104 [[nodiscard]] QColor fillColor() const;
105
106 /**
107 * @brief Sets color for filled area in path
108 *
109 * @param color The color for filled area
110 */
111 void setFillColor(const QColor &color);
112
113 /**
114 * @brief Returns whether the path is valid.
115 *
116 * This means that path has at least two locations
117 */
118 bool isValid() const;
119
120 /**
121 * @brief Returns locations in QString
122 *
123 * Returns empty list if is not defined
124 */
125 [[nodiscard]] QStringList locationsString() const;
126
127 /**
128 * @brief Sets locations for path
129 *
130 * @param locations Locations for path in QString
131 */
132 void setLocations(const QStringList &locations);
133
134 /**
135 * @brief Returns locations in KContacts::Address
136 *
137 * Returns empty list if is not defined
138 */
139 [[nodiscard]] KContacts::Address::List locationsAddress() const;
140
141 /**
142 * @brief Sets locations for path
143 *
144 * @param locations Locations for path in KContacts::Address
145 */
146 void setLocations(const KContacts::Address::List &locations);
147
148 /**
149 * @brief Returns locations in KContacts::Geo
150 *
151 * Returns empty list if is not defined
152 */
153 [[nodiscard]] QList<KContacts::Geo> locationsGeo() const;
154
155 /**
156 * @brief Sets locations for path
157 *
158 * @param locations Locations for path in KContacts::Geo
159 */
160 void setLocations(const QList<KContacts::Geo> &locations);
161
162 /**
163 * @brief Returns all locations and path preferences in format to URL query.
164 */
165 [[nodiscard]] QString toString() const;
166
167 /**
168 * @brief Returns weight of the path
169 */
170 [[nodiscard]] quint8 weight() const;
171
172 /**
173 * @brief Sets weight of the path
174 *
175 * @param weight The thickness of the path in pixels
176 */
177 void setWeight(const quint8 weight);
178
179 /**
180 * @brief Assignment operator
181 */
182 StaticMapPath &operator=(const StaticMapPath &other);
183
184private:
185 class Private;
186 Private *const d;
187 friend class Private;
188};
189
190} // namespace KGAPI2
Represents path with defined locations, weight, color and color for filled area.
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 Fri Dec 6 2024 12:11:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.