File indexing completed on 2024-04-14 03:48:51

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 #ifndef OSMREGIONTREE_H
0007 #define OSMREGIONTREE_H
0008 
0009 #include "OsmRegion.h"
0010 
0011 #include <QVector>
0012 
0013 namespace Marble
0014 {
0015 
0016 class OsmRegionTree
0017 {
0018 public:
0019     explicit OsmRegionTree( const OsmRegion & node = OsmRegion() );
0020 
0021     const OsmRegion &node() const;
0022 
0023     void setChildren( const QVector<OsmRegionTree>& children );
0024 
0025     const QVector<OsmRegionTree> & children() const;
0026 
0027     void append( QList<OsmRegion> &regions );
0028 
0029     void traverse( int &counter );
0030 
0031     operator QList<OsmRegion>() const;
0032 
0033     int smallestRegionId( const GeoDataCoordinates &coordinates ) const;
0034 
0035 private:
0036     int smallestRegionId( const GeoDataCoordinates &coordinates, int &level ) const;
0037 
0038     void enumerate( QList<OsmRegion> &list ) const;
0039 
0040     OsmRegion m_node;
0041 
0042     QVector<OsmRegionTree> m_children;
0043 };
0044 
0045 }
0046 
0047 #endif // OSMREGIONTREE_H
0048