Marble

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

KDE's Doxygen guidelines are available online.