1 package org.locationtech.jts.operation.overlayng; 2 3 import org.locationtech.jts.algorithm.PointLocator; 4 import org.locationtech.jts.algorithm.locate.PointOnGeometryLocator; 5 import org.locationtech.jts.geom.Coordinate; 6 import org.locationtech.jts.geom.Geometry; 7 8 /** 9 * Locates points on a linear geometry, 10 * using a spatial index to provide good performance. 11 * 12 * @author mdavis 13 * 14 */ 15 class IndexedPointOnLineLocator implements PointOnGeometryLocator { 16 17 private Geometry inputGeom; 18 IndexedPointOnLineLocator(Geometry geomLinear)19 public IndexedPointOnLineLocator(Geometry geomLinear) { 20 this.inputGeom = geomLinear; 21 } 22 23 @Override locate(Coordinate p)24 public int locate(Coordinate p) { 25 // TODO: optimize this with a segment index 26 PointLocator locator = new PointLocator(); 27 return locator.locate(p, inputGeom); 28 } 29 30 } 31