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

KDE's Doxygen guidelines are available online.