Marble

GeoDataDocument.h
1/*
2 SPDX-FileCopyrightText: 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 SPDX-FileCopyrightText: 2007 Murad Tagirov <tmurad@gmail.com>
4 SPDX-FileCopyrightText: 2009 Patrick Spendrin <ps_ml@gmx.de>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef MARBLE_GEODATADOCUMENT_H
10#define MARBLE_GEODATADOCUMENT_H
11
12#include <QMetaType>
13
14#include "geodata_export.h"
15
16#include "GeoDataContainer.h"
17#include "GeoDataStyle.h"
18#include "GeoDocument.h"
19
20namespace Marble
21{
22
23enum DocumentRole {
24 UnknownDocument,
25 MapDocument,
26 UserDocument,
27 TrackingDocument,
28 BookmarkDocument,
29 SearchResultDocument
30};
31
32class GeoDataStyleMap;
33class GeoDataNetworkLinkControl;
34class GeoDataSchema;
35
36class GeoDataDocumentPrivate;
37
38/**
39 * @short A container for Features, Styles and in the future Schemas.
40 *
41 * A GeoDataDocument is a container for features, styles, and
42 * schemas. This element is required if your KML file uses schemas or
43 * shared styles. It is recommended that all Styles be defined in a
44 * Document, each with an id, and then later referenced by a
45 * styleUrl for a given Feature or StyleMap.
46 */
47class GEODATA_EXPORT GeoDataDocument : public GeoDocument, public GeoDataContainer
48{
49public:
51 GeoDataDocument(const GeoDataDocument &other);
52 ~GeoDataDocument() override;
53
54 GeoDataDocument &operator=(const GeoDataDocument &other);
55
56 bool operator==(const GeoDataDocument &other) const;
57 bool operator!=(const GeoDataDocument &other) const;
58
59 const char *nodeType() const override;
60
61 GeoDataFeature *clone() const override;
62
63 /// Provides type information for downcasting a GeoData
64 bool isGeoDataDocument() const override
65 {
66 return true;
67 }
68
69 DocumentRole documentRole() const;
70 void setDocumentRole(DocumentRole role);
71
72 QString property() const;
73 void setProperty(const QString &property);
74
75 /**
76 * @brief The filename of the document
77 *
78 * The filename of the document is used internally to identify the files.
79 * it should never be empty as this could lead to potential collisions.
80 *
81 * @return The filename of this document
82 */
83 QString fileName() const;
84 /**
85 * @brief Set a new file name for this document
86 * @param value the new name
87 */
88 void setFileName(const QString &value);
89
90 /**
91 * @brief The URI relative paths should be resolved against
92 */
93 QString baseUri() const;
94
95 /**
96 * @brief Change the URI for resolving relative paths.
97 * See https://tools.ietf.org/html/rfc3986#section-5
98 */
99 void setBaseUri(const QString &baseUri);
100
101 /**
102 * @brief the NetworkLinkControl of the file
103 */
104 GeoDataNetworkLinkControl networkLinkControl() const;
105
106 /**
107 * @brief set the NetworkLinkControl of the file
108 */
109 void setNetworkLinkControl(const GeoDataNetworkLinkControl &networkLinkControl);
110
111 /**
112 * @brief Add a style to the style storage
113 * @param style the new style
114 */
115 void addStyle(const GeoDataStyle::Ptr &style);
116
117 /**
118 * @brief Add a style to the style storage
119 * @param styleId the new style
120 */
121 void removeStyle(const QString &styleId);
122
123 /**
124 * @brief Return a style in the style storage
125 * @param styleId the id of the style
126 */
127 GeoDataStyle::Ptr style(const QString &styleId);
128 GeoDataStyle::ConstPtr style(const QString &styleId) const;
129
130 /**
131 * @brief dump a Vector of all styles
132 */
134 QList<GeoDataStyle::ConstPtr> styles() const;
135
136 /**
137 * @brief Add a stylemap to the stylemap storage
138 * @param map the new stylemap
139 */
140 void addStyleMap(const GeoDataStyleMap &map);
141
142 /**
143 * @brief remove stylemap from storage
144 * @param mapId the styleId of the styleMap to be removed
145 */
146 void removeStyleMap(const QString &mapId);
147
148 /**
149 * @brief Return a style in the style storage
150 * @param styleId the id of the style
151 */
152 GeoDataStyleMap &styleMap(const QString &styleId);
153 GeoDataStyleMap styleMap(const QString &styleId) const;
154
155 /**
156 * @brief dump a Vector of all stylemaps
157 */
158 QList<GeoDataStyleMap> styleMaps() const;
159
160 /**
161 * @brief Add a schema to simplemap storage
162 * @param schema the new schema
163 */
164 void addSchema(const GeoDataSchema &schema);
165
166 /**
167 * @brief remove a schema from schema storage
168 * @param schemaId the of schema to be removed
169 */
170 void removeSchema(const QString &schemaId);
171
172 /**
173 * @brief Returns a schema with id = schemaId form schema storage
174 * @param schemaId The id of schema to be returned
175 */
176 GeoDataSchema schema(const QString &schemaId) const;
177 GeoDataSchema &schema(const QString &schemaId);
178
179 /**
180 * @brief dump a vector of all schemas
181 */
182 QList<GeoDataSchema> schemas() const;
183
184 // Serialize the Placemark to @p stream
185 void pack(QDataStream &stream) const override;
186 // Unserialize the Placemark from @p stream
187 void unpack(QDataStream &stream) override;
188
189private:
190 Q_DECLARE_PRIVATE(GeoDataDocument)
191};
192
193}
194Q_DECLARE_METATYPE(Marble::GeoDataDocument *)
195#endif
A base class that can hold GeoDataFeatures.
A container for Features, Styles and in the future Schemas.
bool isGeoDataDocument() const override
Provides type information for downcasting a GeoData.
A base class for all geodata features.
a class to map different styles to one style
A shared base class between GeoDataDocument/GeoSourceDocument.
Definition GeoDocument.h:20
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 Fri Nov 1 2024 18:53:49 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.