Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Visual snapping when adding first node or starting feature (fix #8300)
  • Loading branch information
3nids committed Jul 16, 2013
1 parent dc489df commit 805be41
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions src/app/qgsmaptoolcapture.cpp
Expand Up @@ -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 );
}
Expand Down

0 comments on commit 805be41

Please sign in to comment.