Skip to content
Permalink
Browse files
Promote temporal related enums to enum classes, move to Qgis
  • Loading branch information
nyalldawson committed Sep 9, 2021
1 parent 5f06dd5 commit b8f65cbf01e532efe5d9ce92409780eabe683f0a
Showing with 348 additions and 254 deletions.
  1. +77 −0 python/core/auto_additions/qgis.py
  2. +39 −0 python/core/auto_generated/qgis.sip.in
  3. +2 −11 python/core/auto_generated/raster/qgsrasterdataprovidertemporalcapabilities.sip.in
  4. +4 −11 python/core/auto_generated/raster/qgsrasterlayertemporalproperties.sip.in
  5. +2 −9 python/core/auto_generated/vector/qgsvectordataprovidertemporalcapabilities.sip.in
  6. +8 −20 python/core/auto_generated/vector/qgsvectorlayertemporalproperties.sip.in
  7. +69 −0 src/core/qgis.h
  8. +2 −2 src/core/raster/qgsrasterdataprovidertemporalcapabilities.cpp
  9. +3 −16 src/core/raster/qgsrasterdataprovidertemporalcapabilities.h
  10. +3 −3 src/core/raster/qgsrasterlayerrenderer.cpp
  11. +19 −19 src/core/raster/qgsrasterlayertemporalproperties.cpp
  12. +7 −17 src/core/raster/qgsrasterlayertemporalproperties.h
  13. +2 −2 src/core/vector/qgsvectordataprovidertemporalcapabilities.cpp
  14. +3 −13 src/core/vector/qgsvectordataprovidertemporalcapabilities.h
  15. +41 −41 src/core/vector/qgsvectorlayertemporalproperties.cpp
  16. +11 −31 src/core/vector/qgsvectorlayertemporalproperties.h
  17. +0 −2 src/gui/qgstemporalcontrollerwidget.cpp
  18. +18 −18 src/gui/qgsvectorlayertemporalpropertieswidget.cpp
  19. +6 −6 src/gui/raster/qgsrasterlayertemporalpropertieswidget.cpp
  20. +3 −3 src/providers/arcgisrest/qgsafsprovider.cpp
  21. +1 −1 src/providers/postgres/raster/qgspostgresrasterprovider.cpp
  22. +6 −7 src/providers/wms/qgswmsprovider.cpp
  23. +7 −7 src/providers/wms/qgswmstsettingswidget.cpp
  24. +1 −1 tests/src/app/testqgsattributetable.cpp
  25. +1 −1 tests/src/core/testqgsmaprendererjob.cpp
  26. +3 −3 tests/src/core/testqgsrasterlayer.cpp
  27. +10 −10 tests/src/core/testqgsrasterlayertemporalproperties.cpp
