File indexing completed on 2024-05-12 03:50:15

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2012 Thibaut Gridel <tgridel@free.fr>
0004 
0005 #ifndef GEODATAMULTITRACK_H
0006 #define GEODATAMULTITRACK_H
0007 
0008 #include "geodata_export.h"
0009 
0010 #include "GeoDataGeometry.h"
0011 
0012 #include <QVector>
0013 
0014 namespace Marble
0015 {
0016 
0017 class GeoDataMultiTrackPrivate;
0018 class GeoDataTrack;
0019 
0020 /**
0021  */
0022 class GEODATA_EXPORT GeoDataMultiTrack : public GeoDataGeometry
0023 {
0024 public:
0025     GeoDataMultiTrack();
0026     explicit GeoDataMultiTrack( const GeoDataGeometry& other );
0027 
0028     ~GeoDataMultiTrack() override;
0029 
0030     const char *nodeType() const override;
0031 
0032     EnumGeometryId geometryId() const override;
0033 
0034     GeoDataGeometry *copy() const override;
0035 
0036     bool operator==( const GeoDataMultiTrack& other ) const;
0037     bool operator!=( const GeoDataMultiTrack& other ) const;
0038 
0039     const GeoDataLatLonAltBox& latLonAltBox() const override;
0040 
0041     int size() const;
0042     GeoDataTrack& at( int pos );
0043     const GeoDataTrack& at( int pos ) const;
0044     GeoDataTrack& operator[]( int pos );
0045     const GeoDataTrack& operator[]( int pos ) const;
0046 
0047     GeoDataTrack& first();
0048     const GeoDataTrack& first() const;
0049     GeoDataTrack& last();
0050     const GeoDataTrack& last() const;
0051 
0052     /**
0053      * @brief  returns the requested child item
0054      */
0055     GeoDataTrack* child( int );
0056 
0057     /**
0058      * @brief  returns the requested child item
0059      */
0060     const GeoDataTrack* child( int ) const;
0061 
0062     /**
0063      * @brief returns the position of an item in the list
0064      */
0065     int childPosition( const GeoDataTrack *child ) const;
0066 
0067     /**
0068     * @brief add an element
0069     */
0070     void append( GeoDataTrack *other );
0071 
0072     GeoDataMultiTrack& operator << ( const GeoDataTrack& value );
0073 
0074     QVector<GeoDataTrack*>::Iterator begin();
0075     QVector<GeoDataTrack*>::Iterator end();
0076     QVector<GeoDataTrack*>::ConstIterator constBegin() const;
0077     QVector<GeoDataTrack*>::ConstIterator constEnd() const;
0078     void clear();
0079     QVector<GeoDataTrack> vector() const;
0080 
0081     QVector<GeoDataTrack*>::Iterator erase ( QVector<GeoDataTrack*>::Iterator pos );
0082     QVector<GeoDataTrack*>::Iterator erase ( QVector<GeoDataTrack*>::Iterator begin,
0083                                                   QVector<GeoDataTrack*>::Iterator end );
0084 
0085     // Serialize the Placemark to @p stream
0086     void pack( QDataStream& stream ) const override;
0087     // Unserialize the Placemark from @p stream
0088     void unpack( QDataStream& stream ) override;
0089 
0090  private:
0091     Q_DECLARE_PRIVATE(GeoDataMultiTrack)
0092 };
0093 
0094 }
0095 
0096 #endif // GEODATAMULTITRACK_H