mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Offset curve: snap to background layers in mouse move
This commit is contained in:
parent
68b251fa02
commit
d7941b1dea
@ -151,10 +151,30 @@ void QgsMapToolOffsetCurve::canvasMoveEvent( QMouseEvent * e )
|
||||
|
||||
//get offset from current position rectangular to feature
|
||||
QgsPoint layerCoords = toLayerCoordinates( layer, e->pos() );
|
||||
|
||||
//snap cursor to background layers
|
||||
QList<QgsSnappingResult> results;
|
||||
QList<QgsPoint> snapExcludePoints;
|
||||
if ( mSnapper.snapToBackgroundLayers( e->pos(), results ) == 0 )
|
||||
{
|
||||
if ( results.size() > 0 )
|
||||
{
|
||||
QgsSnappingResult snap = results.at( 0 );
|
||||
if ( snap.layer && snap.layer->id() != mSourceLayerId && snap.snappedAtGeometry != mModifiedFeature )
|
||||
{
|
||||
layerCoords = results.at( 0 ).snappedVertex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QgsPoint minDistPoint;
|
||||
int beforeVertex;
|
||||
double leftOf;
|
||||
double offset = sqrt( mOriginalGeometry->closestSegmentWithContext( layerCoords, minDistPoint, beforeVertex, &leftOf ) );
|
||||
if ( !offset > 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//create offset geometry using geos
|
||||
setOffsetForRubberBand( offset, leftOf < 0 );
|
||||
@ -239,7 +259,7 @@ void QgsMapToolOffsetCurve::createDistanceItem()
|
||||
mDistanceItem = 0;
|
||||
QgisApp::instance()->statusBar()->addWidget( mDistanceSpinBox );
|
||||
#endif
|
||||
mDistanceSpinBox->grabKeyboard();
|
||||
//mDistanceSpinBox->grabKeyboard();
|
||||
mDistanceSpinBox->setFocus( Qt::TabFocusReason );
|
||||
|
||||
QObject::connect( mDistanceSpinBox, SIGNAL( editingFinished() ), this, SLOT( placeOffsetCurveToValue() ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user