Skip to content

Commit

Permalink
deprecate methods in qgsvectorlayereditutils. Better deprecated dox.
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Oct 3, 2019
1 parent b75518f commit aa99f89
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 22 deletions.
2 changes: 1 addition & 1 deletion python/core/auto_generated/geometry/qgsgeometry.sip.in
Expand Up @@ -850,7 +850,7 @@ Splits this geometry according to a given line.

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

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0
.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
%End

OperationResult splitGeometry( const QgsPointSequence &splitLine, QVector<QgsGeometry> &newGeometries /Out/, bool topological, QgsPointSequence &topologyTestPoints /Out/ );
Expand Down
10 changes: 5 additions & 5 deletions python/core/auto_generated/qgsvectorlayer.sip.in
Expand Up @@ -1257,7 +1257,7 @@ Adds a ring to polygon/multipolygon features
to the underlying data provider until a commitChanges() call is made. Any uncommitted
changes can be discarded by calling rollBack().

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0
.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
%End


Expand Down Expand Up @@ -1360,7 +1360,7 @@ Adds a new part polygon to a multipart feature
to the underlying data provider until a commitChanges() call is made. Any uncommitted
changes can be discarded by calling rollBack().

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0
.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
%End

QgsGeometry::OperationResult addPart( const QgsPointSequence &ring ) /PyName=addPartV2/;
Expand Down Expand Up @@ -1445,7 +1445,7 @@ Splits parts cut by the given line
to the underlying data provider until a commitChanges() call is made. Any uncommitted
changes can be discarded by calling rollBack().

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0
.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
%End

QgsGeometry::OperationResult splitParts( const QgsPointSequence &splitLine, bool topologicalEditing = false );
Expand Down Expand Up @@ -1495,7 +1495,7 @@ Splits features cut by the given line
to the underlying data provider until a commitChanges() call is made. Any uncommitted
changes can be discarded by calling rollBack().

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0
.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
%End

QgsGeometry::OperationResult splitFeatures( const QgsPointSequence &splitLine, bool topologicalEditing = false );
Expand Down Expand Up @@ -1560,7 +1560,7 @@ editing.
to the underlying data provider until a commitChanges() call is made. Any uncommitted
changes can be discarded by calling rollBack().

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0
.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
%End

int addTopologicalPoints( const QgsPoint &p );
Expand Down
49 changes: 48 additions & 1 deletion python/core/auto_generated/qgsvectorlayereditutils.sip.in
Expand Up @@ -58,6 +58,20 @@ Deletes a vertex from a feature.
:param vertex: index of vertex to delete

.. versionadded:: 2.14
%End

QgsGeometry::OperationResult addRing( const QVector<QgsPointXY> &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = 0 ) /Deprecated/;
%Docstring
Adds a ring to polygon/multipolygon features

:param ring: ring to add
:param targetFeatureIds: if specified, only these features will be the candidates for adding a ring. Otherwise
all intersecting features are tested and the ring is added to the first valid feature.
:param modifiedFeatureId: if specified, feature ID for feature that ring was added to will be stored in this parameter

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

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
%End

QgsGeometry::OperationResult addRing( const QgsPointSequence &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = 0 );
Expand Down Expand Up @@ -88,7 +102,7 @@ Adds a ring to polygon/multipolygon features
available in python bindings as addCurvedRing
%End

QgsGeometry::OperationResult addPart( const QList<QgsPointXY> &ring, QgsFeatureId featureId );
QgsGeometry::OperationResult addPart( const QVector<QgsPointXY> &ring, QgsFeatureId featureId ) /Deprecated/;
%Docstring
Adds a new part polygon to a multipart feature

Expand All @@ -97,6 +111,8 @@ Adds a new part polygon to a multipart feature
- QgsGeometry.AddPartNotMultiGeometry
- QgsGeometry.InvalidBaseGeometry
- QgsGeometry.InvalidInput

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
%End

QgsGeometry::OperationResult addPart( const QgsPointSequence &ring, QgsFeatureId featureId );
Expand Down Expand Up @@ -138,6 +154,24 @@ Translates feature by dx, dy
:param dy: translation of y-coordinate

:return: 0 in case of success
%End

QgsGeometry::OperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) /Deprecated/;
%Docstring
Splits parts cut by the given line

:param splitLine: line that splits the layer feature parts
:param topologicalEditing: ``True`` if topological editing is enabled

:return: - QgsGeometry.InvalidBaseGeometry
- QgsGeometry.Success
- QgsGeometry.InvalidInput
- QgsGeometry.NothingHappened if a selection is present but no feature has been split
- QgsGeometry.InvalidBaseGeometry
- QgsGeometry.GeometryEngineError
- QgsGeometry.SplitCannotSplitPoint

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
%End

