Hi,

I have detected that LineStringSnapper, in the method with the responsability of crack segments, snapSegments(CoordinateList, Coordinate[]) introduces an undesired (at least for me) effect.

A simple test case:
LINESTRING -> 100 100, 200 200
POINT -> 150.01 149.999

RESULT OF CRACKING-->100 100, 50.01 49.999, 200 200
In a perfect world, Id like to get a cracked linestring 100 100, 150 150, 200 200

I think we could improve this by adding three lines of code to snapSegments method. These lines looks for the closest point of the segment to snap to the crack point:

                        int index = findSegmentIndexToSnap(snapPt, srcCoords);
                        if (index >= 0) {
                               LinearSegment segment = new LinearSegment();
                                segment.p0 = srcCoords.getCoordinate(index);
                                segment.p1 = srcCoords.getCoordinate(index +1);
                                Coordinate newCoordinate = 
seg.closestPoint(snapPt);
                                srcCoords.add(index + 1, newCoordinate, false);
                        }// if

Best regards.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to