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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 #ifndef MARBLE_OSMREGION_H
0007 #define MARBLE_OSMREGION_H
0008 
0009 #include "GeoDataPolygon.h"
0010 
0011 #include <QString>
0012 
0013 namespace Marble
0014 {
0015 
0016 /**
0017   * A lightweight data structure to represent administrative regions
0018   * like villages, cities, states, ... with support for serialization.
0019   */
0020 class OsmRegion
0021 {
0022 public:
0023     OsmRegion();
0024 
0025     /** Unique (per process) region identifier */
0026     int identifier() const;
0027 
0028     /** Identifier change. Usage is only intended for
0029       * serialization; newly created regions get an
0030       * identifier automatically
0031       */
0032     void setIdentifier( int identifier );
0033 
0034     int parentIdentifier() const;
0035 
0036     void setParentIdentifier( int identifier );
0037 
0038     QString name() const;
0039 
0040     void setName( const QString &name );
0041 
0042     /** Longitude of the region's center point, in degree */
0043     qreal longitude() const;
0044 
0045     void setLongitude( qreal longitude );
0046 
0047     /** Latitude of the region's center point, in degree */
0048     qreal latitude() const;
0049 
0050     void setLeft( int left );
0051 
0052     int left() const;
0053 
0054     void setRight( int right );
0055 
0056     int right() const;
0057 
0058     void setLatitude( qreal latitude );
0059 
0060     bool operator==( const OsmRegion &other ) const;
0061 
0062     const GeoDataPolygon& geometry() const;
0063 
0064     void setGeometry( const GeoDataPolygon &polygon );
0065 
0066     int adminLevel() const;
0067 
0068     void setAdminLevel( int level );
0069 
0070 private:
0071     static int m_idFactory;
0072 
0073     int m_identifier;
0074 
0075     int m_parent;
0076 
0077     QString m_name;
0078 
0079     qreal m_longitude;
0080 
0081     qreal m_latitude;
0082 
0083     int m_left;
0084 
0085     int m_right;
0086 
0087     GeoDataPolygon m_geometry;
0088 
0089     int m_adminLevel;
0090 };
0091 
0092 }
0093 
0094 #endif // MARBLE_OSMREGION_H