File indexing completed on 2024-06-23 07:24:19

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_WAYCONCATENATOR_H
0007 #define MARBLE_WAYCONCATENATOR_H
0008 
0009 #include "TagsFilter.h"
0010 #include "WayChunk.h"
0011 
0012 namespace Marble {
0013 
0014 class WayConcatenator
0015 {
0016 private:
0017     using PlacemarkPtr = QSharedPointer<GeoDataPlacemark>;
0018 
0019 public:
0020     explicit WayConcatenator(GeoDataDocument *document);
0021 
0022     int originalWays() const;
0023     int mergedWays() const;
0024 
0025 private:
0026     void createWayChunk(const PlacemarkPtr &placemark, qint64 firstId, qint64 lastId);
0027     WayChunk::Ptr wayChunk(const GeoDataPlacemark &placemark, qint64 matchId) const;
0028     void concatFirst(const PlacemarkPtr &placemark, const WayChunk::Ptr &chunk);
0029     void concatLast(const PlacemarkPtr & placemark, const WayChunk::Ptr &chunk);
0030     void concatBoth(const PlacemarkPtr &placemark, const WayChunk::Ptr &chunk, const WayChunk::Ptr &otherChunk);
0031     void addWayChunks(GeoDataDocument *document);
0032 
0033     QMultiHash<qint64, WayChunk::Ptr> m_hash;
0034     QVector<WayChunk::Ptr> m_chunks;
0035     QVector<PlacemarkPtr> m_wayPlacemarks;
0036     QVector<GeoDataFeature*> m_otherPlacemarks;
0037 
0038     int m_originalWays;
0039     int m_mergedWays;
0040 };
0041 
0042 }
0043 
0044 #endif