@@ -672,3 +672,80 @@
Qgis.AnnotationItemNodeType.__doc__ = 'Annotation item node types.\n\n.. versionadded:: 3.22\n\n' + '* ``VertexHandle``: ' + Qgis.AnnotationItemNodeType.VertexHandle.__doc__
# --
Qgis.AnnotationItemNodeType.baseClass = Qgis
QgsVectorLayerTemporalProperties.TemporalMode = Qgis.VectorTemporalMode
# monkey patching scoped based enum
QgsVectorLayerTemporalProperties.ModeFixedTemporalRange = Qgis.VectorTemporalMode.FixedTemporalRange
QgsVectorLayerTemporalProperties.ModeFixedTemporalRange.is_monkey_patched = True
QgsVectorLayerTemporalProperties.ModeFixedTemporalRange.__doc__ = "Mode when temporal properties have fixed start and end datetimes."
QgsVectorLayerTemporalProperties.ModeFeatureDateTimeInstantFromField = Qgis.VectorTemporalMode.FeatureDateTimeInstantFromField
QgsVectorLayerTemporalProperties.ModeFeatureDateTimeInstantFromField.is_monkey_patched = True
QgsVectorLayerTemporalProperties.ModeFeatureDateTimeInstantFromField.__doc__ = "Mode when features have a datetime instant taken from a single field"
QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndEndFromFields = Qgis.VectorTemporalMode.FeatureDateTimeStartAndEndFromFields
QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndEndFromFields.is_monkey_patched = True
QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndEndFromFields.__doc__ = "Mode when features have separate fields for start and end times"
QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndDurationFromFields = Qgis.VectorTemporalMode.FeatureDateTimeStartAndDurationFromFields
QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndDurationFromFields.is_monkey_patched = True
QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndDurationFromFields.__doc__ = "Mode when features have a field for start time and a field for event duration"
QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndEndFromExpressions = Qgis.VectorTemporalMode.FeatureDateTimeStartAndEndFromExpressions
QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndEndFromExpressions.is_monkey_patched = True
QgsVectorLayerTemporalProperties.ModeFeatureDateTimeStartAndEndFromExpressions.__doc__ = "Mode when features use expressions for start and end times"
QgsVectorLayerTemporalProperties.ModeRedrawLayerOnly = Qgis.VectorTemporalMode.RedrawLayerOnly
QgsVectorLayerTemporalProperties.ModeRedrawLayerOnly.is_monkey_patched = True
QgsVectorLayerTemporalProperties.ModeRedrawLayerOnly.__doc__ = "Redraw the layer when temporal range changes, but don't apply any filtering. Useful when symbology or rule based renderer expressions depend on the time range."
Qgis.VectorTemporalMode.__doc__ = 'Vector layer temporal feature modes\n\n.. versionadded:: 3.22\n\n' + '* ``ModeFixedTemporalRange``: ' + Qgis.VectorTemporalMode.FixedTemporalRange.__doc__ + '\n' + '* ``ModeFeatureDateTimeInstantFromField``: ' + Qgis.VectorTemporalMode.FeatureDateTimeInstantFromField.__doc__ + '\n' + '* ``ModeFeatureDateTimeStartAndEndFromFields``: ' + Qgis.VectorTemporalMode.FeatureDateTimeStartAndEndFromFields.__doc__ + '\n' + '* ``ModeFeatureDateTimeStartAndDurationFromFields``: ' + Qgis.VectorTemporalMode.FeatureDateTimeStartAndDurationFromFields.__doc__ + '\n' + '* ``ModeFeatureDateTimeStartAndEndFromExpressions``: ' + Qgis.VectorTemporalMode.FeatureDateTimeStartAndEndFromExpressions.__doc__ + '\n' + '* ``ModeRedrawLayerOnly``: ' + Qgis.VectorTemporalMode.RedrawLayerOnly.__doc__
# --
Qgis.VectorTemporalMode.baseClass = Qgis
# monkey patching scoped based enum
Qgis.VectorTemporalLimitMode.IncludeBeginExcludeEnd.__doc__ = "Default mode: include the Begin limit, but exclude the End limit"
Qgis.VectorTemporalLimitMode.IncludeBeginIncludeEnd.__doc__ = "Mode to include both limits of the filtering timeframe"
Qgis.VectorTemporalLimitMode.__doc__ = 'Mode for the handling of the limits of the filtering timeframe for vector features\n\n.. versionadded:: 3.22\n\n' + '* ``IncludeBeginExcludeEnd``: ' + Qgis.VectorTemporalLimitMode.IncludeBeginExcludeEnd.__doc__ + '\n' + '* ``IncludeBeginIncludeEnd``: ' + Qgis.VectorTemporalLimitMode.IncludeBeginIncludeEnd.__doc__
# --
Qgis.VectorTemporalLimitMode.baseClass = Qgis
QgsVectorDataProviderTemporalCapabilities.TemporalMode = Qgis.VectorDataProviderTemporalMode
# monkey patching scoped based enum
QgsVectorDataProviderTemporalCapabilities.ProviderHasFixedTemporalRange = Qgis.VectorDataProviderTemporalMode.HasFixedTemporalRange
QgsVectorDataProviderTemporalCapabilities.ProviderHasFixedTemporalRange.is_monkey_patched = True
QgsVectorDataProviderTemporalCapabilities.ProviderHasFixedTemporalRange.__doc__ = "Entire dataset from provider has a fixed start and end datetime."
QgsVectorDataProviderTemporalCapabilities.ProviderStoresFeatureDateTimeInstantInField = Qgis.VectorDataProviderTemporalMode.StoresFeatureDateTimeInstantInField
QgsVectorDataProviderTemporalCapabilities.ProviderStoresFeatureDateTimeInstantInField.is_monkey_patched = True
QgsVectorDataProviderTemporalCapabilities.ProviderStoresFeatureDateTimeInstantInField.__doc__ = "Dataset has feature datetime instants stored in a single field"
QgsVectorDataProviderTemporalCapabilities.ProviderStoresFeatureDateTimeStartAndEndInSeparateFields = Qgis.VectorDataProviderTemporalMode.StoresFeatureDateTimeStartAndEndInSeparateFields
QgsVectorDataProviderTemporalCapabilities.ProviderStoresFeatureDateTimeStartAndEndInSeparateFields.is_monkey_patched = True
QgsVectorDataProviderTemporalCapabilities.ProviderStoresFeatureDateTimeStartAndEndInSeparateFields.__doc__ = "Dataset stores feature start and end datetimes in separate fields"
Qgis.VectorDataProviderTemporalMode.__doc__ = 'Vector data provider temporal handling modes.\n\n.. versionadded:: 3.22\n\n' + '* ``ProviderHasFixedTemporalRange``: ' + Qgis.VectorDataProviderTemporalMode.HasFixedTemporalRange.__doc__ + '\n' + '* ``ProviderStoresFeatureDateTimeInstantInField``: ' + Qgis.VectorDataProviderTemporalMode.StoresFeatureDateTimeInstantInField.__doc__ + '\n' + '* ``ProviderStoresFeatureDateTimeStartAndEndInSeparateFields``: ' + Qgis.VectorDataProviderTemporalMode.StoresFeatureDateTimeStartAndEndInSeparateFields.__doc__
# --
Qgis.VectorDataProviderTemporalMode.baseClass = Qgis
QgsRasterLayerTemporalProperties.TemporalMode = Qgis.RasterTemporalMode
# monkey patching scoped based enum
QgsRasterLayerTemporalProperties.ModeFixedTemporalRange = Qgis.RasterTemporalMode.FixedTemporalRange
QgsRasterLayerTemporalProperties.ModeFixedTemporalRange.is_monkey_patched = True
QgsRasterLayerTemporalProperties.ModeFixedTemporalRange.__doc__ = "Mode when temporal properties have fixed start and end datetimes."
QgsRasterLayerTemporalProperties.ModeTemporalRangeFromDataProvider = Qgis.RasterTemporalMode.TemporalRangeFromDataProvider
QgsRasterLayerTemporalProperties.ModeTemporalRangeFromDataProvider.is_monkey_patched = True
QgsRasterLayerTemporalProperties.ModeTemporalRangeFromDataProvider.__doc__ = "Mode when raster layer delegates temporal range handling to the dataprovider."
QgsRasterLayerTemporalProperties.ModeRedrawLayerOnly = Qgis.RasterTemporalMode.RedrawLayerOnly
QgsRasterLayerTemporalProperties.ModeRedrawLayerOnly.is_monkey_patched = True
QgsRasterLayerTemporalProperties.ModeRedrawLayerOnly.__doc__ = "Redraw the layer when temporal range changes, but don't apply any filtering. Useful when raster symbology expressions depend on the time range. (since QGIS 3.22)"
Qgis.RasterTemporalMode.__doc__ = 'Raster layer temporal modes\n\n.. versionadded:: 3.22\n\n' + '* ``ModeFixedTemporalRange``: ' + Qgis.RasterTemporalMode.FixedTemporalRange.__doc__ + '\n' + '* ``ModeTemporalRangeFromDataProvider``: ' + Qgis.RasterTemporalMode.TemporalRangeFromDataProvider.__doc__ + '\n' + '* ``ModeRedrawLayerOnly``: ' + Qgis.RasterTemporalMode.RedrawLayerOnly.__doc__
# --
Qgis.RasterTemporalMode.baseClass = Qgis
QgsRasterDataProviderTemporalCapabilities.IntervalHandlingMethod = Qgis.TemporalIntervalMatchMethod
# monkey patching scoped based enum
QgsRasterDataProviderTemporalCapabilities.MatchUsingWholeRange = Qgis.TemporalIntervalMatchMethod.MatchUsingWholeRange
QgsRasterDataProviderTemporalCapabilities.MatchUsingWholeRange.is_monkey_patched = True
QgsRasterDataProviderTemporalCapabilities.MatchUsingWholeRange.__doc__ = "Use an exact match to the whole temporal range"
QgsRasterDataProviderTemporalCapabilities.MatchExactUsingStartOfRange = Qgis.TemporalIntervalMatchMethod.MatchExactUsingStartOfRange
QgsRasterDataProviderTemporalCapabilities.MatchExactUsingStartOfRange.is_monkey_patched = True
QgsRasterDataProviderTemporalCapabilities.MatchExactUsingStartOfRange.__doc__ = "Match the start of the temporal range to a corresponding layer or band, and only use exact matching results"
QgsRasterDataProviderTemporalCapabilities.MatchExactUsingEndOfRange = Qgis.TemporalIntervalMatchMethod.MatchExactUsingEndOfRange
QgsRasterDataProviderTemporalCapabilities.MatchExactUsingEndOfRange.is_monkey_patched = True
QgsRasterDataProviderTemporalCapabilities.MatchExactUsingEndOfRange.__doc__ = "Match the end of the temporal range to a corresponding layer or band, and only use exact matching results"
QgsRasterDataProviderTemporalCapabilities.FindClosestMatchToStartOfRange = Qgis.TemporalIntervalMatchMethod.FindClosestMatchToStartOfRange
QgsRasterDataProviderTemporalCapabilities.FindClosestMatchToStartOfRange.is_monkey_patched = True
QgsRasterDataProviderTemporalCapabilities.FindClosestMatchToStartOfRange.__doc__ = "Match the start of the temporal range to the least previous closest datetime."
QgsRasterDataProviderTemporalCapabilities.FindClosestMatchToEndOfRange = Qgis.TemporalIntervalMatchMethod.FindClosestMatchToEndOfRange
QgsRasterDataProviderTemporalCapabilities.FindClosestMatchToEndOfRange.is_monkey_patched = True
QgsRasterDataProviderTemporalCapabilities.FindClosestMatchToEndOfRange.__doc__ = "Match the end of the temporal range to the least previous closest datetime."
Qgis.TemporalIntervalMatchMethod.__doc__ = 'Method to use when resolving a temporal range to a data provider layer or band.\n\n.. versionadded:: 3.22\n\n' + '* ``MatchUsingWholeRange``: ' + Qgis.TemporalIntervalMatchMethod.MatchUsingWholeRange.__doc__ + '\n' + '* ``MatchExactUsingStartOfRange``: ' + Qgis.TemporalIntervalMatchMethod.MatchExactUsingStartOfRange.__doc__ + '\n' + '* ``MatchExactUsingEndOfRange``: ' + Qgis.TemporalIntervalMatchMethod.MatchExactUsingEndOfRange.__doc__ + '\n' + '* ``FindClosestMatchToStartOfRange``: ' + Qgis.TemporalIntervalMatchMethod.FindClosestMatchToStartOfRange.__doc__ + '\n' + '* ``FindClosestMatchToEndOfRange``: ' + Qgis.TemporalIntervalMatchMethod.FindClosestMatchToEndOfRange.__doc__
# --
Qgis.TemporalIntervalMatchMethod.baseClass = Qgis
@@ -492,6 +492,45 @@ The development version
VertexHandle,
};

