Marble

GeoDataFeature.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2007 Murad Tagirov <tmurad@gmail.com>
4// SPDX-FileCopyrightText: 2009 Patrick Spendrin <ps_ml@gmx.de>
5//
6
7#ifndef MARBLE_GEODATAFEATURE_H
8#define MARBLE_GEODATAFEATURE_H
9
10#include "GeoDataObject.h"
11
12#include "geodata_export.h"
13
14namespace Marble
15{
16
17// forward define all features we can find.
18class GeoDataRegion;
19class GeoDataAbstractView;
20
21class GeoDataStyle;
22class GeoDataStyleMap;
23
24class GeoDataExtendedData;
25
26class GeoDataTimeSpan;
27class GeoDataTimeStamp;
28
29class GeoDataFeaturePrivate;
30
31class GeoDataSnippet;
32
33/**
34 * @short A base class for all geodata features
35 *
36 * GeoDataFeature is the base class for most geodata classes that
37 * correspond to places on a map. It is never instantiated by itself,
38 * but is always used as part of a derived class.
39 *
40 * @see GeoDataPlacemark
41 * @see GeoDataContainer
42 */
43class GEODATA_EXPORT GeoDataFeature : public GeoDataObject
44{
45public:
47 /// Create a new GeoDataFeature with @p name as its name.
48 explicit GeoDataFeature(const QString &name);
49
50 GeoDataFeature(const GeoDataFeature &other);
51
52 ~GeoDataFeature() override;
53
54 GeoDataFeature &operator=(const GeoDataFeature &other);
55
56 bool operator==(const GeoDataFeature &other) const;
57 inline bool operator!=(const GeoDataFeature &other) const
58 {
59 return !(*this == other);
60 }
61
62 EnumFeatureId featureId() const;
63
64 /**
65 * @brief The name of the feature
66 *
67 * The name of the feature should be a short string. It is often
68 * shown directly on the map and need therefore not take up much
69 * space.
70 *
71 * @return The name of this feature
72 */
73 QString name() const;
74 /**
75 * @brief Set a new name for this feature
76 * @param value the new name
77 */
78 void setName(const QString &value);
79
80 /**
81 * @brief A short description of the feature.
82 *
83 * HTML markup is not supported.
84 * @todo When the Snippet is not supplied, the first lines of description should be used.
85 * @return The name of this feature
86 */
87 GeoDataSnippet snippet() const;
88 /**
89 * @brief Set a new name for this feature
90 * @param value the new name
91 */
92 void setSnippet(const GeoDataSnippet &value);
93
94 /// Return the address of the feature
95 QString address() const;
96 /// Set the address of this feature to @p value.
97 void setAddress(const QString &value);
98
99 /// Return the phone number of the feature
100 QString phoneNumber() const;
101 /// Set the phone number of this feature to @p value.
102 void setPhoneNumber(const QString &value);
103
104 /// Return the text description of the feature.
105 QString description() const;
106 /// Set the description of this feature to @p value.
107 void setDescription(const QString &value);
108
109 /**
110 * @brief test if the description is CDATA or not
111 * CDATA allows for special characters to be included in XML and also allows
112 * for other XML formats to be embedded in the XML without interfering with
113 * parser namespace.
114 * @return @c true if the description should be treated as CDATA
115 * @c false if the description is a plain string
116 */
117 bool descriptionIsCDATA() const;
118 /// Set the description to be CDATA See: @see descriptionIsCDATA()
119 void setDescriptionCDATA(bool cdata);
120
121 /// Get the Abstract view of the feature
122 const GeoDataAbstractView *abstractView() const;
123 GeoDataAbstractView *abstractView();
124 /// Set the abstract view of the feature
125 void setAbstractView(GeoDataAbstractView *abstractView);
126
127 /// Return the styleUrl of the feature.
128 QString styleUrl() const;
129 /// Set the styleUrl of this feature to @p value.
130 void setStyleUrl(const QString &value);
131
132 /// Return whether this feature is visible or not
133 bool isVisible() const;
134
135 /// Return whether this feature is visible or not in the context of its parenting
136 bool isGloballyVisible() const;
137
138 /**
139 * @brief Set a new value for visibility
140 * @param value new value for the visibility
141 *
142 * This function sets the visibility, i.e. whether this feature
143 * should be shown or not. This can be changed either from a GUI
144 * or through some action of the program.
145 */
146 void setVisible(bool value);
147
148 /**
149 * Return the timespan of the feature.
150 */
151 const GeoDataTimeSpan &timeSpan() const;
152 GeoDataTimeSpan &timeSpan();
153
154 /**
155 * Set the timespan of the feature.
156 * @param timeSpan new of timespan.
157 */
158 void setTimeSpan(const GeoDataTimeSpan &timeSpan);
159
160 /**
161 * Return the timestamp of the feature.
162 */
163 const GeoDataTimeStamp &timeStamp() const;
164 GeoDataTimeStamp &timeStamp();
165
166 /**
167 * Set the timestamp of the feature.
168 * @param timeStamp new of the timestamp.
169 */
170 void setTimeStamp(const GeoDataTimeStamp &timeStamp);
171
172 /**
173 * Return the style assigned to the placemark, or a default style if none has been set
174 */
176 /**
177 * Return the style assigned to the placemark with setStyle (can be 0)
178 */
179 QSharedPointer<const GeoDataStyle> customStyle() const;
180 /**
181 * Sets the style of the placemark.
182 * @param style the new style to be used.
183 */
184 void setStyle(const QSharedPointer<GeoDataStyle> &style);
185
186 /**
187 * Return the ExtendedData assigned to the feature.
188 */
189 GeoDataExtendedData &extendedData();
190 const GeoDataExtendedData &extendedData() const;
191
192 /**
193 * Sets the ExtendedData of the feature.
194 * @param extendedData the new ExtendedData to be used.
195 */
196 void setExtendedData(const GeoDataExtendedData &extendedData);
197
198 /**
199 * Return the region assigned to the placemark.
200 */
201 const GeoDataRegion &region() const;
202 GeoDataRegion &region();
203 /**
204 * @brief Sets the region of the placemark.
205 * @param region new value for the region
206 *
207 * The feature is only shown when the region if active.
208 */
209 void setRegion(const GeoDataRegion &region);
210
211 /**
212 * Return the role of the placemark.
213 *
214 * FIXME: describe roles here!
215 */
216 const QString role() const;
217 /**
218 * Sets the role of the placemark.
219 * @param role the new role to be used.
220 */
221 void setRole(const QString &role);
222
223 /**
224 * @brief Return the popularity index of the placemark.
225 *
226 * The popularity index is a value which describes at which zoom
227 * level the placemark will be shown.
228 */
229 int zoomLevel() const;
230 /**
231 * Sets the popularity @p index of the placemark.
232 * @param index the new index to be used.
233 */
234 void setZoomLevel(int index);
235
236 /**
237 * Return the popularity of the feature.
238 */
239 qint64 popularity() const;
240 /**
241 * Sets the @p popularity of the feature.
242 * @param popularity the new popularity value
243 */
244 void setPopularity(qint64 popularity);
245
246 /**
247 * Return a pointer to a GeoDataStyleMap object which represents the styleMap
248 * of this feature. A styleMap is simply a QMap<QString,QString> which can connect
249 * two styles with a keyword. This can be used to have a highlighted and a
250 * normal style.
251 * @see GeoDataStyleMap
252 */
253 const GeoDataStyleMap *styleMap() const;
254 /**
255 * Sets the styleMap of the feature
256 */
257 void setStyleMap(const GeoDataStyleMap *map);
258
259 /// Duplicate into another equal instance
260 virtual GeoDataFeature *clone() const = 0;
261
262 /// Serialize the contents of the feature to @p stream.
263 void pack(QDataStream &stream) const override;
264 /// Unserialize the contents of the feature from @p stream.
265 void unpack(QDataStream &stream) override;
266
267protected:
268 // the d-pointer needs to be protected to be accessible from derived classes
269 GeoDataFeaturePrivate *const d_ptr;
270 explicit GeoDataFeature(GeoDataFeaturePrivate *dd);
271 GeoDataFeature(const GeoDataFeature &other, GeoDataFeaturePrivate *dd);
272
273 bool equals(const GeoDataFeature &other) const;
274 using GeoDataObject::equals;
275
276private:
277 Q_DECLARE_PRIVATE(GeoDataFeature)
278};
279
280}
281
282#endif
a class which allows to add custom data to KML Feature.
A base class for all geodata features.
virtual GeoDataFeature * clone() const =0
Duplicate into another equal instance.
A base class for all geodata objects.
GeoDataRegion describes the visibility and extent of a feature.
a class to map different styles to one style
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.