Skip to content

Commit

Permalink
fix dox and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Oct 3, 2019
1 parent 738e052 commit c142145
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions python/core/auto_generated/geometry/qgsgeometry.sip.in
Expand Up @@ -849,6 +849,8 @@ Splits this geometry according to a given line.
\param[out] topologyTestPoints points that need to be tested for topological completeness in the dataset

:return: OperationResult a result code: success or reason of failure

.. deprecated:: in QGIS 3.10 - will be removed in QGIS 4.0
%End

OperationResult splitGeometry( const QgsPointSequence &splitLine, QVector<QgsGeometry> &newGeometries /Out/, bool topological, QgsPointSequence &topologyTestPoints /Out/ );
Expand Down
8 changes: 8 additions & 0 deletions python/core/auto_generated/qgsvectorlayer.sip.in
Expand Up @@ -1256,6 +1256,8 @@ Adds a ring to polygon/multipolygon features
by a call to startEditing(). Changes made to features using this method are not committed
to the underlying data provider until a commitChanges() call is made. Any uncommitted
changes can be discarded by calling rollBack().

.. deprecated:: in QGIS 3.10 - will be removed in QGIS 4.0
%End


Expand Down Expand Up @@ -1357,6 +1359,8 @@ Adds a new part polygon to a multipart feature
by a call to startEditing(). Changes made to features using this method are not committed
to the underlying data provider until a commitChanges() call is made. Any uncommitted
changes can be discarded by calling rollBack().

.. deprecated:: in QGIS 3.10 - will be removed in QGIS 4.0
%End

QgsGeometry::OperationResult addPart( const QgsPointSequence &ring ) /PyName=addPartV2/;
Expand Down Expand Up @@ -1440,6 +1444,8 @@ Splits parts cut by the given line
by a call to startEditing(). Changes made to features using this method are not committed
to the underlying data provider until a commitChanges() call is made. Any uncommitted
changes can be discarded by calling rollBack().

.. deprecated:: in QGIS 3.10 - will be removed in QGIS 4.0
%End

QgsGeometry::OperationResult splitParts( const QgsPointSequence &splitLine, bool topologicalEditing = false );
Expand Down Expand Up @@ -1488,6 +1494,8 @@ Splits features cut by the given line
by a call to startEditing(). Changes made to features using this method are not committed
to the underlying data provider until a commitChanges() call is made. Any uncommitted
changes can be discarded by calling rollBack().

.. deprecated:: in QGIS 3.10 - will be removed in QGIS 4.0
%End

QgsGeometry::OperationResult splitFeatures( const QgsPointSequence &splitLine, bool topologicalEditing = false );
Expand Down
1 change: 1 addition & 0 deletions src/core/geometry/qgsgeometry.h
Expand Up @@ -880,6 +880,7 @@ class CORE_EXPORT QgsGeometry
* \param topological TRUE if topological editing is enabled
* \param[out] topologyTestPoints points that need to be tested for topological completeness in the dataset
* \returns OperationResult a result code: success or reason of failure
* \deprecated in QGIS 3.10 - will be removed in QGIS 4.0
*/
Q_DECL_DEPRECATED OperationResult splitGeometry( const QVector<QgsPointXY> &splitLine, QVector<QgsGeometry> &newGeometries SIP_OUT, bool topological, QVector<QgsPointXY> &topologyTestPoints SIP_OUT ) SIP_DEPRECATED;

Expand Down
4 changes: 4 additions & 0 deletions src/core/qgsvectorlayer.h
Expand Up @@ -1252,6 +1252,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
* by a call to startEditing(). Changes made to features using this method are not committed
* to the underlying data provider until a commitChanges() call is made. Any uncommitted
* changes can be discarded by calling rollBack().
* \deprecated in QGIS 3.10 - will be removed in QGIS 4.0
*/
Q_DECL_DEPRECATED QgsGeometry::OperationResult addRing( const QVector<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr ) SIP_DEPRECATED;

Expand Down Expand Up @@ -1331,6 +1332,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
* by a call to startEditing(). Changes made to features using this method are not committed
* to the underlying data provider until a commitChanges() call is made. Any uncommitted
* changes can be discarded by calling rollBack().
* \deprecated in QGIS 3.10 - will be removed in QGIS 4.0
*/
Q_DECL_DEPRECATED QgsGeometry::OperationResult addPart( const QVector<QgsPointXY> &ring ) SIP_PYNAME( addPartV2 ) SIP_DEPRECATED;

Expand Down Expand Up @@ -1391,6 +1393,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
* by a call to startEditing(). Changes made to features using this method are not committed
* to the underlying data provider until a commitChanges() call is made. Any uncommitted
* changes can be discarded by calling rollBack().
* \deprecated in QGIS 3.10 - will be removed in QGIS 4.0
*/
Q_DECL_DEPRECATED QgsGeometry::OperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;

Expand Down Expand Up @@ -1429,6 +1432,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
* by a call to startEditing(). Changes made to features using this method are not committed
* to the underlying data provider until a commitChanges() call is made. Any uncommitted
* changes can be discarded by calling rollBack().
* \deprecated in QGIS 3.10 - will be removed in QGIS 4.0
*/
Q_DECL_DEPRECATED QgsGeometry::OperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;

Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_provider_ogr_gpkg.py
Expand Up @@ -32,7 +32,7 @@
QgsSettings,
QgsVectorLayer,
QgsVectorLayerExporter,
QgsPoint,
QgsPointXY,
QgsProject,
QgsWkbTypes,
QgsDataProvider,
Expand Down Expand Up @@ -897,7 +897,7 @@ def test_SplitFeature(self):
self.assertTrue(layer.isSpatial())
self.assertEqual([f for f in layer.getFeatures()][0].geometry().asWkt(), 'Polygon ((0 0, 0 1, 1 1, 1 0, 0 0))')
layer.startEditing()
self.assertEqual(layer.splitFeatures([QgsPoint(0.5, 0), QgsPoint(0.5, 1)], 0), 0)
self.assertEqual(layer.splitFeatures([QgsPointXY(0.5, 0), QgsPointXY(0.5, 1)], 0), 0)
self.assertTrue(layer.commitChanges())
self.assertEqual(layer.featureCount(), 2)

Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_provider_ogr_sqlite.py
Expand Up @@ -22,7 +22,7 @@
QgsFeature,
QgsFeatureRequest,
QgsFieldConstraints,
QgsPoint,
QgsPointXY,
NULL,
QgsRectangle)
from qgis.testing import start_app, unittest
Expand Down Expand Up @@ -374,7 +374,7 @@ def test_SplitFeature(self):
self.assertTrue(layer.isSpatial())
self.assertEqual([f for f in layer.getFeatures()][0].geometry().asWkt(), 'Polygon ((0 0, 0 1, 1 1, 1 0, 0 0))')
layer.startEditing()
self.assertEqual(layer.splitFeatures([QgsPoint(0.5, 0), QgsPoint(0.5, 1)], 0), 0)
self.assertEqual(layer.splitFeatures([QgsPointXY(0.5, 0), QgsPointXY(0.5, 1)], 0), 0)
self.assertTrue(layer.commitChanges())
self.assertEqual(layer.featureCount(), 2)

Expand Down

0 comments on commit c142145

Please sign in to comment.