Skip to content
Permalink
Browse files
replace list of snapping markers with a single marker
  • Loading branch information
leyan committed Feb 14, 2014
1 parent e6c2ecd commit f66c4614c3cbd59fbcf8f378d722e0b31416621d
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 )
{
@@ -119,7 +119,7 @@ class APP_EXPORT QgsMapToolCapture : public QgsMapToolEdit

bool mCaptureModeFromLayer;

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

#endif

0 comments on commit f66c461

Please sign in to comment.