qgis/QGIS — pull request #1344 by leyan (2014-05-10 15:13:02+00:00)
Title: Split line feature with a single point when snapped to a line

Hi,

When splitting a feature (either with split parts or split features), it is currently necessary to draw a line crossing the line feature, which takes three clicks. In addition, one very common use case is to want to split the line at a precise point (maybe marked by an intersection, by a node in another layer, etc.). In that case, another click is necessary, which is very heavy when this operation has to be done repeatedly :

* Start the line
* Snap to the point
* Add another node
* Right click to finish the line

I would like to be able to split a line at a given point by just clicking on it. This pull request does just that, but uses a few quick hacks that have to be improved:

* GEOSDifference does not work with a point and a line, so I wrote a linePointDifference function to do just that, but it is very "manual" and can surely be improved. Any better existing function or algorithm to implement ?
* A bounding box is currently used to find the relevant features in qgsvectorlayereditutils.cpp, but a single point will not give a bounding box. I gave the box an arbitrary size, but I am sure there are a few case where this is a poor solution.

Do you think such a line splitting at snapped point would be useful? If so, how could I solve these two issues? Any other problem I didn't think about?