Skip to content
Permalink
Browse files

Merge pull request #740 from 3nids/snapfirstnode

Visual snapping when adding first node or starting feature (fix #8300)
  • Loading branch information
NathanW2 committed Jul 16, 2013
2 parents dc489df + 805be41 commit 6b6742bc74c4cab3d34348407b0a286dc19823d0
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 6b6742b

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