Skip to content

Commit

Permalink
Dox
Browse files Browse the repository at this point in the history
(cherry picked from commit 5603546)
  • Loading branch information
nyalldawson committed Nov 29, 2018
1 parent 61f98ee commit 605bf22
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
18 changes: 18 additions & 0 deletions python/core/auto_generated/qgsfeature.sip.in
Expand Up @@ -333,6 +333,24 @@ Set the feature's geometry. The feature will be valid after.
Set the feature's ``geometry``. Ownership of the geometry is transferred to the feature.
The feature will be made valid after calling this method.

This method is a shortcut for calling:
.. code-block:: python

feature.setGeometry( QgsGeometry( geometry ) )

* Example:
.. code-block:: python

# Sets a feature's geometry to a point geometry
feature.setGeometry( QgsPoint( 210, 41 ) )
print(feature.geometry())
# output: <QgsGeometry: Point (210 41)>

# Sets a feature's geometry to a line string
feature.setGeometry( QgsLineString( [ QgsPoint( 210, 41 ), QgsPoint( 301, 55 ) ] ) )
print(feature.geometry())
# output: <QgsGeometry: LineString (210 41, 301 55)>

.. seealso:: :py:func:`geometry`

.. seealso:: :py:func:`clearGeometry`
Expand Down
19 changes: 19 additions & 0 deletions src/core/qgsfeature.h
Expand Up @@ -349,6 +349,25 @@ class CORE_EXPORT QgsFeature
/**
* Set the feature's \a geometry. Ownership of the geometry is transferred to the feature.
* The feature will be made valid after calling this method.
*
* This method is a shortcut for calling:
* \code{.py}
* feature.setGeometry( QgsGeometry( geometry ) )
* \endcode
*
* * Example:
* \code{.py}
* # Sets a feature's geometry to a point geometry
* feature.setGeometry( QgsPoint( 210, 41 ) )
* print(feature.geometry())
* # output: <QgsGeometry: Point (210 41)>
*
* # Sets a feature's geometry to a line string
* feature.setGeometry( QgsLineString( [ QgsPoint( 210, 41 ), QgsPoint( 301, 55 ) ] ) )
* print(feature.geometry())
* # output: <QgsGeometry: LineString (210 41, 301 55)>
* \endcode
*
* \see geometry()
* \see clearGeometry()
* \since QGIS 3.4.3
Expand Down

0 comments on commit 605bf22

Please sign in to comment.