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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2013 Mayank Madan <maddiemadan@gmail.com>
0004 //
0005 
0006 #include "GeoDataFlyTo.h"
0007 #include "GeoDataTypes.h"
0008 #include "GeoDataAbstractView.h"
0009 
0010 namespace Marble {
0011 
0012 class GeoDataFlyToPrivate
0013 {
0014 public:
0015     double m_duration;
0016 
0017     GeoDataFlyTo::FlyToMode m_flyToMode;
0018 
0019     GeoDataAbstractView* m_view;
0020 
0021     GeoDataFlyToPrivate();
0022 };
0023 
0024 GeoDataFlyToPrivate::GeoDataFlyToPrivate() :
0025     m_duration( 0.0 ), m_flyToMode(), m_view( nullptr )
0026 {
0027 
0028 }
0029 
0030 GeoDataFlyTo::GeoDataFlyTo() : d( new GeoDataFlyToPrivate )
0031 {
0032 
0033 }
0034 
0035 GeoDataFlyTo::GeoDataFlyTo( const Marble::GeoDataFlyTo &other ) :
0036     GeoDataTourPrimitive( other ), d( new GeoDataFlyToPrivate( *other.d ) )
0037 {
0038 
0039 }
0040 
0041 GeoDataFlyTo &GeoDataFlyTo::operator=( const GeoDataFlyTo &other )
0042 {
0043     GeoDataTourPrimitive::operator=( other );
0044     *d = *other.d;
0045     return *this;
0046 }
0047 
0048 bool GeoDataFlyTo::operator==( const GeoDataFlyTo& other ) const
0049 {
0050     if ( !equals(other) ||
0051          d->m_duration != other.d->m_duration ||
0052          d->m_flyToMode != other.d->m_flyToMode ) {
0053         return false;
0054     }
0055 
0056     if ( (!d->m_view && other.d->m_view) ||
0057          (d->m_view && !other.d->m_view) ) {
0058         return false;
0059     } else if ( !d->m_view && !other.d->m_view ) {
0060         return true;
0061     }
0062 
0063     if (*d->m_view != *other.d->m_view) {
0064         return false;
0065     }
0066 
0067     return true;
0068 }
0069 
0070 bool GeoDataFlyTo::operator!=( const GeoDataFlyTo& other ) const
0071 {
0072     return !this->operator==(other);
0073 }
0074 
0075 GeoDataFlyTo::~GeoDataFlyTo()
0076 {
0077     delete d;
0078 }
0079 
0080 const char *GeoDataFlyTo::nodeType() const
0081 {
0082     return GeoDataTypes::GeoDataFlyToType;
0083 }
0084 
0085 const GeoDataAbstractView *GeoDataFlyTo::view() const
0086 {
0087     return d->m_view;
0088 }
0089 
0090 GeoDataAbstractView *GeoDataFlyTo::view()
0091 {
0092     return d->m_view;
0093 }
0094 
0095 void GeoDataFlyTo::setView( GeoDataAbstractView *view )
0096 {
0097     d->m_view = view;
0098 }
0099 
0100 double GeoDataFlyTo::duration() const
0101 {
0102     return d->m_duration;
0103 }
0104 
0105 void GeoDataFlyTo::setDuration( double duration )
0106 {
0107     d->m_duration = duration;
0108 }
0109 
0110 GeoDataFlyTo::FlyToMode GeoDataFlyTo::flyToMode() const
0111 {
0112     return d->m_flyToMode;
0113 }
0114 
0115 void GeoDataFlyTo::setFlyToMode( const GeoDataFlyTo::FlyToMode flyToMode )
0116 {
0117     d->m_flyToMode = flyToMode;
0118 }
0119 
0120 }