enum class VectorTemporalMode
{
FixedTemporalRange,
FeatureDateTimeInstantFromField,
FeatureDateTimeStartAndEndFromFields,
FeatureDateTimeStartAndDurationFromFields,
FeatureDateTimeStartAndEndFromExpressions,
RedrawLayerOnly,
};

enum class VectorTemporalLimitMode
{
IncludeBeginExcludeEnd,
IncludeBeginIncludeEnd,
};

enum class VectorDataProviderTemporalMode
{
HasFixedTemporalRange,
StoresFeatureDateTimeInstantInField,
StoresFeatureDateTimeStartAndEndInSeparateFields,
};

enum class RasterTemporalMode
{
FixedTemporalRange,
TemporalRangeFromDataProvider,
RedrawLayerOnly,
};

enum class TemporalIntervalMatchMethod
{
MatchUsingWholeRange,
MatchExactUsingStartOfRange,
MatchExactUsingEndOfRange,
FindClosestMatchToStartOfRange,
FindClosestMatchToEndOfRange
};

static const double DEFAULT_SEARCH_RADIUS_MM;

static const float DEFAULT_MAPTOPIXEL_THRESHOLD;
@@ -33,24 +33,15 @@ Constructor for :py:class:`QgsRasterDataProviderTemporalProperties`.
The ``enabled`` argument specifies whether the data provider has temporal capabilities.
%End

