[QGIS Commit] r9473 - in trunk/qgis/src: app core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Oct 10 17:36:34 EDT 2008


Author: timlinux
Date: 2008-10-10 17:36:34 -0400 (Fri, 10 Oct 2008)
New Revision: 9473

Modified:
   trunk/qgis/src/app/qgsmaptooladdvertex.cpp
   trunk/qgis/src/core/qgsvectorlayer.cpp
Log:
More topological editing fixes from Marco

Modified: trunk/qgis/src/app/qgsmaptooladdvertex.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptooladdvertex.cpp	2008-10-10 21:32:40 UTC (rev 9472)
+++ trunk/qgis/src/app/qgsmaptooladdvertex.cpp	2008-10-10 21:36:34 UTC (rev 9473)
@@ -91,6 +91,14 @@
 
     if ( mSnapper.snapToBackgroundLayers( e->pos(), snapResults ) == 0 )
     {
+
+      //add segment points in case of topological editing
+      int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
+      if ( topologicalEditing )
+	{
+	  insertSegmentVerticesForSnap( snapResults, vlayer );
+	}
+
       snappedPointMapCoord = snapPointFromResults( snapResults, e->pos() );
       snappedPointLayerCoord = toLayerCoordinates( vlayer, snappedPointMapCoord );
 

Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp	2008-10-10 21:32:40 UTC (rev 9472)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp	2008-10-10 21:36:34 UTC (rev 9473)
@@ -1906,7 +1906,17 @@
 
   QList<QgsSnappingResult> filteredSnapResults; //we filter out the results that are on existing vertices
 
-  const double threshold = 0.00000001;
+  //work with a tolerance because coordinate projection may introduce some rounding
+  double threshold =  0.0000001;
+  if(mCRS && mCRS->mapUnits() == QGis::Meters)
+    {
+      threshold = 0.001; 
+    }
+  else if(mCRS && mCRS->mapUnits() == QGis::Feet)
+    {
+      threshold = 0.0001;
+    }
+  
 
   if ( snapWithContext( p, threshold, snapResults, QgsSnapper::SNAP_TO_SEGMENT ) != 0 )
   {



More information about the QGIS-commit mailing list