Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Oct 3, 2019
1 parent aa99f89 commit 7665451
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 26 deletions.
2 changes: 1 addition & 1 deletion python/core/auto_generated/qgsvectorlayereditutils.sip.in
Expand Up @@ -190,7 +190,7 @@ Splits parts cut by the given line
- QgsGeometry.SplitCannotSplitPoint
%End

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

Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsmaptoolfillring.cpp
Expand Up @@ -129,9 +129,9 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}

QgsLineString ext( pointList );
QgsPolygon polygon;
polygon.setExteriorRing( ext.clone() );
g = QgsGeometry( qgis::make_unique< QgsPolygon >( polygon ) );
std::unique_ptr< QgsPolygon > polygon;
polygon->setExteriorRing( ext.clone() );
g = QgsGeometry( std::move( polygon ) );
}
else
{
Expand Down
28 changes: 7 additions & 21 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -1155,6 +1155,7 @@ bool QgsVectorLayer::deleteSelectedFeatures( int *deletedCount )
static const QgsPointSequence vectorPointXY2pointSequence( const QVector<QgsPointXY> &points )
{
QgsPointSequence pts;
pts.reserve( points.size() );
QVector<const QgsPointXY>::iterator it = points.constBegin();
while ( it != points.constEnd() )
{
Expand Down Expand Up @@ -1231,35 +1232,20 @@ QgsGeometry::OperationResult QgsVectorLayer::addRing( QgsCurve *ring, QgsFeature

QgsGeometry::OperationResult QgsVectorLayer::addPart( const QList<QgsPointXY> &points )
{
if ( !mValid || !mEditBuffer || !mDataProvider )
return QgsGeometry::OperationResult::LayerNotEditable;

//number of selected features must be 1

if ( mSelectedFeatureIds.empty() )
{
QgsDebugMsgLevel( QStringLiteral( "Number of selected features < 1" ), 3 );
return QgsGeometry::OperationResult::SelectionIsEmpty;
}
else if ( mSelectedFeatureIds.size() > 1 )
QgsPointSequence pts;
pts.reserve( points.size() );
for ( QList<QgsPointXY>::const_iterator it = points.constBegin(); it != points.constEnd() ; ++it )
{
QgsDebugMsgLevel( QStringLiteral( "Number of selected features > 1" ), 3 );
return QgsGeometry::OperationResult::SelectionIsGreaterThanOne;
pts.append( QgsPoint( *it ) );
}

QgsVectorLayerEditUtils utils( this );
QgsGeometry::OperationResult result = utils.addPart( points, *mSelectedFeatureIds.constBegin() );

if ( result == QgsGeometry::OperationResult::Success )
updateExtents();
return result;
return addPart( pts );
}

QgsGeometry::OperationResult QgsVectorLayer::addPart( const QVector<QgsPointXY> &points )
{

return addPart( vectorPointXY2pointSequence( points ) );
}

QgsGeometry::OperationResult QgsVectorLayer::addPart( const QgsPointSequence &points )
{
if ( !mValid || !mEditBuffer || !mDataProvider )
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayereditutils.h
Expand Up @@ -184,7 +184,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils
* 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;
Q_DECL_DEPRECATED QgsGeometry::OperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;

/**
* Splits features cut by the given line
Expand Down

0 comments on commit 7665451

Please sign in to comment.