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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2013 Sanjiban Bairagya <sanjiban22393@gmail.com>
0004 //
0005 
0006 #include "GeoDataLocation.h"
0007 #include "GeoDataTypes.h"
0008 
0009 namespace Marble {
0010 
0011 class GeoDataLocationPrivate
0012 {
0013 public:
0014 
0015     GeoDataCoordinates m_coordinates;
0016 
0017     GeoDataLocationPrivate();
0018 };
0019 
0020 GeoDataLocationPrivate::GeoDataLocationPrivate() :
0021     m_coordinates()
0022 {
0023     // nothing to do
0024 }
0025 
0026 GeoDataLocation::GeoDataLocation() : d( new GeoDataLocationPrivate )
0027 {
0028     // nothing to do
0029 }
0030 
0031 GeoDataLocation::GeoDataLocation( const Marble::GeoDataLocation &other ) :
0032     GeoDataObject( other ), d( new GeoDataLocationPrivate( *other.d ) )
0033 {
0034     // nothing to do
0035 }
0036 
0037 GeoDataLocation &GeoDataLocation::operator=( const GeoDataLocation &other )
0038 {
0039     GeoDataObject::operator=( other );
0040     *d = *other.d;
0041     return *this;
0042 }
0043 
0044 
0045 bool GeoDataLocation::operator==( const GeoDataLocation &other ) const
0046 {
0047     return equals(other) &&
0048            d->m_coordinates == other.d->m_coordinates;
0049 }
0050 
0051 bool GeoDataLocation::operator!=( const GeoDataLocation &other ) const
0052 {
0053     return !this->operator==( other );
0054 }
0055 
0056 GeoDataLocation::~GeoDataLocation()
0057 {
0058     delete d;
0059 }
0060 
0061 const char *GeoDataLocation::nodeType() const
0062 {
0063     return GeoDataTypes::GeoDataLocationType;
0064 }
0065 
0066 qreal GeoDataLocation::altitude() const
0067 {
0068     return d->m_coordinates.altitude();
0069 }
0070 
0071 void GeoDataLocation::setAltitude(qreal altitude)
0072 {
0073 
0074     d->m_coordinates.setAltitude(altitude);
0075 }
0076 
0077 qreal GeoDataLocation::latitude(GeoDataCoordinates::Unit unit) const
0078 {
0079     return d->m_coordinates.latitude(unit);
0080 }
0081 
0082 void GeoDataLocation::setLatitude(qreal latitude, GeoDataCoordinates::Unit unit)
0083 {
0084     d->m_coordinates.setLatitude(latitude, unit);
0085 }
0086 
0087 qreal GeoDataLocation::longitude( GeoDataCoordinates::Unit unit ) const
0088 {
0089     return d->m_coordinates.longitude(unit);
0090 }
0091 
0092 void GeoDataLocation::setLongitude(qreal longitude, GeoDataCoordinates::Unit unit)
0093 {
0094     d->m_coordinates.setLongitude(longitude, unit);
0095 }
0096 
0097 
0098 }