This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 975aed6c1817f8b45459041e5530793d1d630e11
Merge: 86b20ccbda bede3d4c05
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Fri Jun 28 06:06:19 2024 +0200

    Merge branch 'geoapi-3.1'
    - Consolidation in the way to get or create `OperationMethod`
    - Fix in shapefile DBF field parsing

 .../org/apache/sis/coverage/grid/PixelInCell.java  |  5 ++-
 .../org/apache/sis/temporal/DefaultInstant.java    |  4 +-
 .../main/org/apache/sis/util/iso/Types.java        | 21 ++++++---
 .../org/apache/sis/geometry/CoordinateFormat.java  |  6 ++-
 .../apache/sis/io/wkt/GeodeticObjectParser.java    | 10 ++---
 .../org/apache/sis/io/wkt/MathTransformParser.java | 22 +++++-----
 .../DefaultCoordinateOperationFactory.java         | 16 +------
 .../transform/DefaultMathTransformFactory.java     |  7 +--
 .../sis/referencing/privy/AxisDirections.java      |  5 ++-
 .../referencing/privy/CoordinateOperations.java    | 26 ++++++++---
 .../referencing/privy/GeodeticObjectBuilder.java   |  4 +-
 .../privy/ReferencingFactoryContainer.java         | 51 ++++++++++++++++++++--
 .../sis/storage/geotiff/reader/CRSBuilder.java     | 17 ++++++--
 .../apache/sis/storage/netcdf/base/CRSBuilder.java |  6 +--
 .../apache/sis/storage/netcdf/base/Decoder.java    | 13 +++++-
 .../sis/storage/netcdf/base/GridMapping.java       |  9 ++--
 .../sis/storage/netcdf/classic/ChannelDecoder.java |  4 +-
 .../sis/storage/netcdf/ucar/DecoderWrapper.java    |  2 +-
 .../sis/util/resources/IndexedResourceBundle.java  |  2 +-
 .../apache/sis/storage/shapefile/dbf/DBFField.java | 38 ++++++++++++++--
 20 files changed, 187 insertions(+), 81 deletions(-)

diff --cc 
endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/PixelInCell.java
index a50a4ad129,b9771e9d7f..74c450b162
--- 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/PixelInCell.java
+++ 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/PixelInCell.java
@@@ -16,8 -16,12 +16,9 @@@
   */
  package org.apache.sis.coverage.grid;
  
+ import java.util.Optional;
  import org.opengis.metadata.spatial.PixelOrientation;
  
 -// Specific to the geoapi-3.1 and geoapi-4.0 branches:
 -import org.opengis.util.ControlledVocabulary;
 -
  
  /**
   * Whether a "grid to real world" transform gives the coordinates of the cell 
corner or cell center.
diff --cc 
endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java
index abaa640846,d50bb50eca..ee10e43744
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java
@@@ -1299,12 -1285,9 +1299,10 @@@ class GeodeticObjectParser extends Math
           * not use the identifier.
           */
          FactoryException suppressed = null;
