Skip to content

Commit

Permalink
[mesh] mesh frame editing part-2 - start, commit, roll back and cancel (
Browse files Browse the repository at this point in the history
#43982)

[mesh] allows the user of mesh layers to start editing, save, roll back or cancel editing, in the same way as vector layers (editing part-2)
  • Loading branch information
vcloarec authored Jul 1, 2021
1 parent 174d5ee commit db21851
Show file tree
Hide file tree
Showing 34 changed files with 955 additions and 169 deletions.
30 changes: 30 additions & 0 deletions python/core/auto_generated/mesh/qgsmeshdataprovider.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ Returns number of edges in the native mesh
Populates the mesh vertices, edges and faces

.. versionadded:: 3.6
%End

virtual bool saveMeshFrame( const QgsMesh &mesh ) = 0;
%Docstring
Saves the ``mesh`` frame to the source.

:param mesh: the mesh to save

:return: ``True`` on success


.. versionadded:: 3.22
%End
};

Expand Down Expand Up @@ -412,6 +424,24 @@ Sets the temporal unit of the provider and reload data if it changes.
.. versionadded:: 3.14
%End


virtual QgsMeshDriverMetadata driverMetadata() const;
%Docstring
Returns the mesh driver metadata of the provider

:return: the mesh driver metadata of the provider

.. versionadded:: 3.22
%End


virtual void close() = 0;
%Docstring
Closes the data provider and free every resources used

.. versionadded:: 3.22
%End

signals:
void datasetGroupsAdded( int count );
%Docstring
Expand Down
10 changes: 10 additions & 0 deletions python/core/auto_generated/mesh/qgsmesheditor.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ If removing these vertices leads to a topological errors, the method will return
void stopEditing();
%Docstring
Stops editing
%End

QgsRectangle extent() const;
%Docstring
Returns the extent of the edited mesh
%End

bool isModified() const;
%Docstring
Returns whether the mesh has been modified
%End

signals:
Expand Down
45 changes: 43 additions & 2 deletions python/core/auto_generated/mesh/qgsmeshlayer.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ QgsMeshLayer cannot be copied.

virtual QString htmlMetadata() const;

virtual bool isEditable() const;

virtual bool supportsEditing() const;


QString providerType() const;
%Docstring
Expand Down Expand Up @@ -713,6 +717,28 @@ Returns the relative time (in milliseconds) of the dataset from the reference ti
Starts edition of the mesh frame. Coordinate ``transform`` used to initialize the triangular mesh if needed.
This operation will disconnect the mesh layer from the data provider anf removes all existing dataset group

.. versionadded:: 3.22
%End

bool commitFrameEditing( const QgsCoordinateTransform &transform, bool continueEditing = true );
%Docstring
Commits edition of the mesh frame,
Rebuilds the triangular mesh and its spatial index with ``transform``,
Continue editing with the same mesh editor if ``continueEditing`` is True

:return: ``True`` if the commit succeeds

.. versionadded:: 3.22
%End

bool rollBackFrameEditing( const QgsCoordinateTransform &transform, bool continueEditing = true );
%Docstring
Rolls Back edition of the mesh frame.
Reload mesh from file, rebuilds the triangular mesh and its spatial index with ``transform``,
Continue editing with the same mesh editor if ``continueEditing`` is ``True``

:return: ``True`` if the rollback succeeds

.. versionadded:: 3.22
%End

Expand All @@ -732,14 +758,29 @@ Returns a pointer to the mesh editor own by the mesh layer
.. versionadded:: 3.22
%End

int meshVerticesCount() const;
virtual bool isModified() const;

%Docstring
Returns whether the mesh frame has been modified since the last save

.. versionadded:: 3.22
%End

bool contains( const QgsMesh::ElementType &type ) const;
%Docstring
Returns whether the mesh contains at mesh elements of given type

.. versionadded:: 3.22
%End

int meshVertexCount() const;
%Docstring
Returns the vertices count of the mesh frame

.. versionadded:: 3.22
%End

int meshFacesCount() const;
int meshFaceCount() const;
%Docstring
Returns the faces count of the mesh frame

Expand Down
45 changes: 45 additions & 0 deletions python/core/auto_generated/qgsmaplayer.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,35 @@ Set the visibility of the given sublayer name.

:param name: sublayer name
:param visible: sublayer visibility
%End

virtual bool supportsEditing() const;
%Docstring
Returns whether the layer supports editing or not.

:return: ``False`` if the layer is read only or the data provider has no editing capabilities.

.. note::

default implementation returns ``False``.

.. versionadded:: 3.22
%End

virtual bool isEditable() const;
%Docstring
Returns ``True`` if the layer can be edited.
%End

virtual bool isModified() const;
%Docstring
Returns ``True`` if the layer has been modified since last commit/save.

.. note::

default implementation returns ``False``.

.. versionadded:: 3.22
%End

virtual bool isSpatial() const;
Expand Down Expand Up @@ -1724,6 +1748,27 @@ Emitted when the validity of this layer changed.
Emitted when a custom property of the layer has been changed or removed.

.. versionadded:: 3.18
%End

void editingStarted();
%Docstring
Emitted when editing on this layer has started.

.. versionadded:: 3.22
%End

void editingStopped();
%Docstring
Emitted when edited changes have been successfully written to the data provider.

.. versionadded:: 3.22
%End

void layerModified();
%Docstring
Emitted when modifications has been done on layer

.. versionadded:: 3.22
%End

protected:
Expand Down
19 changes: 3 additions & 16 deletions python/core/auto_generated/vector/qgsvectorlayer.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -1742,6 +1742,7 @@ Returns ``True`` if this is a geometry layer and ``False`` in case of NoGeometry
%End

virtual bool isModified() const;

%Docstring
Returns ``True`` if the provider has been modified since the last commit
%End
Expand Down Expand Up @@ -1808,7 +1809,8 @@ Makes layer read-only (editing disabled) or not
:return: ``False`` if the layer is in editing yet
%End

bool supportsEditing();
virtual bool supportsEditing() const;

%Docstring
Returns whether the layer supports editing or not

Expand Down Expand Up @@ -2727,11 +2729,6 @@ Emitted when selection was changed
:param selected: Newly selected feature ids
:param deselected: Ids of all features which have previously been selected but are not any more
:param clearAndSelect: In case this is set to ``True``, the old selection was dismissed and the new selection corresponds to selected
%End

void layerModified();
%Docstring
Emitted when modifications has been done on layer
%End

void allowCommitChanged();
Expand All @@ -2749,16 +2746,6 @@ Emitted when the layer is checked for modifications. Use for last-minute additio
void beforeEditingStarted();
%Docstring
Emitted before editing on this layer is started.
%End

void editingStarted();
%Docstring
Emitted when editing on this layer has started.
%End

void editingStopped();
%Docstring
Emitted when edited changes have been successfully written to the data provider.
%End

void beforeCommitChanges( bool stopEditing );
Expand Down
Loading

0 comments on commit db21851

Please sign in to comment.