I have detected the same robustness problem with LocationIndexedLine.

I have solved this with this modification to LocationIndexOfPoint:


private LinearLocation indexOfFromStart(Coordinate inputPt, LinearLocation minIndex)
          {
            double minDistance = Double.MAX_VALUE;
            int minComponentIndex = 0;
            int minSegmentIndex = 0;
            double minFrac = -1.0;

            LineSegment seg = new LineSegment();
            for (LinearIterator it = new LinearIterator(linearGeom);
                 it.hasNext(); it.next()) {
              if (! it.isEndOfLine()) {
                seg.p0 = it.getSegmentStart();
                seg.p1 = it.getSegmentEnd();
                double segDistance = seg.distance(inputPt);

                /*
                 * Changes to LocationIndexedLine to avoid robustness problems
                 * */
                PrecisionModel pm = linearGeom.getPrecisionModel();
                segDistance = pm.makePrecise(segDistance);

So If the developer use geometries with a fixed precision model, this problems could be avoided...
It works with my requeriments (probably Im missing something)

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