Skip to content

Commit

Permalink
More topological editing fixes from Marco
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9473 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Oct 10, 2008
1 parent a9a0c89 commit 2fdfed3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/app/qgsmaptooladdvertex.cpp
Expand Up @@ -91,6 +91,14 @@ void QgsMapToolAddVertex::canvasReleaseEvent( QMouseEvent * e )

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 );

Expand Down
12 changes: 11 additions & 1 deletion src/core/qgsvectorlayer.cpp
Expand Up @@ -1906,7 +1906,17 @@ int QgsVectorLayer::addTopologicalPoints( const QgsPoint& p )

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 )
{
Expand Down

0 comments on commit 2fdfed3

Please sign in to comment.