enum IntervalHandlingMethod
{
MatchUsingWholeRange,
MatchExactUsingStartOfRange,
MatchExactUsingEndOfRange,
FindClosestMatchToStartOfRange,
FindClosestMatchToEndOfRange
};

IntervalHandlingMethod intervalHandlingMethod() const;
Qgis::TemporalIntervalMatchMethod intervalHandlingMethod() const;
%Docstring
Returns the desired method to use when resolving a temporal interval to matching
layers or bands in the data provider.

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

void setIntervalHandlingMethod( IntervalHandlingMethod method );
void setIntervalHandlingMethod( Qgis::TemporalIntervalMatchMethod method );
%Docstring
Sets the desired ``method`` to use when resolving a temporal interval to matching
layers or bands in the data provider.
@@ -35,21 +35,14 @@ The ``enabled`` argument specifies whether the temporal properties are initially
virtual QList< QgsDateTimeRange > allTemporalRanges( QgsMapLayer *layer ) const;


enum TemporalMode
{
ModeFixedTemporalRange,
ModeTemporalRangeFromDataProvider,
ModeRedrawLayerOnly,
};

TemporalMode mode() const;
Qgis::RasterTemporalMode mode() const;
%Docstring
Returns the temporal properties mode.

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

void setMode( TemporalMode mode );
void setMode( Qgis::RasterTemporalMode mode );
%Docstring
Sets the temporal properties ``mode``.

