Skip to content
Permalink
Browse files

Visual snapping when adding first node or starting feature (fix #8300)

  • Loading branch information
3nids committed Jul 16, 2013
1 parent dc489df commit 805be41738f2680b5be504db45633de238232eee
Showing with 16 additions and 19 deletions.
  1. +16 −19 src/app/qgsmaptoolcapture.cpp
@@ -105,28 +105,25 @@ void QgsMapToolCapture::currentLayerChanged( QgsMapLayer *layer )

void QgsMapToolCapture::canvasMoveEvent( QMouseEvent * e )
{
if ( mCaptureMode == CapturePoint )
return;

if ( mRubberBand && mCapturing )
QgsPoint mapPoint;
QList<QgsSnappingResult> snapResults;
if ( mSnapper.snapToBackgroundLayers( e->pos(), snapResults ) == 0 )
{
QgsPoint mapPoint;
QList<QgsSnappingResult> snapResults;
if ( mSnapper.snapToBackgroundLayers( e->pos(), snapResults ) == 0 )
while ( !mSnappingMarkers.isEmpty() )
delete mSnappingMarkers.takeFirst();

foreach ( const QgsSnappingResult &r, snapResults )
{
while ( !mSnappingMarkers.isEmpty() )
delete mSnappingMarkers.takeFirst();

foreach ( const QgsSnappingResult &r, snapResults )
{
QgsVertexMarker *m = new QgsVertexMarker( mCanvas );
m->setIconType( QgsVertexMarker::ICON_CROSS );
m->setColor( Qt::green );
m->setPenWidth( 1 );
m->setCenter( r.snappedVertex );
mSnappingMarkers << m;
}
QgsVertexMarker *m = new QgsVertexMarker( mCanvas );
m->setIconType( QgsVertexMarker::ICON_CROSS );
m->setColor( Qt::green );
m->setPenWidth( 2 );
m->setCenter( r.snappedVertex );
mSnappingMarkers << m;
}

if ( mCaptureMode != CapturePoint && mRubberBand && mCapturing )
{
mapPoint = snapPointFromResults( snapResults, e->pos() );
mRubberBand->movePoint( mapPoint );
}

0 comments on commit 805be41

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