diff --git a/matsim/src/main/java/org/matsim/core/utils/geometry/GeometryUtils.java b/matsim/src/main/java/org/matsim/core/utils/geometry/GeometryUtils.java index 8887bfe2e1c..b407c794b2b 100644 --- a/matsim/src/main/java/org/matsim/core/utils/geometry/GeometryUtils.java +++ b/matsim/src/main/java/org/matsim/core/utils/geometry/GeometryUtils.java @@ -47,6 +47,9 @@ * */ public class GeometryUtils { + + private static final GeometryFactory GEOMETRY_FACTORY = new GeometryFactory(); + private GeometryUtils() {} // do not instantiate /** @@ -101,13 +104,13 @@ public static List findIntersectingLinks(LineString lineString, final Netw public static LineString createGeotoolsLineString(Link link) { Coordinate fromCoord = MGC.coord2Coordinate( link.getFromNode().getCoord() ) ; Coordinate toCoord = MGC.coord2Coordinate( link.getToNode().getCoord() ) ; - LineString theSegment = new GeometryFactory().createLineString(new Coordinate[]{ fromCoord, toCoord }); + LineString theSegment = GEOMETRY_FACTORY.createLineString(new Coordinate[] { fromCoord, toCoord }); return theSegment; } public static Point createGeotoolsPoint(Coord coord ) { Coordinate coordinate = MGC.coord2Coordinate(coord) ; - Point point = new GeometryFactory().createPoint( coordinate ) ; + Point point = GEOMETRY_FACTORY.createPoint(coordinate); return point ; }