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

KDE's Doxygen guidelines are available online.