-         final CoordinateOperationFactory opFactory = 
factories.getCoordinateOperationFactory();
-         final MathTransformFactory mtFactory = 
factories.getMathTransformFactory();
 -        if (id != null) try {
 +        if (id instanceof ReferenceIdentifier) try {
              // CodeSpace is a mandatory attribute in ID[…] elements, so we do 
not test for null values.
-             return ServicesForMetadata.getOperationMethod(opFactory, 
mtFactory,
-                     ((ReferenceIdentifier) id).getCodeSpace() + 
Constants.DEFAULT_SEPARATOR + id.getCode());
 -            return factories.findOperationMethod(id.getCodeSpace() + 
Constants.DEFAULT_SEPARATOR + id.getCode());
++            final var rid = (ReferenceIdentifier) id;
++            return factories.findOperationMethod(rid.getCodeSpace() + 
Constants.DEFAULT_SEPARATOR + rid.getCode());
          } catch (FactoryException e) {
              suppressed = e;
          }
diff --cc 
endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
index 4a31808d7f,29a79b6515..c71ea9a5da
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
@@@ -280,20 -278,9 +278,8 @@@ public class DefaultCoordinateOperation
       *
       * @see DefaultMathTransformFactory#getOperationMethod(String)
       */
 -    @Override
      public OperationMethod getOperationMethod(String name) throws 
FactoryException {
-         ArgumentChecks.ensureNonEmpty("name", name = name.strip());
-         @SuppressWarnings("LocalVariableHidesMemberVariable")
-         final MathTransformFactory mtFactory = getMathTransformFactory();
-         if (mtFactory instanceof DefaultMathTransformFactory) {
-             return ((DefaultMathTransformFactory) 
mtFactory).getOperationMethod(name);
-         }
-         final OperationMethod method = 
CoordinateOperations.getOperationMethod(
-                 mtFactory.getAvailableMethods(SingleOperation.class), name);
-         if (method != null) {
-             return method;
-         }
-         throw new 
NoSuchIdentifierException(Resources.forProperties(defaultProperties)
-                 .getString(Resources.Keys.NoSuchOperationMethod_2, name, 
URLs.OPERATION_METHODS), name);
+         return new ReferencingFactoryContainer(null, null, null, null, null, 
mtFactory).findOperationMethod(name);
      }
  
      /**
diff --cc 
endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/privy/ReferencingFactoryContainer.java
index c0007a6018,0e949be56f..9c5773cbde
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/privy/ReferencingFactoryContainer.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/privy/ReferencingFactoryContainer.java
@@@ -211,9 -218,9 +218,9 @@@ public class ReferencingFactoryContaine
          if (type == DatumFactory.class)               return datumFactory     
!= (datumFactory     = (DatumFactory)               factory);
          if (type == CSFactory.class)                  return csFactory        
!= (csFactory        = (CSFactory)                  factory);
          if (type == CRSFactory.class)                 return crsFactory       
!= (crsFactory       = (CRSFactory)                 factory);
 -        if (type == CoordinateOperationFactory.class) return operationFactory 
!= (operationFactory = (CoordinateOperationFactory) factory);
 +        if (type == CoordinateOperationFactory.class) return operationFactory 
!= (operationFactory = (DefaultCoordinateOperationFactory) factory);
          if (type == MathTransformFactory.class)       return mtFactory        
!= (mtFactory        = (MathTransformFactory)       factory);
-         throw new 
IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentValue_2, 
"type", type));
+         throw new 
IllegalArgumentException(Errors.forLocale(getLocale()).getString(Errors.Keys.IllegalArgumentValue_2,
 "type", type));
      }
  
      /**
diff --cc 
endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/GridMapping.java
index d3bd0f287a,07133b2cab..78856ab0cd
--- 
a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/GridMapping.java
+++ 
b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/GridMapping.java
@@@ -41,6 -41,6 +41,7 @@@ import org.opengis.referencing.cs.Coord
  import org.opengis.referencing.crs.ProjectedCRS;
  import org.opengis.referencing.crs.GeographicCRS;
  import org.opengis.referencing.crs.CoordinateReferenceSystem;
++import org.opengis.referencing.operation.CoordinateOperationFactory;
  import org.opengis.referencing.operation.TransformException;
  import org.opengis.referencing.operation.OperationMethod;
  import org.opengis.referencing.operation.MathTransform;
@@@ -77,9 -77,9 +78,6 @@@ import org.apache.sis.io.wkt.WKTFormat
  import org.apache.sis.io.wkt.Warnings;
  import org.apache.sis.measure.Units;
  
- // Specific to the main branch:
- import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
 -// Specific to the geoapi-3.1 and geoapi-4.0 branches:
 -import org.opengis.referencing.operation.CoordinateOperationFactory;
--
  
  /**
   * Temporary objects for creating a {@link GridGeometry} instance defined by 
attributes on a variable.

Reply via email to