Skip to content

Commit

Permalink
Fix topological editing when snapping a node to a segment
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Apr 5, 2017
1 parent d1e7d17 commit 9b7fd3d
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/app/nodetool/qgsnodetool2.cpp
Expand Up @@ -1132,8 +1132,6 @@ void QgsNodeTool2::startDraggingEdge( const QgsPointLocator::Match &m, const Qgs

mOverrideCadPoints.clear();
mOverrideCadPoints << m.point() << m.point();

// TODO: add topo points (?)
}

void QgsNodeTool2::stopDragging()
Expand Down Expand Up @@ -1178,8 +1176,6 @@ void QgsNodeTool2::moveEdge( const QgsPoint &mapPoint )
NodeEdits edits;
addExtraVerticesToEdits( edits, mapPoint );

// TODO: move topo points (?)

applyEditsToLayers( edits );
}

Expand Down Expand Up @@ -1235,12 +1231,22 @@ void QgsNodeTool2::moveVertex( const QgsPoint &mapPoint, const QgsPointLocator::

addExtraVerticesToEdits( edits, mapPoint, dragLayer, layerPoint );

// TODO: topo editing: add points when adding a vertex on a common edge

// TODO: add topological points: when moving vertex - if snapped to something

applyEditsToLayers( edits );

if ( QgsProject::instance()->topologicalEditing() && mapPointMatch->hasEdge() && mapPointMatch->layer() )
{
// topo editing: add vertex to existing segments when moving/adding a vertex to such segment.
// this requires that the snapping match is to a segment and the segment layer's CRS
// is the same (otherwise we would need to reproject the point and it will not be coincident)
Q_FOREACH ( QgsVectorLayer *layer, edits.keys() )
{
if ( layer->crs() == mapPointMatch->layer()->crs() )
{
layer->addTopologicalPoints( layerPoint );
}
}
}

setHighlightedNodes( mSelectedNodes ); // update positions of existing highlighted nodes
setHighlightedNodesVisible( true ); // time to show highlighted nodes again
}
Expand Down

0 comments on commit 9b7fd3d

Please sign in to comment.