Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fixed elevation range per dataset group mode for mesh layers #56977

Merged
merged 8 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion python/PyQt6/core/auto_additions/qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3278,7 +3278,8 @@
# monkey patching scoped based enum
Qgis.MeshElevationMode.FixedElevationRange.__doc__ = "Layer has a fixed elevation range"
Qgis.MeshElevationMode.FromVertices.__doc__ = "Elevation should be taken from mesh vertices"
Qgis.MeshElevationMode.__doc__ = "Mesh layer elevation modes.\n\n.. versionadded:: 3.38\n\n" + '* ``FixedElevationRange``: ' + Qgis.MeshElevationMode.FixedElevationRange.__doc__ + '\n' + '* ``FromVertices``: ' + Qgis.MeshElevationMode.FromVertices.__doc__
Qgis.MeshElevationMode.FixedRangePerGroup.__doc__ = "Layer has a fixed (manually specified) elevation range per group"
Qgis.MeshElevationMode.__doc__ = "Mesh layer elevation modes.\n\n.. versionadded:: 3.38\n\n" + '* ``FixedElevationRange``: ' + Qgis.MeshElevationMode.FixedElevationRange.__doc__ + '\n' + '* ``FromVertices``: ' + Qgis.MeshElevationMode.FromVertices.__doc__ + '\n' + '* ``FixedRangePerGroup``: ' + Qgis.MeshElevationMode.FixedRangePerGroup.__doc__
# --
Qgis.MeshElevationMode.baseClass = Qgis
# monkey patching scoped based enum
Expand Down
11 changes: 11 additions & 0 deletions python/PyQt6/core/auto_generated/mesh/qgsmeshdataset.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@




