Search in sources :

Example 1 with SimplePointInAreaLocator

use of org.locationtech.jts.algorithm.locate.SimplePointInAreaLocator in project qupath by qupath.

the class PathObjectTileCache method getLocator.

PointOnGeometryLocator getLocator(ROI roi, boolean addToCache) {
    var locator = locatorMap.get(roi);
    if (locator == null) {
        var geometry = getGeometry(roi);
        if (geometry instanceof Polygonal || geometry instanceof LinearRing)
            locator = new IndexedPointInAreaLocator(geometry);
        else
            locator = new SimplePointInAreaLocator(geometry);
        // Workaround for multithreading bug in JTS 1.17.0 - see https://github.com/locationtech/jts/issues/571
        locator.locate(new Coordinate());
        locatorMap.put(roi, locator);
    }
    return locator;
}
Also used : IndexedPointInAreaLocator(org.locationtech.jts.algorithm.locate.IndexedPointInAreaLocator) Polygonal(org.locationtech.jts.geom.Polygonal) Coordinate(org.locationtech.jts.geom.Coordinate) LinearRing(org.locationtech.jts.geom.LinearRing) SimplePointInAreaLocator(org.locationtech.jts.algorithm.locate.SimplePointInAreaLocator)

Aggregations

IndexedPointInAreaLocator (org.locationtech.jts.algorithm.locate.IndexedPointInAreaLocator)1 SimplePointInAreaLocator (org.locationtech.jts.algorithm.locate.SimplePointInAreaLocator)1 Coordinate (org.locationtech.jts.geom.Coordinate)1 LinearRing (org.locationtech.jts.geom.LinearRing)1 Polygonal (org.locationtech.jts.geom.Polygonal)1