Skip to content
Permalink
Browse files

Fix snapping

  • Loading branch information
m-kuhn committed Sep 13, 2015
1 parent e281625 commit 1d90f6692d2331323e7eecbfe8c9b62cd1676bdb
Showing with 12 additions and 1 deletion.
  1. +9 −0 src/gui/qgsmaptooladvanceddigitizing.cpp
  2. +3 −1 src/gui/qgsmaptooladvanceddigitizing.h
@@ -34,18 +34,21 @@ QgsMapToolAdvancedDigitizing::~QgsMapToolAdvancedDigitizing()

void QgsMapToolAdvancedDigitizing::canvasPressEvent( QgsMapMouseEvent* e )
{
snap( e );
if ( !mCadDockWidget->canvasPressEvent( e ) )
cadCanvasPressEvent( e );
}

void QgsMapToolAdvancedDigitizing::canvasReleaseEvent( QgsMapMouseEvent* e )
{
snap( e );
if ( !mCadDockWidget->canvasReleaseEvent( e, mCaptureMode == CaptureLine || mCaptureMode == CapturePolygon ) )
cadCanvasReleaseEvent( e );
}

void QgsMapToolAdvancedDigitizing::canvasMoveEvent( QgsMapMouseEvent* e )
{
snap( e );
if ( !mCadDockWidget->canvasMoveEvent( e ) )
cadCanvasMoveEvent( e );
}
@@ -70,3 +73,9 @@ void QgsMapToolAdvancedDigitizing::cadPointChanged( const QgsPoint& point )
fakeEvent.setMapPoint( point );
canvasMoveEvent( &fakeEvent );
}

void QgsMapToolAdvancedDigitizing::snap( QgsMapMouseEvent* e )
{
if ( !mCadDockWidget->cadEnabled() )
e->snapPoint( QgsMapMouseEvent::SnapProjectConfig );
}
@@ -123,7 +123,7 @@ class GUI_EXPORT QgsMapToolAdvancedDigitizing : public QgsMapToolEdit
private slots:
/**
* Is to be called by the cad system whenever a point changes outside of a
* mouse event. E.g. when additional constraints are triggered.
* mouse event. E.g. when additional constraints are toggled.
* The specified point will be used to generate a fake mouse event which will
* be sent as move event to cadCanvasMoveEvent.
*
@@ -133,6 +133,8 @@ class GUI_EXPORT QgsMapToolAdvancedDigitizing : public QgsMapToolEdit

private:
QgsAdvancedDigitizingDockWidget* mCadDockWidget;

void snap( QgsMapMouseEvent* e );
};

#endif // QGSMAPTOOLADVANCEDDIGITIZE_H

0 comments on commit 1d90f66

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