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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2008 Torsten Rahn <rahn@kde.org>
0004 // SPDX-FileCopyrightText: 2008-2009 Patrick Spendrin <ps_ml@gmx.de>
0005 // SPDX-FileCopyrightText: 2008 Inge Wallin <inge@lysator.liu.se>
0006 //
0007 
0008 
0009 #ifndef MARBLE_GEODATAGEOMETRY_H
0010 #define MARBLE_GEODATAGEOMETRY_H
0011 
0012 
0013 #include "GeoDataObject.h"
0014 #include "MarbleGlobal.h"
0015 
0016 #include "geodata_export.h"
0017 
0018 namespace Marble
0019 {
0020 
0021 class GeoDataGeometryPrivate;
0022 
0023 class GeoDataLatLonAltBox;
0024 class GeoDataLineString; // LinearRing is the same!
0025 class GeoDataMultiGeometry;
0026 
0027 /**
0028  * @short A base class for all geodata features
0029  *
0030  * GeoDataGeometry is the base class for most geodata classes that
0031  * deal with geometric data (points, linestrings, polygons, etc.)
0032  *
0033  * @see GeoDataLineString
0034  * @see GeoDataLinearRing
0035  * @see GeoDataPolygon
0036  */
0037 
0038 class GEODATA_EXPORT GeoDataGeometry : public GeoDataObject
0039 {
0040  public:
0041     ~GeoDataGeometry() override;
0042 
0043     virtual EnumGeometryId geometryId() const = 0;
0044 
0045     virtual GeoDataGeometry *copy() const = 0;
0046 
0047     bool operator==(const GeoDataGeometry &other) const;
0048     inline bool operator!=(const GeoDataGeometry &other) const { return !(*this == other); }
0049 
0050     bool extrude() const;
0051     void setExtrude( bool extrude );
0052 
0053     AltitudeMode altitudeMode() const;
0054     void setAltitudeMode( const AltitudeMode altitudeMode );
0055 
0056     virtual const GeoDataLatLonAltBox& latLonAltBox() const;
0057 
0058     /// Serialize the contents of the feature to @p stream.
0059     void pack( QDataStream& stream ) const override;
0060     /// Unserialize the contents of the feature from @p stream.
0061     void unpack( QDataStream& stream ) override;
0062 
0063     void detach();
0064 
0065  protected:
0066     explicit GeoDataGeometry( GeoDataGeometryPrivate* priv );
0067     explicit GeoDataGeometry(const GeoDataGeometry &other);
0068     GeoDataGeometry& operator=(const GeoDataGeometry &other);
0069 
0070     bool equals(const GeoDataGeometry &other) const;
0071 
0072     using GeoDataObject::equals;
0073 
0074  protected:
0075     GeoDataGeometryPrivate *d_ptr;
0076 };
0077 
0078 }
0079 
0080 Q_DECLARE_METATYPE( Marble::GeoDataGeometry* )
0081 
0082 #endif