Skip to content

Commit 2fdfed3

Browse files
author
timlinux
committedOct 10, 2008

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed
 

‎src/app/qgsmaptooladdvertex.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ void QgsMapToolAddVertex::canvasReleaseEvent( QMouseEvent * e )
9191

9292
if ( mSnapper.snapToBackgroundLayers( e->pos(), snapResults ) == 0 )
9393
{
94+
95+
//add segment points in case of topological editing
96+
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
97+
if ( topologicalEditing )
98+
{
99+
insertSegmentVerticesForSnap( snapResults, vlayer );
100+
}
101+
94102
snappedPointMapCoord = snapPointFromResults( snapResults, e->pos() );
95103
snappedPointLayerCoord = toLayerCoordinates( vlayer, snappedPointMapCoord );
96104

‎src/core/qgsvectorlayer.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,17 @@ int QgsVectorLayer::addTopologicalPoints( const QgsPoint& p )
19061906

19071907
QList<QgsSnappingResult> filteredSnapResults; //we filter out the results that are on existing vertices
19081908

1909-
const double threshold = 0.00000001;
1909+
//work with a tolerance because coordinate projection may introduce some rounding
1910+
double threshold = 0.0000001;
1911+
if(mCRS && mCRS->mapUnits() == QGis::Meters)
1912+
{
1913+
threshold = 0.001;
1914+
}
1915+
else if(mCRS && mCRS->mapUnits() == QGis::Feet)
1916+
{
1917+
threshold = 0.0001;
1918+
}
1919+
19101920

19111921
if ( snapWithContext( p, threshold, snapResults, QgsSnapper::SNAP_TO_SEGMENT ) != 0 )
19121922
{

0 commit comments

Comments
 (0)
Please sign in to comment.