Skip to content
Permalink
Browse files

Fixed #1737. Contributed by Richard Kostecky.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11282 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Aug 6, 2009
1 parent 5ac95c4 commit 47af59493446b4c4582a1b9bfc6eee576060103c
Showing with 24 additions and 2 deletions.
  1. +24 −2 src/app/qgsmaptoolnodetool.cpp
@@ -783,6 +783,8 @@ void QgsMapToolNodeTool::canvasDoubleClickEvent( QMouseEvent * e )
{
QgsMapLayer* currentLayer = mCanvas->currentLayer();
QgsVectorLayer* vlayer = 0;
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
QMultiMap<double, QgsSnappingResult> currentResultList;
if ( currentLayer )
{
vlayer = dynamic_cast<QgsVectorLayer*>( currentLayer );
@@ -805,11 +807,31 @@ void QgsMapToolNodeTool::canvasDoubleClickEvent( QMouseEvent * e )
{
QgsPoint coords = snapResults.first().snappedVertex;
QgsPoint layerCoords = toLayerCoordinates( vlayer, coords );
//QgsPoint coords = mCanvas->getCoordinateTransform()->toMapPoint( e->pos().x(), e->pos().y() );
//add vertex
if ( topologicalEditing )
{
//snapp from adding position to this vertex when topological editing is enabled
currentResultList.clear();
vlayer->snapWithContext( layerCoords, ZERO_TOLERANCE, currentResultList, QgsSnapper::SnapToSegment );
}

vlayer->beginEditCommand( tr( "Inserted vertex" ) );
mChangingGeometry = true;

//add vertex
vlayer->insertVertex( layerCoords.x(), layerCoords.y(), mSelectionFeature->featureId(), snapResults.first().afterVertexNr );

if ( topologicalEditing )
{
QMultiMap<double, QgsSnappingResult>::iterator resultIt = currentResultList.begin();

for ( ; resultIt != currentResultList.end(); ++resultIt )
{
//create vertexes on same position when topological editing is enabled
if ( mSelectionFeature->featureId() != resultIt.value().snappedAtGeometry )
vlayer->insertVertex( layerCoords.x(), layerCoords.y(), resultIt.value().snappedAtGeometry, resultIt.value().afterVertexNr );
}
}

vlayer->endEditCommand();

mSelectionFeature->updateFromFeature();

0 comments on commit 47af594

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