X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.app.geo%2Fsrc%2Forg%2Fargeo%2Fapp%2Fgeo%2FJTS.java;fp=org.argeo.app.geo%2Fsrc%2Forg%2Fargeo%2Fapp%2Fgeo%2FJTS.java;h=26237120bb25cd80856d7c68a6962b1194d1bb73;hb=57f3528fda509d840818a72ebcd38b6ab3afa435;hp=0000000000000000000000000000000000000000;hpb=eabf7eed1799f890337b45ab9857b1d55192cd30;p=gpl%2Fargeo-suite.git diff --git a/org.argeo.app.geo/src/org/argeo/app/geo/JTS.java b/org.argeo.app.geo/src/org/argeo/app/geo/JTS.java new file mode 100644 index 0000000..2623712 --- /dev/null +++ b/org.argeo.app.geo/src/org/argeo/app/geo/JTS.java @@ -0,0 +1,27 @@ +package org.argeo.app.geo; + +import org.argeo.api.cms.CmsLog; +import org.locationtech.jts.geom.GeometryFactory; + +/** + * Factories initialisation and workarounds for the JTS library. The idea is to + * code defensively around factory initialisation, API changes, and issues + * related to running in an OSGi environment. Rather see {@link GeoUtils} for + * functional static utilities. + */ +public class JTS { + private final static CmsLog log = CmsLog.getLog(JTS.class); + + public final static GeometryFactory GEOMETRY_FACTORY; + + static { + try { + // GEOMETRY_FACTORY = JTSFactoryFinder.getGeometryFactory(); + GEOMETRY_FACTORY = new GeometryFactory(); + } catch (RuntimeException e) { + log.error("Basic JTS initialisation failed, geographical utilities are probably not available", e); + throw e; + } + } + +}