Skip to content
Permalink
Browse files

Commited patch from Stefanie for QgsVectorLayer::snapToGeometry

git-svn-id: http://svn.osgeo.org/qgis/trunk@8150 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Feb 13, 2008
1 parent 04ed181 commit 0a2943024cdfef0104f00656cae648c9e99edd8f
Showing with 3 additions and 19 deletions.
  1. +3 −19 src/core/qgsvectorlayer.cpp
@@ -2850,6 +2850,8 @@ void QgsVectorLayer::snapToGeometry(const QgsPoint& startPoint, int featureId, Q
}
snappingResultVertex.snappedAtGeometry = featureId;
snappingResultVertex.layer = this;
snappingResults.insert(sqrt(sqrDistVertexSnap), snappingResultVertex);
return;
}
}
if(snap_to == QgsSnapper::SNAP_TO_SEGMENT || snap_to == QgsSnapper::SNAP_TO_VERTEX_AND_SEGMENT) //snap to segment
@@ -2868,29 +2870,11 @@ void QgsVectorLayer::snapToGeometry(const QgsPoint& startPoint, int featureId, Q
snappingResultSegment.beforeVertex = geom->vertexAt(afterVertex - 1);
snappingResultSegment.afterVertex = geom->vertexAt(afterVertex);
snappingResultSegment.layer = this;
snappingResults.insert(sqrt(sqrDistSegmentSnap), snappingResultSegment);
}
}
}

if(snap_to == QgsSnapper::SNAP_TO_VERTEX && sqrDistVertexSnap < sqrSnappingTolerance)
{
snappingResults.insert(sqrt(sqrDistVertexSnap), snappingResultVertex);
}
else if(snap_to == QgsSnapper::SNAP_TO_SEGMENT && sqrDistSegmentSnap < sqrSnappingTolerance && vectorType() != QGis::Point)
{
snappingResults.insert(sqrt(sqrDistSegmentSnap), snappingResultSegment);
}
else if(snap_to == QgsSnapper::SNAP_TO_VERTEX_AND_SEGMENT) //to vertex and segment
{
if(sqrDistVertexSnap < sqrSnappingTolerance)
{
snappingResults.insert(sqrt(sqrDistVertexSnap), snappingResultVertex);
}
else if(sqrDistSegmentSnap < sqrSnappingTolerance && vectorType() != QGis::Point)
{
snappingResults.insert(sqrt(sqrDistSegmentSnap), snappingResultSegment);
}
}
}

int QgsVectorLayer::insertSegmentVerticesForSnap(const QList<QgsSnappingResult>& snapResults)

0 comments on commit 0a29430

Please sign in to comment.
You can’t perform that action at this time.