Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add shell for QgsVectorDataTemporalCapabilities
Just an API placeholder
  • Loading branch information
nyalldawson committed Mar 13, 2020
1 parent a82c5d0 commit 0a2560a
Show file tree
Hide file tree
Showing 10 changed files with 195 additions and 0 deletions.
Expand Up @@ -26,6 +26,10 @@ Base class for handling properties relating to a data provider's temporal capabi
{
sipType = sipType_QgsRasterDataProviderTemporalCapabilities;
}
else if ( dynamic_cast<QgsVectorDataProviderTemporalCapabilities *>( sipCpp ) )
{
sipType = sipType_QgsVectorDataProviderTemporalCapabilities;
}
else
{
sipType = 0;
Expand Down
3 changes: 3 additions & 0 deletions python/core/auto_generated/qgsvectordataprovider.sip.in
Expand Up @@ -626,6 +626,9 @@ from the ``source`` provider.
.. versionadded:: 3.8.1
%End

virtual QgsVectorDataProviderTemporalCapabilities *temporalCapabilities();


signals:

void raiseError( const QString &msg ) const;
Expand Down
@@ -0,0 +1,58 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsvectordataprovidertemporalcapabilities.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsVectorDataProviderTemporalCapabilities : QgsDataProviderTemporalCapabilities
{
%Docstring
Implementation of data provider temporal properties for QgsVectorDataProviders.

Data provider temporal capabilities reflect the temporal capabilities of a QgsDataProvider.
Unlike QgsMapLayerTemporalProperties, these settings are not user-configurable,
and should only be set by the QgsDataProvider itself.

.. versionadded:: 3.14
%End

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

QgsVectorDataProviderTemporalCapabilities( bool enabled = false );
%Docstring
Constructor for QgsVectorDataProviderTemporalCapabilities.

The ``enabled`` argument specifies whether the data provider has temporal capabilities.
%End

void setAvailableTemporalRange( const QgsDateTimeRange &range );
%Docstring
Sets the datetime ``range`` extent from which temporal data is available from the provider.

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

const QgsDateTimeRange &availableTemporalRange() const;
%Docstring
Returns the datetime range extent from which temporal data is available from the provider.

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

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsvectordataprovidertemporalcapabilities.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
1 change: 1 addition & 0 deletions python/core/core_auto.sip
Expand Up @@ -213,6 +213,7 @@
%Include auto_generated/qgsvector.sip
%Include auto_generated/qgsvector3d.sip
%Include auto_generated/qgsvectordataprovider.sip
%Include auto_generated/qgsvectordataprovidertemporalcapabilities.sip
%Include auto_generated/qgsvectorfilewriter.sip
%Include auto_generated/qgsvectorfilewritertask.sip
%Include auto_generated/qgsvectorlayer.sip
Expand Down
2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -400,6 +400,7 @@ SET(QGIS_CORE_SRCS
qgsvector.cpp
qgsvector3d.cpp
qgsvectordataprovider.cpp
qgsvectordataprovidertemporalcapabilities.cpp
qgsvectorfilewriter.cpp
qgsvectorfilewritertask.cpp
qgsvectorlayer.cpp
Expand Down Expand Up @@ -926,6 +927,7 @@ SET(QGIS_CORE_HDRS
qgsvector.h
qgsvector3d.h
qgsvectordataprovider.h
qgsvectordataprovidertemporalcapabilities.h
qgsvectorfilewriter.h
qgsvectorfilewritertask.h
qgsvectorlayer.h
Expand Down
4 changes: 4 additions & 0 deletions src/core/qgsdataprovidertemporalcapabilities.h
Expand Up @@ -39,6 +39,10 @@ class CORE_EXPORT QgsDataProviderTemporalCapabilities
{
sipType = sipType_QgsRasterDataProviderTemporalCapabilities;
}
else if ( dynamic_cast<QgsVectorDataProviderTemporalCapabilities *>( sipCpp ) )
{
sipType = sipType_QgsVectorDataProviderTemporalCapabilities;
}
else
{
sipType = 0;
Expand Down
6 changes: 6 additions & 0 deletions src/core/qgsvectordataprovider.cpp
Expand Up @@ -37,6 +37,7 @@

QgsVectorDataProvider::QgsVectorDataProvider( const QString &uri, const ProviderOptions &options )
: QgsDataProvider( uri, options )
, mTemporalCapabilities( qgis::make_unique< QgsVectorDataProviderTemporalCapabilities >() )
{
}

Expand Down Expand Up @@ -840,3 +841,8 @@ void QgsVectorDataProvider::handlePostCloneOperations( QgsVectorDataProvider * )
{

}

QgsVectorDataProviderTemporalCapabilities *QgsVectorDataProvider::temporalCapabilities()
{
return mTemporalCapabilities.get();
}
5 changes: 5 additions & 0 deletions src/core/qgsvectordataprovider.h
Expand Up @@ -33,6 +33,7 @@ class QTextCodec;
#include "qgsfeaturesink.h"
#include "qgsfeaturesource.h"
#include "qgsfeaturerequest.h"
#include "qgsvectordataprovidertemporalcapabilities.h"

typedef QList<int> QgsAttributeList SIP_SKIP;
typedef QSet<int> QgsAttributeIds SIP_SKIP;
Expand Down Expand Up @@ -616,6 +617,8 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider, public QgsFeat
*/
virtual void handlePostCloneOperations( QgsVectorDataProvider *source );

QgsVectorDataProviderTemporalCapabilities *temporalCapabilities() override;

signals:

/**
Expand Down Expand Up @@ -686,6 +689,8 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider, public QgsFeat
//! List of errors
mutable QStringList mErrors;

std::unique_ptr< QgsVectorDataProviderTemporalCapabilities > mTemporalCapabilities;

static QStringList sEncodings;

/**
Expand Down
36 changes: 36 additions & 0 deletions src/core/qgsvectordataprovidertemporalcapabilities.cpp
@@ -0,0 +1,36 @@
/***************************************************************************
qgsvectordataprovidertemporalcapabilities.cpp
---------------
begin : March 2020
copyright : (C) 2020 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsvectordataprovidertemporalcapabilities.h"

QgsVectorDataProviderTemporalCapabilities::QgsVectorDataProviderTemporalCapabilities( bool enabled )
: QgsDataProviderTemporalCapabilities( enabled )
{
}

void QgsVectorDataProviderTemporalCapabilities::setAvailableTemporalRange( const QgsDateTimeRange &dateTimeRange )
{
if ( !hasTemporalCapabilities() )
setHasTemporalCapabilities( true );

mAvailableTemporalRange = dateTimeRange;
}

const QgsDateTimeRange &QgsVectorDataProviderTemporalCapabilities::availableTemporalRange() const
{
return mAvailableTemporalRange;
}
76 changes: 76 additions & 0 deletions src/core/qgsvectordataprovidertemporalcapabilities.h
@@ -0,0 +1,76 @@
/***************************************************************************
qgsvectordataprovidertemporalcapabilities.h
---------------
begin : March 2020
copyright : (C) 2020 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSVECTORDATAPROVIDERTEMPORALCAPABILITIES_H
#define QGSVECTORDATAPROVIDERTEMPORALCAPABILITIES_H

#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgsrange.h"
#include "qgsdataprovidertemporalcapabilities.h"

/**
* \class QgsVectorDataProviderTemporalCapabilities
* \ingroup core
* Implementation of data provider temporal properties for QgsVectorDataProviders.
*
* Data provider temporal capabilities reflect the temporal capabilities of a QgsDataProvider.
* Unlike QgsMapLayerTemporalProperties, these settings are not user-configurable,
* and should only be set by the QgsDataProvider itself.
*
* \since QGIS 3.14
*/
class CORE_EXPORT QgsVectorDataProviderTemporalCapabilities : public QgsDataProviderTemporalCapabilities
{
public:

/**
* Constructor for QgsVectorDataProviderTemporalCapabilities.
*
* The \a enabled argument specifies whether the data provider has temporal capabilities.
*/
QgsVectorDataProviderTemporalCapabilities( bool enabled = false );

/**
* Sets the datetime \a range extent from which temporal data is available from the provider.
*
* \see availableTemporalRange()
*/
void setAvailableTemporalRange( const QgsDateTimeRange &range );

/**
* Returns the datetime range extent from which temporal data is available from the provider.
*
* \see setAvailableTemporalRange()
*/
const QgsDateTimeRange &availableTemporalRange() const;

private:

/**
* Represents available data provider datetime range.
*
* This is for determining the providers lower and upper datetime bounds,
* any updates on the mRange should get out the range bound defined
* by this member.
*
*/
QgsDateTimeRange mAvailableTemporalRange;

};

#endif // QGSVECTORDATAPROVIDERTEMPORALCAPABILITIES_H

0 comments on commit 0a2560a

Please sign in to comment.