File indexing completed on 2024-03-24 15:23:45

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2016 Akshat Tandon <akshat.tandon@research.iiit.ac.in>
0004 //
0005 
0006 #ifndef MARBLE_WAYCHUNK_H
0007 #define MARBLE_WAYCHUNK_H
0008 
0009 #include "GeoDataPlacemark.h"
0010 
0011 #include <QList>
0012 #include <QSharedPointer>
0013 
0014 namespace Marble {
0015 
0016 class GeoDataPlacemark;
0017 
0018 class WayChunk
0019 {
0020 private:
0021     using PlacemarkPtr = QSharedPointer<GeoDataPlacemark>;
0022 
0023 public:
0024     using Ptr = QSharedPointer<WayChunk>;
0025 
0026     WayChunk(const PlacemarkPtr &placemark, qint64 first, qint64 last );
0027     ~WayChunk();
0028     void append(const PlacemarkPtr &placemark, qint64 last);
0029     void append(const Ptr &chunk);
0030     void prepend(const PlacemarkPtr & placemark, qint64 first);
0031 
0032     /*
0033      * Creates a new placemark object by concatenating all the linsetrings which exist in the WayChunk
0034      * Caller has the responsibility of deleting the object.
0035      */
0036     PlacemarkPtr merge();
0037 
0038     qint64 first() const;
0039     qint64 last() const;
0040     void reverse();
0041     int size() const;
0042     bool concatPossible(const GeoDataPlacemark &placemark) const;
0043 
0044 private:
0045     bool isTunnel(const OsmPlacemarkData &osmData) const;
0046 
0047     QVector<PlacemarkPtr> m_wayList;
0048     qint64 m_first;
0049     qint64 m_last;
0050     GeoDataPlacemark::GeoDataVisualCategory m_visualCategory;
0051     bool m_isTunnel;
0052 };
0053 
0054 }
0055 
0056 #endif