public void testGetSegmentMultiLineString() throws Exception { Geometry line = reader.read("MULTILINESTRING ((0 0, 10 0, 20 0), (20 0, 30 0))"); LocationIndexedLine indexedLine = new LocationIndexedLine(line); LinearLocation loc0 = indexedLine.indexOf(new Coordinate(0, 0)); LinearLocation loc0_5 = indexedLine.indexOf(new Coordinate(5, 0)); LinearLocation loc1 = indexedLine.indexOf(new Coordinate (10, 0)); LinearLocation loc2 = indexedLine.indexOf(new Coordinate (20, 0)); LinearLocation loc2B = new LinearLocation(1, 0, 0.0); LinearLocation loc2_5 = indexedLine.indexOf(new Coordinate (25, 0)); LinearLocation loc3 = indexedLine.indexOf(new Coordinate (30, 0)); LineSegment seg0 = new LineSegment(new Coordinate(0,0), new Coordinate(10, 0)); LineSegment seg1 = new LineSegment(new Coordinate(10,0), new Coordinate(20, 0)); LineSegment seg2 = new LineSegment(new Coordinate(20,0), new Coordinate(30, 0)); assertTrue(loc0.getSegment(line).equals(seg0)); assertTrue(loc0_5.getSegment(line).equals(seg0)); assertTrue(loc1.getSegment(line).equals(seg1)); assertTrue(loc2.getSegment(line).equals(seg1)); assertTrue(loc2_5.getSegment(line).equals(seg2)); assertTrue(loc3.getSegment(line).equals(seg2)); }