Skip to content
Permalink
Browse files

logic for temporal navigation vcr widget

  • Loading branch information
Samweli authored and nyalldawson committed Mar 6, 2020
1 parent b8959ce commit c119ea55186a9bc3ecfa2de384e65fd610b011b6
@@ -824,6 +824,11 @@
<file>themes/default/mIconModelInput.svg</file>
<file>themes/default/mIndicatorTemporal.svg</file>
<file>themes/default/mIndicatorTimeFromProject.svg</file>
<file>themes/default/temporal_navigation/back.svg</file>
<file>themes/default/temporal_navigation/forward.svg</file>
<file>themes/default/temporal_navigation/next.svg</file>
<file>themes/default/temporal_navigation/stop.svg</file>
<file>themes/default/temporal_navigation/previous.svg</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
@@ -0,0 +1,44 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgstemporalcontroller.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsTemporalController : QObject
{
%Docstring


.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgstemporalcontroller.h"
%End
public:

QgsTemporalController();
%Docstring
Constructor for QgsTemporalController.
%End

virtual ~QgsTemporalController();

signals:
void updateTemporalRange( const QgsDateTimeRange &range );

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgstemporalcontroller.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -0,0 +1,134 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgstemporalnavigationobject.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsTemporalNavigationObject : QgsTemporalController
{
%Docstring
The QgsTemporalNavigationObject class

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgstemporalnavigationobject.h"
%End
public:

QgsTemporalNavigationObject();
%Docstring
Constructor for QgsTemporalNavigationObject
%End

enum NavigationStatus
{
Forward,
BackWard,
Next,
Previous,
Idle
};

enum Mode
{
NearestPreviousProduct,
Snapshot,
Composite
};

void setNavigationStatus( NavigationStatus status );
%Docstring
Sets the current VCR widget navigation status.

.. seealso:: :py:func:`navigationStatus`
%End

NavigationStatus navigationStatus() const;
%Docstring
Returns the current VCR widget navigation status.

.. seealso:: :py:func:`setNavigationStatus`
%End

void setMode( Mode mode );
%Docstring
Sets the current VCR mode.

.. seealso:: :py:func:`mode`
%End

Mode mode() const;
%Docstring
Returns the current VCR mode.

.. seealso:: :py:func:`setMode`
%End

void setIsPlaying( bool playing );
%Docstring
Sets the play status.

.. seealso:: :py:func:`isPlaying`
%End

bool isPlaying() const;
%Docstring
Returns the play status.

.. seealso:: :py:func:`setIsPlaying`
%End

void updateLayersTemporalRange( QDateTime dateTime, QString time, int value );
%Docstring
Updates the project temporal layers with the given ``datetime``.
%End

QDateTime addToDateTime( QDateTime dateTime, QString time, int value );
%Docstring
Returns the datetime after adding time value to the passed ``datetime``.
%End

QgsDateTimeRange rangeFromMode( QgsMapLayer *layer, QDateTime dateTime, QString time, int value );
%Docstring
Returns the calculated temporal range from the current mode.
%End

QDateTime lessNearestDateTime( QList<QDateTime> dateTimes, QDateTime dateTime );
%Docstring
Returns the nearest datetime from the list of ``datetimes`` that is less than
the ``datetime``.
%End

QList<QDateTime> dateTimes() const;
%Docstring
Returns the list of datetimes, which VCR widget will navigate upon.

.. seealso:: :py:func:`setDateTimes`
%End

void setDateTimes( QList<QDateTime> dateTimes );
%Docstring
Sets the list of datetimes, which VCR widget will use to update the
temporal layers.

.. seealso:: :py:func:`dateTimes`
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgstemporalnavigationobject.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -195,6 +195,8 @@
%Include auto_generated/qgsstringutils.sip
%Include auto_generated/qgstablecell.sip
%Include auto_generated/qgstaskmanager.sip
%Include auto_generated/qgstemporalcontroller.sip
%Include auto_generated/qgstemporalnavigationobject.sip
%Include auto_generated/qgstemporalproperty.sip
%Include auto_generated/qgstemporalrangeobject.sip
%Include auto_generated/qgstessellator.sip
@@ -70,6 +70,14 @@ empty string before setLayers() calls can be made.
Gets access to properties used for map rendering

.. versionadded:: 2.4
%End

void setTemporalController( QgsTemporalController *controller );
%Docstring
Sets the temporal controller, this controller will be used to
update the canvas temporal range.

.. versionadded:: 3.14
%End

void setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
@@ -0,0 +1,42 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgstemporalvcrdockwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsTemporalVcrDockWidget : QgsDockWidget
{
%Docstring
The QgsTemporalVcrDockWidget class

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgstemporalvcrdockwidget.h"
%End
public:

QgsTemporalVcrDockWidget( const QString &name, QWidget *parent = 0 );
%Docstring
Constructor for QgsTemporalVcrDockWidget
%End

~QgsTemporalVcrDockWidget();

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgstemporalvcrdockwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -2307,6 +2307,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QgsBrowserDockWidget *mBrowserWidget = nullptr;
QgsBrowserDockWidget *mBrowserWidget2 = nullptr;

QgsTemporalVcrDockWidget *mTemporalVcrWidget = nullptr;

QgsAdvancedDigitizingDockWidget *mAdvancedDigitizingDockWidget = nullptr;
QgsStatisticalSummaryDockWidget *mStatisticalSummaryDockWidget = nullptr;
QgsBookmarks *mBookMarksDockWidget = nullptr;
@@ -32,6 +32,7 @@

class CORE_EXPORT QgsTemporalController : public QObject
{
Q_OBJECT

public:

@@ -61,14 +61,10 @@ void QgsTemporalNavigationObject::updateLayersTemporalRange( QDateTime datetime,
currentLayer = it.value();
if ( !mPlayActive )
break;
if ( currentLayer->type() == QgsMapLayerType::RasterLayer &&
currentLayer->dataProvider() &&
currentLayer->dataProvider()->temporalCapabilities() )
if ( currentLayer->type() == QgsMapLayerType::RasterLayer )
{
QgsRasterLayer *rasterLayer = qobject_cast<QgsRasterLayer *>( currentLayer );
if ( rasterLayer && rasterLayer->dataProvider() &&
rasterLayer->dataProvider()->temporalCapabilities() &&
rasterLayer->dataProvider()->temporalCapabilities()->isActive() )
if ( rasterLayer && rasterLayer->temporalProperties() )
{
QgsDateTimeRange range = rangeFromMode( rasterLayer, datetime, time, value );
if ( range.begin().isValid() && range.end().isValid() )
@@ -504,6 +504,7 @@ SET(QGIS_GUI_SRCS
qgstabwidget.cpp
qgstablewidgetitem.cpp
qgstaskmanagerwidget.cpp
qgstemporalvcrdockwidget.cpp
qgstextformatwidget.cpp
qgstextpreview.cpp
qgstreewidgetitem.cpp
@@ -724,6 +725,7 @@ SET(QGIS_GUI_HDRS
qgstablewidgetitem.h
qgstabwidget.h
qgstaskmanagerwidget.h
qgstemporalvcrdockwidget.h
qgstextformatwidget.h
qgstextpreview.h
qgstreewidgetitem.h
@@ -416,14 +416,14 @@ void QgsMapCanvas::setDestinationCrs( const QgsCoordinateReferenceSystem &crs )
emit destinationCrsChanged();
}

void QgsMapCanvas::setTemporalController( const QgsTemporalController &controller )
void QgsMapCanvas::setTemporalController( QgsTemporalController *controller )
{
mController = controller;

connect( mController, SIGNAL( updateTemporalRange( const QgsDateTimeRange & ), this, SLOT( updateTemporalRange( const QgsDateTimeRange & ) );
connect( mController, &QgsTemporalController::updateTemporalRange, this, &QgsMapCanvas::updateTemporalRange );
}

void QgsMapCanvas::setMapSettingsFlags( QgsMapSettings::Flags flags )
void QgsMapCanvas::setMapSettingsFlags( QgsMapSettings::Flags flags )
{
mSettings.setFlags( flags );
clearCache();
@@ -2470,6 +2470,12 @@ const QgsLabelingEngineSettings &QgsMapCanvas::labelingEngineSettings() const
return mSettings.labelingEngineSettings();
}

void QgsMapCanvas::updateTemporalRange( const QgsDateTimeRange &range )
{
mSettings.setTemporalRange( range );
autoRefreshTriggered();
}

void QgsMapCanvas::startPreviewJobs()
{
stopPreviewJobs(); //just in case still running
@@ -1020,6 +1020,12 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! owns pixmap with rendered map and controls rendering
QgsMapCanvasMap *mMap = nullptr;

/**
* Temporal controller for tracking update of temporal objects
* which relates with canvas
*/
QgsTemporalController *mController = nullptr;

//! Flag indicating if the map canvas is frozen.
bool mFrozen = false;

0 comments on commit c119ea5

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