Skip to content
Permalink
Browse files

Add shell for QgsVectorDataTemporalCapabilities

Just an API placeholder
  • Loading branch information
nyalldawson committed Mar 13, 2020
1 parent a82c5d0 commit 0a2560ae098a743ff835577913fdd4be07441215
@@ -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;
@@ -626,6 +626,9 @@ from the ``source`` provider.
.. versionadded:: 3.8.1
%End

virtual QgsVectorDataProviderTemporalCapabilities *temporalCapabilities();


signals:

void raiseError( const QString &msg ) const;
@@ -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 *
************************************************************************/
@@ -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
@@ -400,6 +400,7 @@ SET(QGIS_CORE_SRCS
qgsvector.cpp
qgsvector3d.cpp
qgsvectordataprovider.cpp
qgsvectordataprovidertemporalcapabilities.cpp
qgsvectorfilewriter.cpp
qgsvectorfilewritertask.cpp
qgsvectorlayer.cpp
@@ -926,6 +927,7 @@ SET(QGIS_CORE_HDRS
qgsvector.h
qgsvector3d.h
qgsvectordataprovider.h
qgsvectordataprovidertemporalcapabilities.h
qgsvectorfilewriter.h
qgsvectorfilewritertask.h
qgsvectorlayer.h
@@ -39,6 +39,10 @@ class CORE_EXPORT QgsDataProviderTemporalCapabilities
{
sipType = sipType_QgsRasterDataProviderTemporalCapabilities;
}
else if ( dynamic_cast<QgsVectorDataProviderTemporalCapabilities *>( sipCpp ) )
{
sipType = sipType_QgsVectorDataProviderTemporalCapabilities;
}
else
{
sipType = 0;
@@ -37,6 +37,7 @@

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

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

}

QgsVectorDataProviderTemporalCapabilities *QgsVectorDataProvider::temporalCapabilities()
{
return mTemporalCapabilities.get();
}
@@ -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;
@@ -616,6 +617,8 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider, public QgsFeat
*/
virtual void handlePostCloneOperations( QgsVectorDataProvider *source );

QgsVectorDataProviderTemporalCapabilities *temporalCapabilities() override;

signals:

/**
@@ -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;

/**
@@ -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;
}
@@ -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.
You can’t perform that action at this time.