Skip to content
Permalink
Browse files

Merge pull request #38601 from rduivenvoorde/temporalExtentsChanged_s…

…ignal

Add temporalExtentsChanged signal to QgsTemporalNavigationObject
  • Loading branch information
m-kuhn committed Sep 8, 2020
2 parents e31d4cd + 32b83a1 commit 5e9ac5b79bb6d4dbd40744a18a8a55211265682c
@@ -258,6 +258,8 @@ If the range is empty and ``other`` is not, the range is changed and set to ``ot

bool operator==( const QgsTemporalRange<T> &other ) const;

bool operator!=( const QgsTemporalRange<T> &other ) const;

};


@@ -201,6 +201,11 @@ Emitted whenever the animation ``state`` changes.
void navigationModeChanged( NavigationMode mode );
%Docstring
Emitted whenever the navigation ``mode`` changes.
%End

void temporalExtentsChanged( const QgsDateTimeRange &extent );
%Docstring
Emitted whenever the temporalExtent ``extent`` changes.
%End

public slots:
@@ -458,6 +458,11 @@ class QgsTemporalRange
mIncludeUpper == other.includeEnd();
}

bool operator!=( const QgsTemporalRange<T> &other ) const
{
return ( ! operator==( other ) );
}

private:

T mLower;
@@ -128,17 +128,22 @@ void QgsTemporalNavigationObject::setNavigationMode( const NavigationMode mode )

void QgsTemporalNavigationObject::setTemporalExtents( const QgsDateTimeRange &temporalExtents )
{
if ( mTemporalExtents == temporalExtents )
{
return;
}
mTemporalExtents = temporalExtents;
emit temporalExtentsChanged( mTemporalExtents );

switch ( mNavigationMode )
{
case Animated:
{
int currentFrameNmber = mCurrentFrameNumber;
int currentFrameNumber = mCurrentFrameNumber;
setCurrentFrameNumber( 0 );

//Force to emit signal if the current frame number doesn't change
if ( currentFrameNmber == mCurrentFrameNumber )
if ( currentFrameNumber == mCurrentFrameNumber )
emit updateTemporalRange( dateTimeRangeForFrameNumber( 0 ) );
break;
}
@@ -148,6 +153,7 @@ void QgsTemporalNavigationObject::setTemporalExtents( const QgsDateTimeRange &te
case NavigationOff:
break;
}

}

QgsDateTimeRange QgsTemporalNavigationObject::temporalExtents() const
@@ -217,6 +217,11 @@ class CORE_EXPORT QgsTemporalNavigationObject : public QgsTemporalController, pu
*/
void navigationModeChanged( NavigationMode mode );

/**
* Emitted whenever the temporalExtent \a extent changes.
*/
void temporalExtentsChanged( const QgsDateTimeRange &extent );

public slots:

/**
@@ -52,6 +52,7 @@ QgsTemporalControllerWidget::QgsTemporalControllerWidget( QWidget *parent )

setWidgetStateFromNavigationMode( mNavigationObject->navigationMode() );
connect( mNavigationObject, &QgsTemporalNavigationObject::navigationModeChanged, this, &QgsTemporalControllerWidget::setWidgetStateFromNavigationMode );
connect( mNavigationObject, &QgsTemporalNavigationObject::temporalExtentsChanged, this, &QgsTemporalControllerWidget::setDates );
connect( mNavigationOff, &QPushButton::clicked, this, &QgsTemporalControllerWidget::mNavigationOff_clicked );
connect( mNavigationFixedRange, &QPushButton::clicked, this, &QgsTemporalControllerWidget::mNavigationFixedRange_clicked );
connect( mNavigationAnimated, &QPushButton::clicked, this, &QgsTemporalControllerWidget::mNavigationAnimated_clicked );

0 comments on commit 5e9ac5b

Please sign in to comment.
You can’t perform that action at this time.