class QgsMeshDatasetIndex
{
%Docstring(signature="appended")
Expand Down Expand Up @@ -431,6 +432,16 @@ Constructs a valid metadata object
QString name() const;
%Docstring
Returns name of the dataset group
%End

QString parentQuantityName() const;
%Docstring
Returns the name of the dataset's parent quantity, if available.

The quantity can be used to collect dataset groups which represent a single quantity
but at different values (e.g. groups which represent different elevations).

.. versionadded:: 3.38
%End

QString uri() const;
Expand Down
30 changes: 16 additions & 14 deletions python/PyQt6/core/auto_generated/mesh/qgsmeshlayer.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -592,52 +592,54 @@ Dataset index is valid even the temporal properties is inactive. This method is
.. versionadded:: 3.22
%End

QgsMeshDatasetIndex activeScalarDatasetAtTime( const QgsDateTimeRange &timeRange ) const;
QgsMeshDatasetIndex activeScalarDatasetAtTime( const QgsDateTimeRange &timeRange, int group = -1 ) const;
%Docstring
Returns dataset index from active scalar group depending on the time range.
If the temporal properties is not active, return the static dataset

:param timeRange: the time range

:return: dataset index
Since QGIS 3.38, the ``group`` argument can be used to specify a fixed group
to use. If this is not specified, then the active group from the layer's renderer will be used.

.. note::

the returned dataset index depends on the matching method, see :py:func:`~QgsMeshLayer.setTemporalMatchingMethod`


.. versionadded:: 3.14
%End

QgsMeshDatasetIndex activeVectorDatasetAtTime( const QgsDateTimeRange &timeRange ) const;
QgsMeshDatasetIndex activeVectorDatasetAtTime( const QgsDateTimeRange &timeRange, int group = -1 ) const;
%Docstring
Returns dataset index from active vector group depending on the time range
If the temporal properties is not active, return the static dataset

:param timeRange: the time range

:return: dataset index
Since QGIS 3.38, the ``group`` argument can be used to specify a fixed group
to use. If this is not specified, then the active group from the layer's renderer will be used.

.. note::

the returned dataset index depends on the matching method, see :py:func:`~QgsMeshLayer.setTemporalMatchingMethod`


.. versionadded:: 3.14
%End



QgsMeshDatasetIndex staticScalarDatasetIndex() const;
QgsMeshDatasetIndex staticScalarDatasetIndex( int group = -1 ) const;
%Docstring
Returns the static scalar dataset index that is rendered if the temporal properties is not active
Returns the static scalar dataset index that is rendered if the temporal properties is not active.

Since QGIS 3.38, the ``group`` argument can be used to specify a fixed group
to use. If this is not specified, then the active group from the layer's renderer will be used.

.. versionadded:: 3.14
%End

QgsMeshDatasetIndex staticVectorDatasetIndex() const;
QgsMeshDatasetIndex staticVectorDatasetIndex( int group = -1 ) const;
%Docstring
Returns the static vector dataset index that is rendered if the temporal properties is not active
Returns the static vector dataset index that is rendered if the temporal properties is not active.

Since QGIS 3.38, the ``group`` argument can be used to specify a fixed group
to use. If this is not specified, then the active group from the layer's renderer will be used.

.. versionadded:: 3.14
%End
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,42 @@ Sets the fixed elevation ``range`` for the mesh.

.. seealso:: :py:func:`fixedRange`

.. versionadded:: 3.38
%End

QMap<int, QgsDoubleRange> fixedRangePerGroup() const;
%Docstring
Returns the fixed elevation range for each group.

.. note::

This is only considered when :py:func:`~QgsMeshLayerElevationProperties.mode` is :py:class:`Qgis`.MeshElevationMode.FixedRangePerGroup.

.. note::

When a fixed range is set any :py:func:`~QgsMeshLayerElevationProperties.zOffset` and :py:func:`~QgsMeshLayerElevationProperties.zScale` is ignored.


.. seealso:: :py:func:`setFixedRangePerGroup`

.. versionadded:: 3.38
%End

void setFixedRangePerGroup( const QMap<int, QgsDoubleRange> &ranges );
%Docstring
Sets the fixed elevation range for each group.

.. note::

This is only considered when :py:func:`~QgsMeshLayerElevationProperties.mode` is :py:class:`Qgis`.MeshElevationMode.FixedRangePerGroup.

.. note::

When a fixed range is set any :py:func:`~QgsMeshLayerElevationProperties.zOffset` and :py:func:`~QgsMeshLayerElevationProperties.zScale` is ignored.


.. seealso:: :py:func:`fixedRangePerGroup`

.. versionadded:: 3.38
%End

Expand Down
3 changes: 2 additions & 1 deletion python/PyQt6/core/auto_generated/qgis.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,8 @@ The development version
enum class MeshElevationMode /BaseType=IntEnum/
{
FixedElevationRange,
FromVertices
FromVertices,
FixedRangePerGroup,
};

enum class BetweenLineConstraint /BaseType=IntEnum/
Expand Down
3 changes: 2 additions & 1 deletion python/core/auto_additions/qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3223,7 +3223,8 @@
# monkey patching scoped based enum
Qgis.MeshElevationMode.FixedElevationRange.__doc__ = "Layer has a fixed elevation range"
Qgis.MeshElevationMode.FromVertices.__doc__ = "Elevation should be taken from mesh vertices"
Qgis.MeshElevationMode.__doc__ = "Mesh layer elevation modes.\n\n.. versionadded:: 3.38\n\n" + '* ``FixedElevationRange``: ' + Qgis.MeshElevationMode.FixedElevationRange.__doc__ + '\n' + '* ``FromVertices``: ' + Qgis.MeshElevationMode.FromVertices.__doc__
Qgis.MeshElevationMode.FixedRangePerGroup.__doc__ = "Layer has a fixed (manually specified) elevation range per group"
Qgis.MeshElevationMode.__doc__ = "Mesh layer elevation modes.\n\n.. versionadded:: 3.38\n\n" + '* ``FixedElevationRange``: ' + Qgis.MeshElevationMode.FixedElevationRange.__doc__ + '\n' + '* ``FromVertices``: ' + Qgis.MeshElevationMode.FromVertices.__doc__ + '\n' + '* ``FixedRangePerGroup``: ' + Qgis.MeshElevationMode.FixedRangePerGroup.__doc__
# --
Qgis.MeshElevationMode.baseClass = Qgis
# monkey patching scoped based enum
Expand Down
11 changes: 11 additions & 0 deletions python/core/auto_generated/mesh/qgsmeshdataset.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@




class QgsMeshDatasetIndex
{
%Docstring(signature="appended")
Expand Down Expand Up @@ -431,6 +432,16 @@ Constructs a valid metadata object
QString name() const;
%Docstring
Returns name of the dataset group
%End

QString parentQuantityName() const;
%Docstring
Returns the name of the dataset's parent quantity, if available.

The quantity can be used to collect dataset groups which represent a single quantity
but at different values (e.g. groups which represent different elevations).

.. versionadded:: 3.38
%End

QString uri() const;
Expand Down
30 changes: 16 additions & 14 deletions python/core/auto_generated/mesh/qgsmeshlayer.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -592,52 +592,54 @@ Dataset index is valid even the temporal properties is inactive. This method is
.. versionadded:: 3.22
%End

QgsMeshDatasetIndex activeScalarDatasetAtTime( const QgsDateTimeRange &timeRange ) const;
QgsMeshDatasetIndex activeScalarDatasetAtTime( const QgsDateTimeRange &timeRange, int group = -1 ) const;
%Docstring
Returns dataset index from active scalar group depending on the time range.
If the temporal properties is not active, return the static dataset

:param timeRange: the time range

:return: dataset index
Since QGIS 3.38, the ``group`` argument can be used to specify a fixed group
to use. If this is not specified, then the active group from the layer's renderer will be used.

.. note::

the returned dataset index depends on the matching method, see :py:func:`~QgsMeshLayer.setTemporalMatchingMethod`


.. versionadded:: 3.14
%End

QgsMeshDatasetIndex activeVectorDatasetAtTime( const QgsDateTimeRange &timeRange ) const;
QgsMeshDatasetIndex activeVectorDatasetAtTime( const QgsDateTimeRange &timeRange, int group = -1 ) const;
%Docstring
Returns dataset index from active vector group depending on the time range
If the temporal properties is not active, return the static dataset

:param timeRange: the time range

:return: dataset index
Since QGIS 3.38, the ``group`` argument can be used to specify a fixed group
to use. If this is not specified, then the active group from the layer's renderer will be used.

.. note::

the returned dataset index depends on the matching method, see :py:func:`~QgsMeshLayer.setTemporalMatchingMethod`


.. versionadded:: 3.14
%End



QgsMeshDatasetIndex staticScalarDatasetIndex() const;
QgsMeshDatasetIndex staticScalarDatasetIndex( int group = -1 ) const;
%Docstring
Returns the static scalar dataset index that is rendered if the temporal properties is not active
Returns the static scalar dataset index that is rendered if the temporal properties is not active.

Since QGIS 3.38, the ``group`` argument can be used to specify a fixed group
to use. If this is not specified, then the active group from the layer's renderer will be used.

.. versionadded:: 3.14
%End

QgsMeshDatasetIndex staticVectorDatasetIndex() const;
QgsMeshDatasetIndex staticVectorDatasetIndex( int group = -1 ) const;
%Docstring
Returns the static vector dataset index that is rendered if the temporal properties is not active
Returns the static vector dataset index that is rendered if the temporal properties is not active.

Since QGIS 3.38, the ``group`` argument can be used to specify a fixed group
to use. If this is not specified, then the active group from the layer's renderer will be used.

.. versionadded:: 3.14
%End
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,42 @@ Sets the fixed elevation ``range`` for the mesh.

.. seealso:: :py:func:`fixedRange`

.. versionadded:: 3.38
%End

QMap<int, QgsDoubleRange> fixedRangePerGroup() const;
%Docstring
Returns the fixed elevation range for each group.

.. note::

This is only considered when :py:func:`~QgsMeshLayerElevationProperties.mode` is :py:class:`Qgis`.MeshElevationMode.FixedRangePerGroup.

.. note::

When a fixed range is set any :py:func:`~QgsMeshLayerElevationProperties.zOffset` and :py:func:`~QgsMeshLayerElevationProperties.zScale` is ignored.


.. seealso:: :py:func:`setFixedRangePerGroup`

.. versionadded:: 3.38
%End

void setFixedRangePerGroup( const QMap<int, QgsDoubleRange> &ranges );
%Docstring
Sets the fixed elevation range for each group.

.. note::

This is only considered when :py:func:`~QgsMeshLayerElevationProperties.mode` is :py:class:`Qgis`.MeshElevationMode.FixedRangePerGroup.

.. note::

When a fixed range is set any :py:func:`~QgsMeshLayerElevationProperties.zOffset` and :py:func:`~QgsMeshLayerElevationProperties.zScale` is ignored.


.. seealso:: :py:func:`fixedRangePerGroup`

.. versionadded:: 3.38
%End

Expand Down
3 changes: 2 additions & 1 deletion python/core/auto_generated/qgis.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,8 @@ The development version
enum class MeshElevationMode
{
FixedElevationRange,
FromVertices
FromVertices,
FixedRangePerGroup,
};

enum class BetweenLineConstraint
Expand Down
13 changes: 13 additions & 0 deletions python/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,19 @@ def render_layout_check(

return result

@staticmethod
def get_test_data_path(file_path: str) -> Path:
"""
Returns the full path to a file contained within the test data
directory.
"""
from utilities import unitTestDataPath

return (
Path(unitTestDataPath()) /
(file_path[1:] if file_path.startswith('/') else file_path)
)

def assertLayersEqual(self, layer_expected, layer_result, **kwargs):
"""
:param layer_expected: The first layer to compare
Expand Down