Skip to content
Permalink
Browse files

Merge pull request #1172 from leyan/multiple_snapping

replace list of snapping markers with a single marker
  • Loading branch information
3nids committed Feb 26, 2014
2 parents 2d21b67 + f66c461 commit 6670bfca9a48538e4c9362960070db611d2caa26
Showing with 10 additions and 16 deletions.
  1. +9 −15 src/app/qgsmaptoolcapture.cpp
  2. +1 −1 src/app/qgsmaptoolcapture.h
@@ -51,8 +51,7 @@ QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas* canvas, enum CaptureMode too

QgsMapToolCapture::~QgsMapToolCapture()
{
while ( !mSnappingMarkers.isEmpty() )
delete mSnappingMarkers.takeFirst();
delete mSnappingMarker;

stopCapturing();

@@ -65,8 +64,7 @@ QgsMapToolCapture::~QgsMapToolCapture()

void QgsMapToolCapture::deactivate()
{
while ( !mSnappingMarkers.isEmpty() )
delete mSnappingMarkers.takeFirst();
delete mSnappingMarker;

QgsMapToolEdit::deactivate();
}
@@ -107,18 +105,14 @@ void QgsMapToolCapture::canvasMoveEvent( QMouseEvent * e )
QList<QgsSnappingResult> snapResults;
if ( mSnapper.snapToBackgroundLayers( e->pos(), snapResults ) == 0 )
{
while ( !mSnappingMarkers.isEmpty() )
delete mSnappingMarkers.takeFirst();
delete mSnappingMarker;

mSnappingMarker = new QgsVertexMarker( mCanvas );
mSnappingMarker->setIconType( QgsVertexMarker::ICON_CROSS );
mSnappingMarker->setColor( Qt::magenta );
mSnappingMarker->setPenWidth( 3 );
mSnappingMarker->setCenter( snapPointFromResults(snapResults,e->pos()) );

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

if ( mCaptureMode != CapturePoint && mTempRubberBand && mCapturing )
{
@@ -116,7 +116,7 @@ class APP_EXPORT QgsMapToolCapture : public QgsMapToolEdit

bool mCaptureModeFromLayer;

QList<QgsVertexMarker *> mSnappingMarkers;
QgsVertexMarker* mSnappingMarker;
};

#endif

0 comments on commit 6670bfc

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