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

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