Marble

GeoDataContainer.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2007 Murad Tagirov <tmurad@gmail.com>
4// SPDX-FileCopyrightText: 2007 Inge Wallin <inge@lysator.liu.se>
5// SPDX-FileCopyrightText: 2009 Patrick Spendrin <ps_ml@gmx.de>
6//
7
8#ifndef MARBLE_GEODATACONTAINER_H
9#define MARBLE_GEODATACONTAINER_H
10
11#include <QList>
12
13#include "geodata_export.h"
14
15#include "GeoDataFeature.h"
16
17namespace Marble
18{
19
20class GeoDataContainerPrivate;
21
22class GeoDataFolder;
23class GeoDataPlacemark;
24class GeoDataLatLonAltBox;
25
26/**
27 * @short A base class that can hold GeoDataFeatures
28 *
29 * GeoDataContainer is the base class for the GeoData container
30 * classes GeoDataFolder and GeoDataDocument. It is never
31 * instantiated by itself, but is always used as part of a derived
32 * class.
33 *
34 * It is based on GeoDataFeature, and it only adds a
35 * QList<GeodataFeature *> to it, making it a Feature that can hold
36 * other Features.
37 *
38 * @see GeoDataFolder
39 * @see GeoDataDocument
40 */
41class GEODATA_EXPORT GeoDataContainer : public GeoDataFeature
42{
43public:
44 /// Default constructor
47 /// Destruct the GeoDataContainer
49
50 GeoDataContainer &operator=(const GeoDataContainer &other);
51
52 /**
53 * @brief A convenience function that returns the LatLonAltBox of all
54 * placemarks in this container.
55 * @return The GeoDataLatLonAltBox
56 *
57 * @see GeoDataLatLonAltBox
58 */
59 GeoDataLatLonAltBox latLonAltBox() const;
60
61 /**
62 * @brief A convenience function that returns all folders in this container.
63 * @return A QList of GeoDataFolder
64 *
65 * @see GeoDataFolder
66 */
67 QList<GeoDataFolder *> folderList() const;
68
69 /**
70 * @brief A convenience function that returns all features in this container.
71 * @return A QList of GeoDataFeature
72 *
73 * @see GeoDataFeature
74 */
75 QList<GeoDataFeature *> featureList() const;
76
77 /**
78 * @brief A convenience function that returns all placemarks in this container.
79 * @return A QList of GeoDataPlacemark
80 *
81 * @see GeoDataPlacemark
82 */
83 QList<GeoDataPlacemark *> placemarkList() const;
84
85 /**
86 * @brief returns the requested child item
87 */
88 GeoDataFeature *child(int);
89
90 /**
91 * @brief returns the requested child item
92 */
93 const GeoDataFeature *child(int) const;
94
95 /**
96 * @brief returns the position of an item in the list
97 */
98 int childPosition(const GeoDataFeature *child) const;
99
100 /**
101 * @brief inserts @p feature at position @p index in the container
102 */
103 void insert(int index, GeoDataFeature *feature);
104
105 GEODATA_DEPRECATED void insert(GeoDataFeature *other, int index);
106
107 /**
108 * @brief add an element
109 */
110 void append(GeoDataFeature *other);
111
112 void remove(int index);
113
114 void remove(int index, int count);
115
116 int removeAll(GeoDataFeature *feature);
117
118 void removeAt(int index);
119
120 void removeFirst();
121
122 void removeLast();
123
124 bool removeOne(GeoDataFeature *feature);
125
126 /**
127 * @brief size of the container
128 */
129 int size() const;
130
131 /**
132 * @brief Returns true if the container has size 0; otherwise returns false.
133 */
134 bool isEmpty() const;
135
136 /**
137 * @brief return the reference of the element at a specific position
138 */
139 GeoDataFeature &at(int pos);
140 const GeoDataFeature &at(int pos) const;
141
142 /**
143 * @brief return the reference of the last element for convenience
144 */
145 GeoDataFeature &last();
146 const GeoDataFeature &last() const;
147 /**
148 * @brief return the reference of the last element for convenience
149 */
150 GeoDataFeature &first();
151 const GeoDataFeature &first() const;
152
157 void clear();
158
159 /**
160 * @brief Serialize the container to a stream.
161 * @param stream the stream
162 */
163 void pack(QDataStream &stream) const override;
164 /**
165 * @brief Unserialize the container from a stream
166 * @param stream the stream
167 */
168 void unpack(QDataStream &stream) override;
169
170protected:
171 explicit GeoDataContainer(GeoDataContainerPrivate *priv);
172 GeoDataContainer(const GeoDataContainer &other, GeoDataContainerPrivate *priv);
173
174 bool equals(const GeoDataContainer &other) const;
175 using GeoDataFeature::equals;
176
177private:
178 Q_DECLARE_PRIVATE(GeoDataContainer)
179};
180
181}
182
183#endif
A base class that can hold GeoDataFeatures.
~GeoDataContainer() override
Destruct the GeoDataContainer.
A base class for all geodata features.
A class that defines a 3D bounding box for geographic data.
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 18 2024 12:15:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.