Marble

GeoDataExtendedData.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2010 Harshit Jain <[email protected]>
4 // SPDX-FileCopyrightText: 2011 Niko Sams <[email protected]>
5 //
6 
7 #ifndef MARBLE_GEODATAEXTENDEDDATA_H
8 #define MARBLE_GEODATAEXTENDEDDATA_H
9 
10 #include "GeoDocument.h"
11 #include "Serializable.h"
12 
13 #include "geodata_export.h"
14 #include <QHash>
15 
16 namespace Marble
17 {
18 
19 class GeoDataSimpleArrayData;
20 class GeoDataSchemaData;
21 class GeoDataData;
22 
23 class GeoDataExtendedDataPrivate;
24 
25 /**
26  * @short a class which allows to add custom data to KML Feature.
27  *
28  * @see GeoDataData
29  */
30 class GEODATA_EXPORT GeoDataExtendedData : public GeoNode, public Serializable
31 {
32  public:
35  ~GeoDataExtendedData() override;
36 
37  /// Provides type information for downcasting a GeoNode
38  const char* nodeType() const override;
39 
40  /**
41  * @brief assignment operator
42  */
43  GeoDataExtendedData& operator=( const GeoDataExtendedData& other );
44 
45  bool operator==( const GeoDataExtendedData& other ) const;
46  bool operator!=( const GeoDataExtendedData& other ) const;
47 
48  /**
49  * @brief return the value of GeoDataExtendedData associated with the given @p key
50  */
51  GeoDataData value( const QString& key ) const;
52 
53  /**
54  * @brief add a data object to the GeoDataExtendedData with the @p key
55  */
56  void addValue( const GeoDataData& data );
57 
58  /**
59  * @since 0.26.0
60  */
61  void removeKey(const QString &key);
62 
63  /**
64  * @brief return const Begin iterator for QHash
65  */
67 
68  /**
69  * @brief return const End iterator for QHash
70  */
71 
73 
74  /**
75  * @brief return size of QHash
76  */
77 
78  int size( ) const;
79 
80  /**
81  * @brief return whether QHash is empty or not
82  */
83  bool isEmpty( ) const;
84 
85  /**
86  * @brief Returns true if there exists a value for the given key
87  */
88  bool contains( const QString &key ) const;
89 
90  /**
91  * @brief return value of GeoDataExtendedData object associated with the given @p key as a modifiable reference
92  */
93  GeoDataData& valueRef( const QString& key ) const;
94 
95  /**
96  * @brief set SimpleArrayData for given @p key
97  *
98  * ExtendedData takes ownership of SimpleArrayData
99  */
100  void setSimpleArrayData( const QString& key, GeoDataSimpleArrayData* values );
101 
102  /**
103  * @brief return SimpleArrayData for given @p key, 0 pointer if none is set
104  */
105  GeoDataSimpleArrayData* simpleArrayData( const QString& key ) const;
106 
107  /**
108  * @brief Adds a SchemaData @p schemaData element to schemaDataHash
109  */
110  GeoDataSchemaData& schemaData( const QString& schemaUrl ) const;
111 
112  /**
113  * @brief Adds a SchemaData @p schemaData element to schemaDataHash
114  */
115  void addSchemaData( const GeoDataSchemaData& schemaData );
116 
117  /**
118  * @brief Removes a SchemaData element with schema url @p schemaUrl from schemaDataHash
119  */
120  void removeSchemaData( const QString& schemaUrl );
121 
122  /**
123  * @brief Dump a vector containing all SchemaData element
124  */
125  QList< GeoDataSchemaData > schemaDataList() const;
126 
127  /**
128  * @brief Serialize the ExtendedData to a stream
129  * @param stream the stream
130  */
131  void pack( QDataStream& stream ) const override;
132 
133  /**
134  * @brief Unserialize the ExtendedData from a stream
135  * @param stream the stream
136  */
137  void unpack( QDataStream& stream ) override;
138 
139 private:
140  GeoDataExtendedDataPrivate * const d;
141 };
142 
143 }
144 
145 #endif
Binds a QML item to a specific geodetic location in screen coordinates.
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:34
a class which allows to add custom data to KML Feature.
QVector< V > values(const QMultiHash< K, V > &c)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Dec 2 2021 23:11:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.