From 03c171b5d502b461c534816c3c11cae889aef3c1 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Mon, 16 Oct 2023 08:08:13 +0200 Subject: [PATCH] Adapt to changes in GeoTools --- .../src/org/argeo/app/geo/CqlUtils.java | 10 ++-- .../src/org/argeo/app/geo/GeoTools.java | 8 +-- .../src/org/argeo/app/geo/GeoToolsTest.java | 10 ++-- .../src/org/argeo/app/geo/GeoUtils.java | 60 +++++++++---------- .../src/org/argeo/app/geo/GpxUtils.java | 4 +- .../argeo/app/geo/http/WfsHttpHandler.java | 18 +++--- .../argeo/app/servlet/publish/FopServlet.java | 2 +- .../app/servlet/publish/GeoToSvgServlet.java | 2 +- 8 files changed, 57 insertions(+), 57 deletions(-) diff --git a/org.argeo.app.geo/src/org/argeo/app/geo/CqlUtils.java b/org.argeo.app.geo/src/org/argeo/app/geo/CqlUtils.java index f4413ad..2186c54 100644 --- a/org.argeo.app.geo/src/org/argeo/app/geo/CqlUtils.java +++ b/org.argeo.app.geo/src/org/argeo/app/geo/CqlUtils.java @@ -4,13 +4,13 @@ import org.argeo.api.acr.NamespaceUtils; import org.argeo.api.acr.search.AndFilter; import org.argeo.api.acr.search.BasicSearch; import org.argeo.api.acr.search.ContentFilter; +import org.geotools.api.filter.And; +import org.geotools.api.filter.Filter; +import org.geotools.api.filter.PropertyIsEqualTo; +import org.geotools.api.filter.expression.Literal; +import org.geotools.api.filter.expression.PropertyName; import org.geotools.filter.text.cql2.CQL; import org.geotools.filter.text.cql2.CQLException; -import org.opengis.filter.And; -import org.opengis.filter.Filter; -import org.opengis.filter.PropertyIsEqualTo; -import org.opengis.filter.expression.Literal; -import org.opengis.filter.expression.PropertyName; /** Utilities around the CQL query format. */ public class CqlUtils { diff --git a/org.argeo.app.geo/src/org/argeo/app/geo/GeoTools.java b/org.argeo.app.geo/src/org/argeo/app/geo/GeoTools.java index dbaa985..7571da7 100644 --- a/org.argeo.app.geo/src/org/argeo/app/geo/GeoTools.java +++ b/org.argeo.app.geo/src/org/argeo/app/geo/GeoTools.java @@ -1,9 +1,9 @@ package org.argeo.app.geo; import org.argeo.api.cms.CmsLog; +import org.geotools.api.filter.FilterFactory; +import org.geotools.api.style.StyleFactory; import org.geotools.factory.CommonFactoryFinder; -import org.geotools.styling.StyleFactory; -import org.opengis.filter.FilterFactory2; /** * Factories initialisation and workarounds for the GeoTools library. The idea @@ -15,12 +15,12 @@ public class GeoTools { private final static CmsLog log = CmsLog.getLog(GeoTools.class); public final static StyleFactory STYLE_FACTORY; - public final static FilterFactory2 FILTER_FACTORY; + public final static FilterFactory FILTER_FACTORY; static { try { STYLE_FACTORY = CommonFactoryFinder.getStyleFactory(); - FILTER_FACTORY = CommonFactoryFinder.getFilterFactory2(); + FILTER_FACTORY = CommonFactoryFinder.getFilterFactory(); } catch (RuntimeException e) { log.error("Basic GeoTools initialisation failed, geographical utilities are probably not available", e); throw e; diff --git a/org.argeo.app.geo/src/org/argeo/app/geo/GeoToolsTest.java b/org.argeo.app.geo/src/org/argeo/app/geo/GeoToolsTest.java index a771196..e6f9c19 100644 --- a/org.argeo.app.geo/src/org/argeo/app/geo/GeoToolsTest.java +++ b/org.argeo.app.geo/src/org/argeo/app/geo/GeoToolsTest.java @@ -10,15 +10,17 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.geotools.api.data.SimpleFeatureSource; +import org.geotools.api.data.SimpleFeatureStore; +import org.geotools.api.data.Transaction; +import org.geotools.api.feature.simple.SimpleFeature; +import org.geotools.api.feature.simple.SimpleFeatureType; import org.geotools.data.DataUtilities; import org.geotools.data.DefaultTransaction; -import org.geotools.data.Transaction; import org.geotools.data.collection.ListFeatureCollection; import org.geotools.data.shapefile.ShapefileDataStore; import org.geotools.data.shapefile.ShapefileDataStoreFactory; import org.geotools.data.simple.SimpleFeatureCollection; -import org.geotools.data.simple.SimpleFeatureSource; -import org.geotools.data.simple.SimpleFeatureStore; import org.geotools.feature.simple.SimpleFeatureBuilder; import org.geotools.geometry.jts.JTSFactoryFinder; import org.geotools.swing.data.JFileDataStoreChooser; @@ -27,8 +29,6 @@ import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.LineString; import org.locationtech.jts.geom.Point; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.feature.simple.SimpleFeatureType; public class GeoToolsTest { public GeoToolsTest() { diff --git a/org.argeo.app.geo/src/org/argeo/app/geo/GeoUtils.java b/org.argeo.app.geo/src/org/argeo/app/geo/GeoUtils.java index 6f50c08..e565866 100644 --- a/org.argeo.app.geo/src/org/argeo/app/geo/GeoUtils.java +++ b/org.argeo.app.geo/src/org/argeo/app/geo/GeoUtils.java @@ -14,33 +14,44 @@ import javax.measure.Quantity; import javax.measure.quantity.Area; import javax.xml.transform.TransformerException; +import org.geotools.api.data.SimpleFeatureSource; +import org.geotools.api.data.SimpleFeatureStore; +import org.geotools.api.data.Transaction; +import org.geotools.api.feature.simple.SimpleFeature; +import org.geotools.api.feature.simple.SimpleFeatureType; +import org.geotools.api.filter.Filter; +import org.geotools.api.filter.FilterFactory; +import org.geotools.api.filter.expression.Expression; +import org.geotools.api.geometry.MismatchedDimensionException; +import org.geotools.api.referencing.FactoryException; +import org.geotools.api.referencing.crs.CoordinateReferenceSystem; +import org.geotools.api.referencing.operation.MathTransform; +import org.geotools.api.referencing.operation.TransformException; +import org.geotools.api.style.AnchorPoint; +import org.geotools.api.style.Displacement; +import org.geotools.api.style.FeatureTypeConstraint; +import org.geotools.api.style.FeatureTypeStyle; +import org.geotools.api.style.Fill; +import org.geotools.api.style.Graphic; +import org.geotools.api.style.GraphicalSymbol; +import org.geotools.api.style.NamedLayer; +import org.geotools.api.style.PointSymbolizer; +import org.geotools.api.style.Rule; +import org.geotools.api.style.Stroke; +import org.geotools.api.style.Style; +import org.geotools.api.style.StyleFactory; +import org.geotools.api.style.StyledLayerDescriptor; +import org.geotools.api.style.UserLayer; import org.geotools.data.DefaultTransaction; -import org.geotools.data.Transaction; import org.geotools.data.collection.ListFeatureCollection; import org.geotools.data.shapefile.ShapefileDataStore; import org.geotools.data.shapefile.ShapefileDataStoreFactory; import org.geotools.data.simple.SimpleFeatureCollection; import org.geotools.data.simple.SimpleFeatureIterator; -import org.geotools.data.simple.SimpleFeatureSource; -import org.geotools.data.simple.SimpleFeatureStore; import org.geotools.factory.CommonFactoryFinder; import org.geotools.geometry.jts.JTS; import org.geotools.referencing.CRS; import org.geotools.referencing.crs.DefaultGeographicCRS; -import org.geotools.styling.AnchorPoint; -import org.geotools.styling.Displacement; -import org.geotools.styling.FeatureTypeConstraint; -import org.geotools.styling.FeatureTypeStyle; -import org.geotools.styling.Fill; -import org.geotools.styling.Graphic; -import org.geotools.styling.NamedLayer; -import org.geotools.styling.PointSymbolizer; -import org.geotools.styling.Rule; -import org.geotools.styling.Stroke; -import org.geotools.styling.Style; -import org.geotools.styling.StyleFactory; -import org.geotools.styling.StyledLayerDescriptor; -import org.geotools.styling.UserLayer; import org.geotools.styling.css.CssParser; import org.geotools.styling.css.CssTranslator; import org.geotools.styling.css.Stylesheet; @@ -52,17 +63,6 @@ import org.locationtech.jts.geom.Point; import org.locationtech.jts.geom.Polygon; import org.locationtech.jts.geom.util.GeometryFixer; import org.locationtech.jts.operation.polygonize.Polygonizer; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.feature.simple.SimpleFeatureType; -import org.opengis.filter.Filter; -import org.opengis.filter.FilterFactory2; -import org.opengis.filter.expression.Expression; -import org.opengis.geometry.MismatchedDimensionException; -import org.opengis.referencing.FactoryException; -import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.operation.MathTransform; -import org.opengis.referencing.operation.TransformException; -import org.opengis.style.GraphicalSymbol; import si.uom.SI; import tech.units.indriya.quantity.Quantities; @@ -218,7 +218,7 @@ public class GeoUtils { public static Style createStyleFromCss(String css) { Stylesheet ss = CssParser.parse(css); CssTranslator translator = new CssTranslator(); - org.opengis.style.Style style = translator.translate(ss); + Style style = translator.translate(ss); // try { // SLDTransformer styleTransform = new SLDTransformer(); @@ -276,7 +276,7 @@ public class GeoUtils { public static String createTestSLD() { StyleFactory sf = CommonFactoryFinder.getStyleFactory(); - FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(); + FilterFactory ff = CommonFactoryFinder.getFilterFactory(); StyledLayerDescriptor sld = sf.createStyledLayerDescriptor(); sld.setName("sld"); diff --git a/org.argeo.app.geo/src/org/argeo/app/geo/GpxUtils.java b/org.argeo.app.geo/src/org/argeo/app/geo/GpxUtils.java index 2a946f4..dcd205a 100644 --- a/org.argeo.app.geo/src/org/argeo/app/geo/GpxUtils.java +++ b/org.argeo.app.geo/src/org/argeo/app/geo/GpxUtils.java @@ -15,6 +15,8 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import org.geotools.api.feature.simple.SimpleFeature; +import org.geotools.api.feature.simple.SimpleFeatureType; import org.geotools.data.DataUtilities; import org.geotools.feature.SchemaException; import org.geotools.feature.simple.SimpleFeatureBuilder; @@ -24,8 +26,6 @@ import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.LineString; import org.locationtech.jts.geom.MultiPoint; import org.locationtech.jts.geom.Polygon; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.feature.simple.SimpleFeatureType; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; diff --git a/org.argeo.app.geo/src/org/argeo/app/geo/http/WfsHttpHandler.java b/org.argeo.app.geo/src/org/argeo/app/geo/http/WfsHttpHandler.java index 61ea7bc..1509773 100644 --- a/org.argeo.app.geo/src/org/argeo/app/geo/http/WfsHttpHandler.java +++ b/org.argeo.app.geo/src/org/argeo/app/geo/http/WfsHttpHandler.java @@ -38,6 +38,15 @@ import org.argeo.cms.acr.json.AcrJsonUtils; import org.argeo.cms.http.HttpHeader; import org.argeo.cms.http.server.HttpServerUtils; import org.argeo.cms.util.LangUtils; +import org.geotools.api.feature.GeometryAttribute; +import org.geotools.api.feature.simple.SimpleFeature; +import org.geotools.api.feature.simple.SimpleFeatureType; +import org.geotools.api.feature.type.AttributeDescriptor; +import org.geotools.api.feature.type.Name; +import org.geotools.api.referencing.FactoryException; +import org.geotools.api.referencing.crs.CoordinateReferenceSystem; +import org.geotools.api.referencing.operation.MathTransform; +import org.geotools.api.referencing.operation.TransformException; import org.geotools.feature.DefaultFeatureCollection; import org.geotools.feature.NameImpl; import org.geotools.feature.simple.SimpleFeatureBuilder; @@ -50,15 +59,6 @@ import org.locationtech.jts.geom.Envelope; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.Point; import org.locationtech.jts.geom.Polygon; -import org.opengis.feature.GeometryAttribute; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.feature.simple.SimpleFeatureType; -import org.opengis.feature.type.AttributeDescriptor; -import org.opengis.feature.type.Name; -import org.opengis.referencing.FactoryException; -import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.operation.MathTransform; -import org.opengis.referencing.operation.TransformException; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; diff --git a/org.argeo.app.servlet.publish/src/org/argeo/app/servlet/publish/FopServlet.java b/org.argeo.app.servlet.publish/src/org/argeo/app/servlet/publish/FopServlet.java index b389883..3344d75 100644 --- a/org.argeo.app.servlet.publish/src/org/argeo/app/servlet/publish/FopServlet.java +++ b/org.argeo.app.servlet.publish/src/org/argeo/app/servlet/publish/FopServlet.java @@ -46,9 +46,9 @@ import org.argeo.cms.acr.xml.XmlNormalizer; import org.argeo.cms.auth.RemoteAuthUtils; import org.argeo.cms.servlet.ServletHttpRequest; import org.argeo.cms.util.LangUtils; +import org.geotools.api.feature.simple.SimpleFeature; import org.geotools.data.collection.ListFeatureCollection; import org.geotools.data.simple.SimpleFeatureCollection; -import org.opengis.feature.simple.SimpleFeature; import net.sf.saxon.BasicTransformerFactory; diff --git a/org.argeo.app.servlet.publish/src/org/argeo/app/servlet/publish/GeoToSvgServlet.java b/org.argeo.app.servlet.publish/src/org/argeo/app/servlet/publish/GeoToSvgServlet.java index c22b834..7ae9527 100644 --- a/org.argeo.app.servlet.publish/src/org/argeo/app/servlet/publish/GeoToSvgServlet.java +++ b/org.argeo.app.servlet.publish/src/org/argeo/app/servlet/publish/GeoToSvgServlet.java @@ -18,9 +18,9 @@ import org.argeo.app.geo.GeoUtils; import org.argeo.app.geo.GpxUtils; import org.argeo.cms.auth.RemoteAuthUtils; import org.argeo.cms.servlet.ServletHttpRequest; +import org.geotools.api.feature.simple.SimpleFeature; import org.geotools.data.collection.ListFeatureCollection; import org.geotools.data.simple.SimpleFeatureCollection; -import org.opengis.feature.simple.SimpleFeature; /** * A servlet transforming an geographical data to SVG. -- 2.30.2