QgsGeometry::OperationResult splitParts( const QgsPointSequence &splitLine, bool topologicalEditing = false );
Expand All @@ -156,6 +190,19 @@ Splits parts cut by the given line
- QgsGeometry.SplitCannotSplitPoint
%End

QgsGeometry::OperationResult splitFeatures( const QgsPointSequence &splitLine, bool topologicalEditing = false ) /Deprecated/;
%Docstring
Splits features cut by the given line

:param splitLine: line that splits the layer features
:param topologicalEditing: ``True`` if topological editing is enabled

:return: 0 in case of success,
4 if there is a selection but no feature split

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
%End

QgsGeometry::OperationResult splitFeatures( const QgsPointSequence &splitLine, bool topologicalEditing = false );
%Docstring
Splits features cut by the given line
Expand Down
4 changes: 2 additions & 2 deletions python/gui/auto_generated/qgsmaptoolcapture.sip.in
Expand Up @@ -219,7 +219,7 @@ List of digitized points

:return: List of points

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0
.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant returns QgsPoint objects instead of QgsPointXY.
%End


Expand All @@ -238,7 +238,7 @@ Set the points on which to work

:param pointList: A list of points

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0
.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
%End

void setPoints( const QgsPointSequence &pointList );
Expand Down
2 changes: 1 addition & 1 deletion python/gui/auto_generated/qgsmaptooledit.sip.in
Expand Up @@ -73,7 +73,7 @@ Returns the current vector layer of the map canvas or 0
Adds a list of ``vertices`` to other features to keep topology up to date, e.g. to neighbouring polygons.
The ``vertices`` list specifies a set of topological points to add, in the layer's coordinate reference system.

.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0
.. deprecated:: in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
%End

TopologicalResult addTopologicalPoints( const QVector<QgsPoint> &vertices );
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgsgeometry.h
Expand Up @@ -880,7 +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.12 - will be removed in QGIS 4.0
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
*/
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
10 changes: 5 additions & 5 deletions src/core/qgsvectorlayer.h
Expand Up @@ -1252,7 +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.12 - will be removed in QGIS 4.0
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
*/
Q_DECL_DEPRECATED QgsGeometry::OperationResult addRing( const QVector<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr ) SIP_DEPRECATED;

Expand Down Expand Up @@ -1332,7 +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.12 - will be removed in QGIS 4.0
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
*/
Q_DECL_DEPRECATED QgsGeometry::OperationResult addPart( const QVector<QgsPointXY> &ring ) SIP_PYNAME( addPartV2 ) SIP_DEPRECATED;

Expand Down Expand Up @@ -1393,7 +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.12 - will be removed in QGIS 4.0
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
*/
Q_DECL_DEPRECATED QgsGeometry::OperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;

Expand Down Expand Up @@ -1432,7 +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.12 - will be removed in QGIS 4.0
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
*/
Q_DECL_DEPRECATED QgsGeometry::OperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;

Expand Down Expand Up @@ -1478,7 +1478,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.12 - will be removed in QGIS 4.0
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
*/
Q_DECL_DEPRECATED int addTopologicalPoints( const QgsPointXY &p ) SIP_DEPRECATED;

Expand Down
23 changes: 21 additions & 2 deletions src/core/qgsvectorlayereditutils.cpp
Expand Up @@ -174,10 +174,10 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::addRing( QgsCurve *ring, c
return addRingReturnCode;
}

QgsGeometry::OperationResult QgsVectorLayerEditUtils::addPart( const QList<QgsPointXY> &points, QgsFeatureId featureId )
QgsGeometry::OperationResult QgsVectorLayerEditUtils::addPart( const QVector<QgsPointXY> &points, QgsFeatureId featureId )
{
QgsPointSequence l;
for ( QList<QgsPointXY>::const_iterator it = points.constBegin(); it != points.constEnd(); ++it )
for ( QVector<QgsPointXY>::const_iterator it = points.constBegin(); it != points.constEnd(); ++it )
{
l << QgsPoint( *it );
}
Expand Down Expand Up @@ -274,6 +274,15 @@ int QgsVectorLayerEditUtils::translateFeature( QgsFeatureId featureId, double dx
return errorCode;
}

QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing )
{
QgsPointSequence l;
for ( QVector<QgsPointXY>::const_iterator it = splitLine.constBegin(); it != splitLine.constEnd(); ++it )
{
l << QgsPoint( *it );
}
return splitFeatures( l, topologicalEditing );
}

QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitFeatures( const QgsPointSequence &splitLine, bool topologicalEditing )
{
Expand Down Expand Up @@ -386,6 +395,16 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitFeatures( const QgsPo
return returnCode;
}

QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing )
{
QgsPointSequence l;
for ( QVector<QgsPointXY>::const_iterator it = splitLine.constBegin(); it != splitLine.constEnd(); ++it )
{
l << QgsPoint( *it );
}
return splitParts( l, topologicalEditing );
}

QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QgsPointSequence &splitLine, bool topologicalEditing )
{
if ( !mLayer->isSpatial() )
Expand Down
39 changes: 38 additions & 1 deletion src/core/qgsvectorlayereditutils.h
Expand Up @@ -70,6 +70,17 @@ class CORE_EXPORT QgsVectorLayerEditUtils
*/
QgsVectorLayer::EditResult deleteVertex( QgsFeatureId featureId, int vertex );

/**
* Adds a ring to polygon/multipolygon features
* \param ring ring to add
* \param targetFeatureIds if specified, only these features will be the candidates for adding a ring. Otherwise
* all intersecting features are tested and the ring is added to the first valid feature.
* \param modifiedFeatureId if specified, feature ID for feature that ring was added to will be stored in this parameter
* \return OperationResult result code: success or reason of failure
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
*/
Q_DECL_DEPRECATED QgsGeometry::OperationResult addRing( const QVector<QgsPointXY> &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr ) SIP_DEPRECATED;

/**
* Adds a ring to polygon/multipolygon features
* \param ring ring to add
Expand Down Expand Up @@ -98,8 +109,9 @@ class CORE_EXPORT QgsVectorLayerEditUtils
* - QgsGeometry::AddPartNotMultiGeometry
* - QgsGeometry::InvalidBaseGeometry
* - QgsGeometry::InvalidInput
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
*/
QgsGeometry::OperationResult addPart( const QList<QgsPointXY> &ring, QgsFeatureId featureId );
Q_DECL_DEPRECATED QgsGeometry::OperationResult addPart( const QVector<QgsPointXY> &ring, QgsFeatureId featureId ) SIP_DEPRECATED;

/**
* Adds a new part polygon to a multipart feature
Expand Down Expand Up @@ -135,6 +147,21 @@ class CORE_EXPORT QgsVectorLayerEditUtils
*/
int translateFeature( QgsFeatureId featureId, double dx, double dy );

/**
* Splits parts cut by the given line
* \param splitLine line that splits the layer feature parts
* \param topologicalEditing TRUE if topological editing is enabled
* \returns - QgsGeometry::InvalidBaseGeometry
* - QgsGeometry::Success
* - QgsGeometry::InvalidInput
* - QgsGeometry::NothingHappened if a selection is present but no feature has been split
* - QgsGeometry::InvalidBaseGeometry
* - QgsGeometry::GeometryEngineError
* - QgsGeometry::SplitCannotSplitPoint
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
*/
Q_DECL_DEPRECATED QgsGeometry::OperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;

/**
* Splits parts cut by the given line
* \param splitLine line that splits the layer feature parts
Expand All @@ -149,6 +176,16 @@ class CORE_EXPORT QgsVectorLayerEditUtils
*/
QgsGeometry::OperationResult splitParts( const QgsPointSequence &splitLine, bool topologicalEditing = false );

/**
* Splits features cut by the given line
* \param splitLine line that splits the layer features
* \param topologicalEditing TRUE if topological editing is enabled
* \returns 0 in case of success,
* 4 if there is a selection but no feature split
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
*/
Q_DECL_DEPRECATED QgsGeometry::OperationResult splitFeatures( const QgsPointSequence &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;

/**
* Splits features cut by the given line
* \param splitLine line that splits the layer features
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsmaptoolcapture.h
Expand Up @@ -224,7 +224,7 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
/**
* List of digitized points
* \returns List of points
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant returns QgsPoint objects instead of QgsPointXY.
*/
Q_DECL_DEPRECATED QVector<QgsPointXY> points() const SIP_DEPRECATED;

Expand All @@ -241,7 +241,7 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
* Set the points on which to work
*
* \param pointList A list of points
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
*/
Q_DECL_DEPRECATED void setPoints( const QVector<QgsPointXY> &pointList ) SIP_DEPRECATED;

Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmaptooledit.h
Expand Up @@ -78,7 +78,7 @@ class GUI_EXPORT QgsMapToolEdit: public QgsMapTool
/**
* Adds a list of \a vertices to other features to keep topology up to date, e.g. to neighbouring polygons.
* The \a vertices list specifies a set of topological points to add, in the layer's coordinate reference system.
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0
* \deprecated in QGIS 3.12 - will be removed in QGIS 4.0. Use the variant which accepts QgsPoint objects instead of QgsPointXY.
*/
Q_DECL_DEPRECATED TopologicalResult addTopologicalPoints( const QVector<QgsPointXY> &vertices ) SIP_DEPRECATED;

Expand Down

0 comments on commit aa99f89

Please sign in to comment.