File indexing completed on 2025-01-05 03:58:59
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2006-2007 Torsten Rahn <tackat@kde.org> 0004 // SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org> 0005 // SPDX-FileCopyrightText: 2008 Patrick Spendrin <ps_ml@gmx.de> 0006 // 0007 0008 0009 #ifndef MARBLE_GEODATAPOINT_H 0010 #define MARBLE_GEODATAPOINT_H 0011 0012 #include <QMetaType> 0013 #include <QVector> 0014 0015 #include <cmath> 0016 0017 #include "digikam_export.h" 0018 #include "GeoDataGeometry.h" 0019 #include "GeoDataCoordinates.h" 0020 0021 namespace Marble 0022 { 0023 0024 class GeoDataPointPrivate; 0025 0026 /** 0027 * @short A Geometry object representing a 3d point 0028 * 0029 * GeoDataPoint is the GeoDataGeometry class representing a single three 0030 * dimensional point. It reflects the Point tag of KML spec and can be contained 0031 * in objects holding GeoDataGeometry objects. 0032 * Nevertheless GeoDataPoint shouldn't be used if you just want to store 0033 * 3d coordinates of a point that doesn't need to be inherited from GeoDataGeometry 0034 * In that case use GeoDataCoordinates instead which has nearly the same features 0035 * and is much more light weight. 0036 * Please consider this especially if you expect to have a high 0037 * amount of points e.g. for line strings, linear rings and polygons. 0038 * @see GeoDataCoordinates 0039 * @see GeoDataGeometry 0040 */ 0041 0042 class DIGIKAM_EXPORT GeoDataPoint : public GeoDataGeometry 0043 { 0044 public: 0045 using Notation = GeoDataCoordinates::Notation; 0046 using Unit = GeoDataCoordinates::Unit; 0047 0048 GeoDataPoint( const GeoDataPoint& other ); 0049 explicit GeoDataPoint( const GeoDataCoordinates& other ); 0050 GeoDataPoint(); 0051 0052 /** 0053 * @brief create a geopoint from longitude and latitude 0054 * @param lon longitude 0055 * @param lat latitude 0056 * @param alt altitude (default: 0) 0057 * @param _unit units that lon and lat get measured in 0058 * (default for Radian: north pole at pi/2, southpole at -pi/2) 0059 */ 0060 GeoDataPoint( qreal lon, qreal lat, qreal alt = 0, 0061 GeoDataPoint::Unit _unit = GeoDataCoordinates::Radian ); 0062 0063 ~GeoDataPoint() override; 0064 0065 EnumGeometryId geometryId() const override; 0066 0067 GeoDataGeometry *copy() const override; 0068 0069 bool operator==( const GeoDataPoint &other ) const; 0070 bool operator!=( const GeoDataPoint &other ) const; 0071 0072 void setCoordinates( const GeoDataCoordinates &coordinates ); 0073 0074 const GeoDataCoordinates& coordinates() const; 0075 0076 /// Provides type information for downcasting a GeoData 0077 const char* nodeType() const override; 0078 0079 // Type definitions 0080 using Vector = QVector<GeoDataPoint>; 0081 0082 0083 // Serialize the Placemark to @p stream 0084 void pack( QDataStream& stream ) const override; 0085 // Unserialize the Placemark from @p stream 0086 void unpack( QDataStream& stream ) override; 0087 0088 virtual void detach(); 0089 0090 private: 0091 Q_DECLARE_PRIVATE(GeoDataPoint) 0092 }; 0093 0094 } 0095 0096 Q_DECLARE_METATYPE( Marble::GeoDataPoint ) 0097 0098 #endif