Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the Trim/Extend Tool to keep the reference line for multiple trim/extend actions #59676

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/app/qgsmaptooltrimextendfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void QgsMapToolTrimExtendFeature::canvasMoveEvent( QgsMapMouseEvent *e )
if ( mIsIntersection )
{
mRubberBandIntersection.reset( createRubberBand( Qgis::GeometryType::Point ) );
mRubberBandIntersection->addPoint( QgsPointXY( mIntersection ) );
mRubberBandIntersection->addPoint( toMapCoordinates( mVlayer, QgsPointXY( mIntersection ) ) );
mRubberBandIntersection->show();

mRubberBandExtend.reset( createRubberBand( match.layer()->geometryType() ) );
Expand Down Expand Up @@ -194,7 +194,7 @@ void QgsMapToolTrimExtendFeature::canvasMoveEvent( QgsMapMouseEvent *e )
if ( mIsModified )
{
mGeom.removeDuplicateNodes();
mRubberBandExtend->setToGeometry( mGeom );
mRubberBandExtend->setToGeometry( mGeom, mVlayer );
mRubberBandExtend->show();
}
}
Expand Down Expand Up @@ -264,7 +264,10 @@ void QgsMapToolTrimExtendFeature::canvasReleaseEvent( QgsMapMouseEvent *e )
{
emit messageEmitted( tr( "Couldn't trim or extend the feature." ) );
}
deactivate();

// If Ctrl or Shift is pressed, keep the tool active with its reference feature
if ( !( e->modifiers() & ( Qt::ControlModifier | Qt::ShiftModifier ) ) )
deactivate();
break;
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/ui/qgisapp.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,12 @@ Shift+O to turn segments into straight or curve lines.</string>
<property name="text">
<string>Trim/Extend Feature</string>
</property>
<property name="toolTip">
<string>Trim/Extend Feature
- Click to set the reference segment
- Click on another segment to trim it or extend it to the reference segment (Use Shift or Ctrl to keep the reference segment active)
Note : Segment snapping must be enabled in the snapping Toolbar</string>
</property>
</action>
<action name="mActionSnappingOptions">
<property name="text">
Expand Down
Loading
Loading