Skip to content
Permalink
Browse files

Merge pull request #1128 from 3nids/removesnapsegment

allow snapping to vertex and segment to remove part/ring
  • Loading branch information
3nids committed Feb 25, 2014
2 parents 881b1cc + 9021b37 commit d790bc0b1eadb4c553e7603a5b9eace205e57cd7
Showing with 14 additions and 5 deletions.
  1. +7 −2 src/app/qgsmaptooldeletepart.cpp
  2. +7 −3 src/app/qgsmaptooldeletering.cpp
@@ -45,7 +45,7 @@ void QgsMapToolDeletePart::canvasPressEvent( QMouseEvent *e )

mRecentSnappingResults.clear();
//do snap -> new recent snapping results
if ( mSnapper.snapToCurrentLayer( e->pos(), mRecentSnappingResults, QgsSnapper::SnapToVertex ) != 0 )
if ( mSnapper.snapToCurrentLayer( e->pos(), mRecentSnappingResults, QgsSnapper::SnapToVertexAndSegment ) != 0 )
{
//error
}
@@ -84,7 +84,12 @@ void QgsMapToolDeletePart::canvasReleaseEvent( QMouseEvent *e )
QList<QgsSnappingResult>::iterator sr_it = mRecentSnappingResults.begin();
for ( ; sr_it != mRecentSnappingResults.end(); ++sr_it )
{
deletePart( sr_it->snappedAtGeometry, sr_it->snappedVertexNr, vlayer );
if ( sr_it->snappedVertexNr != -1 )
deletePart( sr_it->snappedAtGeometry, sr_it->snappedVertexNr, vlayer );
else if ( sr_it->beforeVertexNr != -1 )
deletePart( sr_it->snappedAtGeometry, sr_it->beforeVertexNr, vlayer );
else if ( sr_it->afterVertexNr != -1 )
deletePart( sr_it->snappedAtGeometry, sr_it->afterVertexNr, vlayer );
}
}

@@ -45,7 +45,7 @@ void QgsMapToolDeleteRing::canvasPressEvent( QMouseEvent *e )

mRecentSnappingResults.clear();
//do snap -> new recent snapping results
if ( mSnapper.snapToCurrentLayer( e->pos(), mRecentSnappingResults, QgsSnapper::SnapToVertex ) != 0 )
if ( mSnapper.snapToCurrentLayer( e->pos(), mRecentSnappingResults, QgsSnapper::SnapToVertexAndSegment ) != 0 )
{
//error
}
@@ -85,12 +85,16 @@ void QgsMapToolDeleteRing::canvasReleaseEvent( QMouseEvent *e )
QList<QgsSnappingResult>::iterator sr_it = mRecentSnappingResults.begin();
for ( ; sr_it != mRecentSnappingResults.end(); ++sr_it )
{
deleteRing( sr_it->snappedAtGeometry, sr_it->snappedVertexNr, vlayer );
if ( sr_it->snappedVertexNr != -1 )
deleteRing( sr_it->snappedAtGeometry, sr_it->snappedVertexNr, vlayer );
else if ( sr_it->beforeVertexNr != -1 )
deleteRing( sr_it->snappedAtGeometry, sr_it->beforeVertexNr, vlayer );
else if ( sr_it->afterVertexNr != -1 )
deleteRing( sr_it->snappedAtGeometry, sr_it->afterVertexNr, vlayer );
}
}
}


void QgsMapToolDeleteRing::deleteRing( QgsFeatureId fId, int beforeVertexNr, QgsVectorLayer* vlayer )
{
QgsFeature f;

0 comments on commit d790bc0

Please sign in to comment.
You can’t perform that action at this time.