Skip to content

Commit

Permalink
fix(QgsMapToolCapture): Allow snapping point with different crs
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Feb 5, 2025
1 parent e021958 commit 86d2653
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/gui/maptools/qgsmaptoolcapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,6 @@ int QgsMapToolCapture::fetchLayerPoint( const QgsPointLocator::Match &match, Qgs
{
if ( ( match.hasVertex() || match.hasLineEndpoint() ) )
{
if ( sourceLayer->crs() != vlayer->crs() )
{
return 1;
}
QgsFeature f;
QgsFeatureRequest request;
request.setFilterFid( match.featureId() );
Expand All @@ -657,6 +653,7 @@ int QgsMapToolCapture::fetchLayerPoint( const QgsPointLocator::Match &match, Qgs
{
return 2;
}

layerPoint = f.geometry().constGet()->vertexAt( vId );
if ( QgsWkbTypes::hasZ( vlayer->wkbType() ) && !layerPoint.is3D() )
layerPoint.addZValue( defaultZValue() );
Expand All @@ -674,6 +671,10 @@ int QgsMapToolCapture::fetchLayerPoint( const QgsPointLocator::Match &match, Qgs
layerPoint.dropMValue();
}

if ( sourceLayer->crs() != vlayer->crs() )
{
layerPoint = toLayerCoordinates( vlayer, layerPoint );
}
return 0;
}
return 2;
Expand Down

0 comments on commit 86d2653

Please sign in to comment.