@@ -62,15 +55,15 @@ Sets the temporal properties ``mode``.
Returns flags associated to the temporal property.
%End

QgsRasterDataProviderTemporalCapabilities::IntervalHandlingMethod intervalHandlingMethod() const;
Qgis::TemporalIntervalMatchMethod intervalHandlingMethod() const;
%Docstring
Returns the desired method to use when resolving a temporal interval to matching
layers or bands in the data provider.

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

void setIntervalHandlingMethod( QgsRasterDataProviderTemporalCapabilities::IntervalHandlingMethod method );
void setIntervalHandlingMethod( Qgis::TemporalIntervalMatchMethod method );
%Docstring
Sets the desired ``method`` to use when resolving a temporal interval to matching
layers or bands in the data provider.
@@ -26,28 +26,21 @@ and should only be set by the :py:class:`QgsDataProvider` itself.
%End
public:

enum TemporalMode
{
ProviderHasFixedTemporalRange,
ProviderStoresFeatureDateTimeInstantInField,
ProviderStoresFeatureDateTimeStartAndEndInSeparateFields,
};

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

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

TemporalMode mode() const;
Qgis::VectorDataProviderTemporalMode mode() const;
%Docstring
Returns the temporal properties mode.

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

void setMode( TemporalMode mode );
void setMode( Qgis::VectorDataProviderTemporalMode mode );
%Docstring
Sets the temporal properties ``mode``.

@@ -64,48 +64,36 @@ The ``enabled`` argument specifies whether the temporal properties are initially
virtual bool isVisibleInTemporalRange( const QgsDateTimeRange &range ) const;


enum TemporalMode
{
ModeFixedTemporalRange,
ModeFeatureDateTimeInstantFromField,
ModeFeatureDateTimeStartAndEndFromFields,
ModeFeatureDateTimeStartAndDurationFromFields,
ModeFeatureDateTimeStartAndEndFromExpressions,
ModeRedrawLayerOnly,
};

enum LimitMode
{
ModeIncludeBeginExcludeEnd,
ModeIncludeBeginIncludeEnd,
};

TemporalMode mode() const;
Qgis::VectorTemporalMode mode() const;
%Docstring
Returns the temporal properties mode.

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

void setMode( TemporalMode mode );
void setMode( Qgis::VectorTemporalMode mode );
%Docstring
Sets the temporal properties ``mode``.

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

LimitMode limitMode() const;
Qgis::VectorTemporalLimitMode limitMode() const;
%Docstring
Returns the temporal limit mode (to include or exclude begin/end limits).

.. seealso:: :py:func:`setLimitMode`

.. versionadded:: 3.22
%End

void setLimitMode( LimitMode mode );
void setLimitMode( Qgis::VectorTemporalLimitMode mode );
%Docstring
Sets the temporal ``limit`` mode (to include or exclude begin/end limits).

.. seealso:: :py:func:`limitMode`

.. versionadded:: 3.22
%End

virtual QgsTemporalProperty::Flags flags() const;

0 comments on commit b8f65cb

Please sign in to comment.