This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-3.1 in repository https://gitbox.apache.org/repos/asf/sis.git
commit c912771e82dd54f05e594bc69c6e5d1a581346c0 Merge: 3ce89f28c7 7156ea4940 Author: Martin Desruisseaux <[email protected]> AuthorDate: Mon Sep 22 17:01:52 2025 +0200 Merge branch 'geoapi-4.0' into geoapi-3.1 .../sis/coverage/privy/SampleDimensions.java | 3 +- .../sis/feature/builder/OperationWrapper.java | 2 +- .../sis/feature/privy/AttributeConvention.java | 3 +- .../feature/privy/FeatureProjectionBuilder.java | 33 +- .../org/apache/sis/filter/ConvertFunction.java | 2 +- .../sis/filter/internal/GeometryFromFeature.java | 2 +- .../main/org/apache/sis/filter/internal/Node.java | 8 + .../org/apache/sis/filter/privy/FunctionNames.java | 3 +- .../apache/sis/filter/sqlmm/SpatialFunction.java | 6 +- .../org/apache/sis/geometry/wrapper/jts/JTS.java | 3 +- .../org/apache/sis/image/privy/ImageUtilities.java | 3 +- .../org/apache/sis/image/privy/RasterFactory.java | 3 +- .../test/org/apache/sis/feature/Assertions.java | 3 +- .../iso/extent/DefaultGeographicDescription.java | 20 +- .../apache/sis/metadata/iso/extent/Extents.java | 44 +- .../org/apache/sis/metadata/privy/Identifiers.java | 3 +- .../sis/metadata/privy/ImplementationHelper.java | 3 +- .../org/apache/sis/metadata/privy/NameMeaning.java | 3 +- .../sis/metadata/sql/privy/SQLUtilities.java | 3 +- .../main/org/apache/sis/xml/InputFactory.java | 3 +- .../main/org/apache/sis/xml/OutputFactory.java | 3 +- .../test/org/apache/sis/metadata/Assertions.java | 3 +- .../apache/sis/metadata/MetadataCopierTest.java | 16 +- .../metadata/iso/citation/HardCodedCitations.java | 3 +- .../sis/metadata/iso/extent/ExtentsTest.java | 11 +- .../sis/openoffice/ReferencingFunctions.java | 4 +- .../org/apache/sis/openoffice/package-info.java | 2 +- .../main/org/apache/sis/geometry/Envelopes.java | 2 +- .../main/org/apache/sis/io/wkt/AbstractParser.java | 18 +- .../main/org/apache/sis/io/wkt/Formatter.java | 2 +- .../apache/sis/io/wkt/GeodeticObjectParser.java | 92 +- .../org/apache/sis/io/wkt/MathTransformParser.java | 6 +- .../main/org/apache/sis/referencing/Builder.java | 2 +- .../sis/referencing/ImmutableIdentifier.java | 4 +- .../sis/referencing/datum/AbstractDatum.java | 34 +- .../org/apache/sis/referencing/datum/SubTypes.java | 81 -- .../referencing/factory/sql/EPSGDataAccess.java | 110 ++- .../sis/referencing/internal/DeprecatedCode.java | 45 +- .../operation/AbstractCoordinateOperation.java | 54 +- .../operation/CoordinateOperationFinder.java | 4 +- .../operation/CoordinateOperationRegistry.java | 6 +- .../apache/sis/referencing/operation/SubTypes.java | 85 -- .../sis/referencing/operation/provider/ESRI.java | 3 +- .../provider/FranceGeocentricInterpolation.java | 5 +- .../sis/referencing/operation/provider/NADCON.java | 1 + .../sis/referencing/operation/provider/NTv1.java | 1 + .../sis/referencing/operation/provider/NTv2.java | 1 + .../sis/referencing/privy/AxisDirections.java | 3 +- .../referencing/privy/CoordinateOperations.java | 3 +- .../org/apache/sis/referencing/privy/Formulas.java | 3 +- .../referencing/privy/ReferencingUtilities.java | 3 +- .../sis/referencing/privy/ShapeUtilities.java | 3 +- .../apache/sis/referencing/privy/WKTKeywords.java | 3 +- .../apache/sis/referencing/privy/WKTUtilities.java | 47 +- .../sis/io/wkt/GeodeticObjectParserTest.java | 77 +- .../org/apache/sis/referencing/Assertions.java | 3 +- .../operation/provider/ProvidersTest.java | 10 +- .../sis/storage/geotiff/CompressedSubset.java | 14 +- .../org/apache/sis/storage/geotiff/DataSubset.java | 15 +- .../apache/sis/storage/netcdf/MetadataReader.java | 3 +- .../org/apache/sis/storage/netcdf/base/Axis.java | 2 +- .../apache/sis/storage/netcdf/base/AxisType.java | 32 +- .../apache/sis/storage/netcdf/base/FeatureSet.java | 2 +- .../storage/netcdf/base/VariableTransformer.java | 2 +- .../sis/storage/netcdf/classic/GridInfo.java | 2 +- .../sis/storage/netcdf/ucar/GridWrapper.java | 2 +- .../sis/storage/netcdf/ucar/VariableWrapper.java | 6 +- .../sis/storage/sql/postgis/PostgresTest.java | 83 +- .../org/apache/sis/storage/gpx/Attributes.java | 4 +- .../main/org/apache/sis/storage/gpx/Tags.java | 4 +- .../main/org/apache/sis/io/stream/IOUtilities.java | 3 +- .../main/org/apache/sis/storage/FeatureQuery.java | 49 +- .../apache/sis/storage/base/MetadataBuilder.java | 17 +- .../apache/sis/storage/base/StoreUtilities.java | 3 +- .../org/apache/sis/measure/UnitAliases.properties | 8 +- .../main/org/apache/sis/measure/UnitFormat.java | 44 +- .../apache/sis/measure/UnitNames_en_US.properties | 3 + .../main/org/apache/sis/util/Locales.java | 5 +- .../main/org/apache/sis/util/Printable.java | 2 +- .../main/org/apache/sis/util/Static.java | 3 + .../org/apache/sis/util/privy/CollectionsExt.java | 3 +- .../main/org/apache/sis/util/privy/Constants.java | 4 +- .../main/org/apache/sis/util/privy/Numerics.java | 3 +- .../main/org/apache/sis/util/privy/Strings.java | 3 +- .../main/org/apache/sis/util/privy/URLs.java | 4 +- .../main/org/apache/sis/util/privy/Unsafe.java | 3 +- .../org/apache/sis/util/resources/Vocabulary.java | 5 + .../sis/util/resources/Vocabulary.properties | 1 + .../sis/util/resources/Vocabulary_fr.properties | 1 + .../org/apache/sis/measure/UnitFormatTest.java | 66 +- .../test/org/apache/sis/test/Assertions.java | 3 +- .../org/apache/sis/test/TestConfiguration.java | 4 +- .../test/org/apache/sis/test/TestUtilities.java | 3 +- .../main/org/apache/sis/geometries/Geometries.java | 3 +- .../main/org/apache/sis/geometries/math/Maths.java | 3 +- .../org/apache/sis/geometries/math/Matrices.java | 3 +- .../apache/sis/geometries/math/Quaternions.java | 4 +- .../apache/sis/geometries/math/TupleArrays.java | 42 +- .../org/apache/sis/geometries/math/Vectors.java | 3 +- .../geometries/operation/GeometryOperations.java | 13 +- .../sis/geometries/processor/ProcessorUtils.java | 3 +- .../sis/storage/shapefile/ShapefileStore.java | 6 +- .../apache/sis/storage/shapefile/cpg/CpgFiles.java | 3 +- netbeans-project/ivy.xml | 2 +- netbeans-project/nbproject/project.xml | 1 + .../org/apache/sis/gui/controls/ColorCell.java | 2 +- .../sis/gui/controls/ColorColumnHandler.java | 2 +- .../org/apache/sis/gui/controls/ColorRamp.java | 2 +- .../org/apache/sis/gui/controls/TabularWidget.java | 8 +- .../org/apache/sis/gui/coverage/CellFormat.java | 68 +- .../apache/sis/gui/coverage/CoverageStyling.java | 73 +- .../main/org/apache/sis/gui/coverage/GridCell.java | 70 -- .../org/apache/sis/gui/coverage/GridControls.java | 8 +- .../org/apache/sis/gui/coverage/GridError.java | 19 +- .../main/org/apache/sis/gui/coverage/GridRow.java | 110 --- .../org/apache/sis/gui/coverage/GridRowSkin.java | 136 --- .../main/org/apache/sis/gui/coverage/GridTile.java | 43 +- .../main/org/apache/sis/gui/coverage/GridView.java | 253 +++--- .../org/apache/sis/gui/coverage/GridViewSkin.java | 944 +++++++++++---------- .../main/org/apache/sis/gui/internal/FontGIS.java | 5 +- .../org/apache/sis/gui/internal/GUIUtilities.java | 3 +- .../main/org/apache/sis/gui/internal/Styles.java | 20 +- .../apache/sis/gui/metadata/MetadataSummary.java | 19 +- .../sis/gui/metadata/RepresentationInfo.java | 15 +- .../org/apache/sis/gui/coverage/GridViewApp.java | 6 +- .../sis/referencing/factory/sql/epsg/Clear.sql | 31 + .../sis/referencing/factory/sql/epsg/README.md | 3 +- settings.gradle.kts | 2 +- 128 files changed, 1651 insertions(+), 1594 deletions(-) diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/Builder.java index 9cc21ec6eb,b10504c51a..f299e11810 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/Builder.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/Builder.java @@@ -344,11 -341,9 +344,11 @@@ public abstract class Builder<B extend * Creates an identifier for the given authority, code space and version. * The new identifier will be marked as deprecated if {@link #isDeprecated()} returns {@code true}. */ - private Identifier createIdentifier(final Citation authority, final String codeSpace, final String identifier, final String version) { + private ReferenceIdentifier createIdentifier(final Citation authority, + final String codeSpace, final String identifier, final String version) + { if (isDeprecated()) { - return new DeprecatedCode(authority, codeSpace, identifier, version, null, getRemarks()); + return new DeprecatedCode(authority, codeSpace, identifier, version, getDescription(), null, getRemarks()); } else { return new ImmutableIdentifier(authority, codeSpace, identifier, version, getDescription()); } diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/AbstractDatum.java index 703457ad2b,0d0996d795..60fb930645 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/AbstractDatum.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/AbstractDatum.java @@@ -49,6 -53,6 +53,9 @@@ import org.apache.sis.io.wkt.ElementKin import org.apache.sis.io.wkt.Formatter; import static org.apache.sis.util.Utilities.deepEquals; ++// Specific to the main and geoapi-3.1 branches: ++import org.opengis.referencing.datum.ImageDatum; ++ // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.metadata.Identifier; import org.opengis.referencing.datum.DatumEnsemble; @@@ -256,8 -263,29 +263,33 @@@ public class AbstractDatum extends Abst * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ ++ @SuppressWarnings("deprecation") public static AbstractDatum castOrCopy(final Datum object) { - return SubTypes.castOrCopy(object); + if (object instanceof GeodeticDatum) { + return DefaultGeodeticDatum.castOrCopy((GeodeticDatum) object); + } + if (object instanceof VerticalDatum) { + return DefaultVerticalDatum.castOrCopy((VerticalDatum) object); + } + if (object instanceof TemporalDatum) { + return DefaultTemporalDatum.castOrCopy((TemporalDatum) object); + } + if (object instanceof EngineeringDatum) { + return DefaultEngineeringDatum.castOrCopy((EngineeringDatum) object); + } ++ if (object instanceof ImageDatum) { ++ return DefaultImageDatum.castOrCopy((ImageDatum) object); ++ } + /* + * Intentionally check for `AbstractDatum` after the interfaces because users may have defined their own + * subclass implementing the interfaces. If we were checking for `AbstractDatum` before the interfaces, + * the returned instance could have been a user subclass without the JAXB annotations required for XML + * marshalling. + */ + if (object == null || object instanceof AbstractDatum) { + return (AbstractDatum) object; + } + return new AbstractDatum(object); } /** diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/DeprecatedCode.java index 54cb6629bc,d5b62fe4be..c29002c5e4 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/DeprecatedCode.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/DeprecatedCode.java @@@ -77,11 -84,11 +81,11 @@@ public final class DeprecatedCode exten * * <div class="note"><b>Example:</b> "superseded by code XYZ".</div> * - * @return information about the replacement for this identifier. + * @return information about the replacement for this identifier, or {@code null} if none. */ @Override - public Optional<InternationalString> getRemarks() { - return Optional.ofNullable(remarks); + public InternationalString getRemarks() { - return super.getDescription(); ++ return remarks; } /** diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java index 38bf9d25ba,831becdfb1..ea03bcfd57 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java @@@ -461,9 -461,36 +464,47 @@@ check: for (int isTarget=0; ; isTa * given object itself), or {@code null} if the argument was null. */ public static AbstractCoordinateOperation castOrCopy(final CoordinateOperation object) { - return SubTypes.castOrCopy(object); + if (object instanceof Transformation) { + return DefaultTransformation.castOrCopy((Transformation) object); + } + if (object instanceof Conversion) { + return DefaultConversion.castOrCopy((Conversion) object); + } + if (object instanceof PassThroughOperation) { + return DefaultPassThroughOperation.castOrCopy((PassThroughOperation) object); + } + if (object instanceof ConcatenatedOperation) { + return DefaultConcatenatedOperation.castOrCopy((ConcatenatedOperation) object); + } - if (object instanceof SingleOperation) { ++ if (isSingleOperation(object)) { + if (object instanceof AbstractSingleOperation) { + return (AbstractSingleOperation) object; + } + return new AbstractSingleOperation((SingleOperation) object); + } + /* + * Intentionally check for `AbstractCoordinateOperation` after the interfaces because users may have defined + * their own subclass implementing the same interfaces. If we were checking for `AbstractCoordinateOperation` + * before the interfaces, the returned instance could have been a user subclass without the JAXB annotations + * required for XML marshalling. + */ + if (object == null || object instanceof AbstractCoordinateOperation) { + return (AbstractCoordinateOperation) object; + } + return new AbstractCoordinateOperation(object); + } + ++ /** ++ * Returns {@code true} if the given operation is a single operation but not a pass-through operation. ++ * In an older ISO 19111 model, {@link PassThroughOperation} extended {@link SingleOperation}, which ++ * was a problem for providing a value to the inherited {@link SingleOperation#getMethod()} method. ++ * This has been fixed in newer ISO 19111 model, but for safety with objects following the older model ++ * (e.g. GeoAPI 3.0) we are better to perform an explicit exclusion of {@link PassThroughOperation}. ++ */ ++ static boolean isSingleOperation(final CoordinateOperation operation) { ++ return (operation instanceof SingleOperation) && !(operation instanceof PassThroughOperation); + } + /** * Returns the GeoAPI interface implemented by this class. * The default implementation returns {@code CoordinateOperation.class}. diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/CoordinateOperationFinder.java index 8378f742fb,77bf446a4b..0b37425008 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/CoordinateOperationFinder.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/CoordinateOperationFinder.java @@@ -992,26 -983,11 +992,26 @@@ public class CoordinateOperationFinder final int numTrailingCoordinates = remainingSourceDimensions - endAtDimension; CoordinateOperation subOperation = info.operation; if ((firstAffectedCoordinate | numTrailingCoordinates) != 0) { + final Map<String,?> properties = IdentifiedObjects.getProperties(subOperation); + /* + * The `DefaultPassThroughOperation` constuctor expects a `SingleOperation`. + * In most case, the `subOperation` is already of this kind. + * However if it is not, try to copy it in such object. + */ + final SingleOperation op; - if (SubTypes.isSingleOperation(subOperation)) { ++ if (AbstractCoordinateOperation.isSingleOperation(subOperation)) { + op = (SingleOperation) subOperation; + } else { + final MathTransform subTransform = subOperation.getMathTransform(); + op = factorySIS.createSingleOperation(properties, + subOperation.getSourceCRS(), subOperation.getTargetCRS(), null, + new DefaultOperationMethod(subTransform), subTransform); + } subOperation = new DefaultPassThroughOperation( - IdentifiedObjects.getProperties(subOperation), + properties, stepSourceCRS, stepTargetCRS, - subOperation, + op, firstAffectedCoordinate, numTrailingCoordinates); } @@@ -1151,7 -1127,7 +1151,7 @@@ if (isAxisChange1 && mt1.getSourceDimensions() == mt1.getTargetDimensions()) main = step2; if (isAxisChange2 && mt2.getSourceDimensions() == mt2.getTargetDimensions()) main = step1; } - if (SubTypes.isSingleOperation(main)) { - if (main instanceof SingleOperation) { ++ if (AbstractCoordinateOperation.isSingleOperation(main)) { final SingleOperation op = (SingleOperation) main; main = createFromMathTransform( new HashMap<>(IdentifiedObjects.getProperties(main)), diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java index 1793d3ab3a,446a972e0b..60778fc91d --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java @@@ -792,7 -782,7 +792,7 @@@ class CoordinateOperationRegistry private CoordinateOperation inverse(final CoordinateOperation operation) throws NoninvertibleTransformException, FactoryException { - if (SubTypes.isSingleOperation(operation)) { - if (operation instanceof SingleOperation) { ++ if (AbstractCoordinateOperation.isSingleOperation(operation)) { return inverse((SingleOperation) operation); } CoordinateOperation inverse = AbstractCoordinateOperation.getCachedInverse(operation); @@@ -1004,7 -994,7 +1004,7 @@@ * For example the "Affine" set of parameters depend on the number of dimensions. * The capability to resize an operation method is specific to Apache SIS. */ - if (SubTypes.isSingleOperation(operation)) { - if (operation instanceof SingleOperation) { ++ if (AbstractCoordinateOperation.isSingleOperation(operation)) { final SingleOperation single = (SingleOperation) operation; properties.put(CoordinateOperations.PARAMETERS_KEY, single.getParameterValues()); if (method == null) { @@@ -1152,7 -1142,7 +1152,7 @@@ */ Matrix matrix = MathTransforms.getMatrix(op.getMathTransform()); if (matrix == null) { - if (SubTypes.isSingleOperation(op)) { - if (op instanceof SingleOperation) { ++ if (AbstractCoordinateOperation.isSingleOperation(op)) { if (forward) sourceCRS = toGeodetic3D(sourceCRS, source3D); else targetCRS = toGeodetic3D(targetCRS, target3D); final MathTransform.Builder builder; diff --cc optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/README.md index 20201ad9cf,1b86b69ccd..63331bd775 --- a/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/README.md +++ b/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/README.md @@@ -113,8 -113,9 +113,9 @@@ Adjust version numbers as needed in th cd _<path to SIS project directory>_ gradle clean test jar export CLASSPATH=~/.m2/repository/org/apache/derby/derby/10.14.2.0/derby-10.14.2.0.jar + export CLASSPATH=~/.m2/repository/org/postgresql/postgresql/42.7.7/postgresql-42.7.7.jar:$CLASSPATH export CLASSPATH=~/.m2/repository/javax/measure/unit-api/2.1.3/unit-api-2.1.3.jar:$CLASSPATH -export CLASSPATH=$PWD/geoapi/snapshot/geoapi/target/geoapi-4.0-SNAPSHOT.jar:$CLASSPATH +export CLASSPATH=$PWD/geoapi/snapshot/geoapi/target/geoapi-3.1-SNAPSHOT.jar:$CLASSPATH export CLASSPATH=$PWD/endorsed/build/libs/org.apache.sis.referencing.jar:$CLASSPATH export CLASSPATH=$PWD/endorsed/build/libs/org.apache.sis.metadata.jar:$CLASSPATH export CLASSPATH=$PWD/endorsed/build/libs/org.apache.sis.util.jar:$CLASSPATH
