This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit f83e8924f379efbba2326d37bd0b89d40a9d3a79 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Wed Sep 27 14:20:03 2023 +0200 Add missing `createParametric[CRS|CS|Datum](String)` methods --- .../referencing/factory/AuthorityFactoryProxy.java | 32 ++++++++- .../factory/ConcurrentAuthorityFactory.java | 75 ++++++++++++++++++++++ 2 files changed, 106 insertions(+), 1 deletion(-) diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/AuthorityFactoryProxy.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/AuthorityFactoryProxy.java index 140ca5ed55..6fb20e3476 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/AuthorityFactoryProxy.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/AuthorityFactoryProxy.java @@ -57,7 +57,7 @@ import org.apache.sis.util.internal.Strings; * } * * @author Martin Desruisseaux (Geomatys) - * @version 0.7 + * @version 1.4 * @since 0.7 */ abstract class AuthorityFactoryProxy<T> { @@ -226,6 +226,16 @@ abstract class AuthorityFactoryProxy<T> { } }; + static final AuthorityFactoryProxy<ParametricDatum> PARAMETRIC_DATUM = + new AuthorityFactoryProxy<ParametricDatum>(ParametricDatum.class, AuthorityFactoryIdentifier.DATUM) { + @Override ParametricDatum create(GeodeticAuthorityFactory factory, String code) throws FactoryException { + return factory.createParametricDatum(code); + } + @Override ParametricDatum createFromAPI(AuthorityFactory factory, String code) throws FactoryException { + return datumFactory(factory).createParametricDatum(code); + } + }; + static final AuthorityFactoryProxy<VerticalDatum> VERTICAL_DATUM = new AuthorityFactoryProxy<VerticalDatum>(VerticalDatum.class, AuthorityFactoryIdentifier.DATUM) { @Override VerticalDatum create(GeodeticAuthorityFactory factory, String code) throws FactoryException { @@ -366,6 +376,16 @@ abstract class AuthorityFactoryProxy<T> { } }; + static final AuthorityFactoryProxy<ParametricCS> PARAMETRIC_CS = + new AuthorityFactoryProxy<ParametricCS>(ParametricCS.class, AuthorityFactoryIdentifier.CS) { + @Override ParametricCS create(GeodeticAuthorityFactory factory, String code) throws FactoryException { + return factory.createParametricCS(code); + } + @Override ParametricCS createFromAPI(AuthorityFactory factory, String code) throws FactoryException { + return csFactory(factory).createParametricCS(code); + } + }; + static final AuthorityFactoryProxy<CoordinateSystemAxis> AXIS = new AuthorityFactoryProxy<CoordinateSystemAxis>(CoordinateSystemAxis.class, AuthorityFactoryIdentifier.CS) { @Override CoordinateSystemAxis create(GeodeticAuthorityFactory factory, String code) throws FactoryException { @@ -487,6 +507,16 @@ abstract class AuthorityFactoryProxy<T> { } }; + static final AuthorityFactoryProxy<ParametricCRS> PARAMETRIC_CRS = + new AuthorityFactoryProxy<ParametricCRS>(ParametricCRS.class, AuthorityFactoryIdentifier.CRS) { + @Override ParametricCRS create(GeodeticAuthorityFactory factory, String code) throws FactoryException { + return factory.createParametricCRS(code); + } + @Override ParametricCRS createFromAPI(AuthorityFactory factory, String code) throws FactoryException { + return crsFactory(factory).createParametricCRS(code); + } + }; + @SuppressWarnings("rawtypes") static final AuthorityFactoryProxy<ParameterDescriptor> PARAMETER = new AuthorityFactoryProxy<ParameterDescriptor>(ParameterDescriptor.class, AuthorityFactoryIdentifier.GEODETIC) { diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java index 3b9c0b38c6..d601928c9f 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java @@ -1011,6 +1011,31 @@ public abstract class ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFa return create(AuthorityFactoryProxy.TEMPORAL_CRS, code); } + /** + * Returns a 1-dimensional coordinate reference system which uses parameter values or functions. + * The default implementation performs the following steps: + * <ul> + * <li>Return the cached instance for the given code if such instance already exists.</li> + * <li>Otherwise if the Data Access Object (DAO) overrides the {@code createParametricCRS(String)} + * method, invoke that method and cache the result for future use.</li> + * <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createParametricCRS(String)} + * method in the parent class. This allows to check if the more generic + * {@link #createCoordinateReferenceSystem(String)} method cached a value before to try that method.</li> + * </ul> + * + * @return the coordinate reference system for the given code. + * @throws FactoryException if the object creation failed. + * + * @since 1.4 + */ + @Override + public ParametricCRS createParametricCRS(final String code) throws FactoryException { + if (isDefault(ParametricCRS.class)) { + return super.createParametricCRS(code); + } + return create(AuthorityFactoryProxy.PARAMETRIC_CRS, code); + } + /** * Returns a CRS describing the position of points through two or more independent coordinate reference systems. * The default implementation performs the following steps: @@ -1195,6 +1220,31 @@ public abstract class ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFa return create(AuthorityFactoryProxy.TEMPORAL_DATUM, code); } + /** + * Returns an identification of a reference surface used as the origin of a parametric coordinate system. + * The default implementation performs the following steps: + * <ul> + * <li>Return the cached instance for the given code if such instance already exists.</li> + * <li>Otherwise if the Data Access Object (DAO) overrides the {@code createParametricDatum(String)} + * method, invoke that method and cache the result for future use.</li> + * <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createParametricDatum(String)} + * method in the parent class. This allows to check if the more generic + * {@link #createDatum(String)} method cached a value before to try that method.</li> + * </ul> + * + * @return the datum for the given code. + * @throws FactoryException if the object creation failed. + * + * @since 1.4 + */ + @Override + public ParametricDatum createParametricDatum(final String code) throws FactoryException { + if (isDefault(ParametricDatum.class)) { + return super.createParametricDatum(code); + } + return create(AuthorityFactoryProxy.PARAMETRIC_DATUM, code); + } + /** * Returns a datum defining the origin of an engineering coordinate reference system. * The default implementation performs the following steps: @@ -1401,6 +1451,31 @@ public abstract class ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFa return create(AuthorityFactoryProxy.TIME_CS, code); } + /** + * Returns a 1-dimensional coordinate system containing a single axis. + * The default implementation performs the following steps: + * <ul> + * <li>Return the cached instance for the given code if such instance already exists.</li> + * <li>Otherwise if the Data Access Object (DAO) overrides the {@code createParametricCS(String)} + * method, invoke that method and cache the result for future use.</li> + * <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createParametricCS(String)} + * method in the parent class. This allows to check if the more generic + * {@link #createCoordinateSystem(String)} method cached a value before to try that method.</li> + * </ul> + * + * @return the coordinate system for the given code. + * @throws FactoryException if the object creation failed. + * + * @since 1.4 + */ + @Override + public ParametricCS createParametricCS(final String code) throws FactoryException { + if (isDefault(ParametricCS.class)) { + return super.createParametricCS(code); + } + return create(AuthorityFactoryProxy.PARAMETRIC_CS, code); + } + /** * Returns a 2- or 3-dimensional Cartesian coordinate system made of straight orthogonal axes. * The default implementation performs the following steps: