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 d68a898653dc36e40d7d7a28260a87f9b76ccef0 Merge: eb43834def 9c13d9f4f6 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Wed Jul 10 15:55:35 2024 +0200 Merge branch 'geoapi-4.0' into geoapi-3.1 .../main/org/apache/sis/console/CommandRunner.java | 4 +- .../metadata/iso/extent/DefaultVerticalExtent.java | 4 +- .../sis/metadata/privy/ReferencingServices.java | 12 +- .../main/org/apache/sis/portrayal/Canvas.java | 2 +- .../main/org/apache/sis/geometry/Envelopes.java | 5 +- .../main/org/apache/sis/io/wkt/Convention.java | 7 -- .../main/org/apache/sis/io/wkt/Element.java | 5 +- .../sis/referencing/MultiRegisterOperations.java | 59 --------- .../internal/ParameterizedTransformBuilder.java | 7 +- .../referencing/internal/PositionTransformer.java | 27 +++-- .../apache/sis/referencing/internal/Resources.java | 4 +- .../sis/referencing/internal/Resources.properties | 2 +- .../referencing/internal/Resources_fr.properties | 2 +- .../referencing/internal/ServicesForMetadata.java | 18 +-- .../DefaultCoordinateOperationFactory.java | 3 + .../transform/DefaultMathTransformFactory.java | 2 - .../referencing/privy/GeodeticObjectBuilder.java | 9 +- .../DefaultCoordinateOperationFactoryTest.java | 13 +- .../projection/AuthalicConversionTest.java | 7 +- .../operation/projection/EquirectangularTest.java | 4 +- .../projection/MapProjectionTestCase.java | 5 +- .../operation/projection/MercatorTest.java | 4 +- .../operation/projection/MeridianArcTest.java | 5 +- .../projection/PolarStereographicTest.java | 4 +- .../operation/projection/ProjectionBenchmark.java | 2 +- .../projection/SatelliteTrackingTest.java | 2 +- .../operation/projection/ZonedGridSystemTest.java | 4 +- .../provider/GeocentricTranslationTest.java | 2 +- .../operation/provider/Geographic3Dto2DTest.java | 12 +- .../transform/DefaultMathTransformFactoryTest.java | 5 +- .../transform/MathTransformFactoryBase.java | 29 ----- .../transform/MathTransformFactoryMock.java | 23 +--- .../transform/MolodenskyTransformTest.java | 5 +- .../test/integration/CoordinateOperationTest.java | 15 ++- .../apache/sis/storage/landsat/MetadataReader.java | 17 +-- .../sis/storage/sql/postgis/RasterReader.java | 12 +- .../org/apache/sis/io/stream/ChannelDataInput.java | 3 - .../sis/io/stream/InputStreamArrayGetter.java | 133 --------------------- .../sis/io/stream/InputStreamArrayGetterTest.java | 67 ----------- .../src/org.apache.sis.util/main/module-info.java | 1 + .../main/org/apache/sis/pending/jdk/JDK22.java | 44 +++++++ .../main/org/apache/sis/system/Environment.java | 1 + .../sis/util/collection/FrequencySortedSet.java | 17 ++- .../apache/sis/util/collection/IntegerList.java | 50 +++++++- geoapi/snapshot | 2 +- gradle/wrapper/gradle-wrapper.jar | Bin 63721 -> 43453 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 2 +- gradlew.bat | 20 ++-- incubator/build.gradle.kts | 2 +- netbeans-project/nbproject/project.properties | 4 +- 51 files changed, 242 insertions(+), 448 deletions(-) diff --cc endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/Canvas.java index 675e1512dd,363dc5f7ca..7dd2344385 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/Canvas.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/Canvas.java @@@ -1200,7 -1200,7 +1200,7 @@@ public class Canvas extends Observable */ private CoordinateOperation objectiveToGeographic(final CoordinateReferenceSystem crs) throws FactoryException { final GeographicCRS geoCRS = ReferencingUtilities.toNormalizedGeographicCRS(crs, false, false); - return (geoCRS != null) ? coordinateOperationFactory.createOperation(crs, geoCRS) : null; - return (geoCRS != null) ? coordinateOperationFactory.createOperation(crs, geoCRS, null) : null; ++ return (geoCRS != null) ? coordinateOperationFactory.createOperation(crs, geoCRS, (CanvasContext) null) : null; } /** diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/ParameterizedTransformBuilder.java index d439168dd4,735edeafd7..13cdbacc5b --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/ParameterizedTransformBuilder.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/ParameterizedTransformBuilder.java @@@ -654,7 -654,8 +654,8 @@@ public class ParameterizedTransformBuil if (provider instanceof AbstractProvider) { provider = ((AbstractProvider) provider).variantFor(transform); } - return swapAndScaleAxes(unique(transform)); - // A call to `unique` needs to be last because it set `factory.lastMethod` as a side-effect. ++ // A call to `unique` needs to be last because it sets `factory.lastMethod` as a side-effect. + return unique(swapAndScaleAxes(unique(transform))); } catch (FactoryException exception) { if (warning != null) { exception.addSuppressed(warning); diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java index 3c86cbe042,17b4758b75..49ea22c4ab --- 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 @@@ -674,28 -656,6 +674,31 @@@ next: for (int i=components.size(); - return single; } + /** + * Finds or creates an operation for conversion or transformation between two coordinate reference systems. + * If an operation exists, it is returned. If more than one operation exists, the operation having the widest + * domain of validity is returned. If no operation exists, then an exception is thrown. + * + * <p>The default implementation delegates to <code>{@linkplain #createOperation(CoordinateReferenceSystem, + * CoordinateReferenceSystem, CoordinateOperationContext) createOperation}(sourceCRS, targetCRS, null)}</code>.</p> + * + * @param sourceCRS input coordinate reference system. + * @param targetCRS output coordinate reference system. + * @return a coordinate operation from {@code sourceCRS} to {@code targetCRS}. + * @throws OperationNotFoundException if no operation path was found from {@code sourceCRS} to {@code targetCRS}. + * @throws FactoryException if the operation creation failed for some other reason. ++ * ++ * @deprecated Replaced by {@link #createOperation(CoordinateReferenceSystem, CoordinateReferenceSystem, CoordinateOperationContext)}. + */ + @Override ++ @Deprecated(since="1.5") + public CoordinateOperation createOperation(final CoordinateReferenceSystem sourceCRS, + final CoordinateReferenceSystem targetCRS) + throws OperationNotFoundException, FactoryException + { + return createOperation(sourceCRS, targetCRS, (CoordinateOperationContext) null); + } + /** * Finds or creates an operation for conversion or transformation between two coordinate reference systems. * If an operation exists, it is returned. If more than one operation exists, then the operation having the diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/privy/GeodeticObjectBuilder.java index 3d05d6773e,0c84f2a1eb..897b375bbd --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/privy/GeodeticObjectBuilder.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/privy/GeodeticObjectBuilder.java @@@ -63,7 -63,11 +63,8 @@@ import org.apache.sis.parameter.Paramet // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.referencing.ObjectDomain; + import org.opengis.referencing.operation.MathTransform; -// Specific to the geoapi-4.0 branch: -import org.opengis.referencing.crs.GeodeticCRS; - /** * Helper methods for building Coordinate Reference Systems and related objects. diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java index 6ac6f3c8a0,8decba736b..33c02b608d --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java @@@ -62,6 -62,6 +62,11 @@@ import static org.apache.sis.referencin @Execution(ExecutionMode.SAME_THREAD) @TestInstance(TestInstance.Lifecycle.PER_CLASS) public final class DefaultCoordinateOperationFactoryTest extends MathTransformTestCase { ++ /** ++ * For avoiding ambiguity. ++ */ ++ private static final CoordinateOperationContext CONTEXT = null; ++ /** * The transformation factory to use for testing. */ @@@ -153,7 -153,7 +158,7 @@@ public void testProjectionAndLongitudeRotation() throws ParseException, FactoryException, TransformException { final CoordinateReferenceSystem sourceCRS = parse("$NTF"); final CoordinateReferenceSystem targetCRS = parse("$Mercator"); - final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS); - final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS, null); ++ final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS, CONTEXT); assertSame (sourceCRS, operation.getSourceCRS()); assertSame (targetCRS, operation.getTargetCRS()); assertInstanceOf(ConcatenatedOperation.class, operation); @@@ -214,7 -214,7 +219,7 @@@ " TimeUnit[“day”, 86400]]]"); final CoordinateReferenceSystem targetCRS = parse("$Mercator"); - final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS); - final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS, null); ++ final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS, CONTEXT); assertSame (sourceCRS, operation.getSourceCRS()); assertSame (targetCRS, operation.getTargetCRS()); assertInstanceOf(ConcatenatedOperation.class, operation); @@@ -297,7 -297,7 +302,7 @@@ " Unit[“metre”, 1],\n" + " Id[“EPSG”, 3857]]"); - final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS); - final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS, null); ++ final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS, CONTEXT); assertSame (sourceCRS, operation.getSourceCRS()); assertSame (targetCRS, operation.getTargetCRS()); assertInstanceOf(ConcatenatedOperation.class, operation); @@@ -330,7 -330,7 +335,7 @@@ public void testPositionVectorTransformation() throws ParseException, FactoryException, TransformException { final CoordinateReferenceSystem sourceCRS = CommonCRS.WGS84.geographic(); final CoordinateReferenceSystem targetCRS = parse(CoordinateOperationFinderTest.AGD66()); - final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS); - final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS, null); ++ final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS, CONTEXT); transform = operation.getMathTransform(); tolerance = Formulas.LINEAR_TOLERANCE; λDimension = new int[] {0}; diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java index 0a9459255d,12c76e45b5..5f4a4291b1 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java @@@ -93,20 -92,9 +92,20 @@@ public final class MathTransformFactory */ @Override public Set<OperationMethod> getAvailableMethods(Class<? extends SingleOperation> type) { - return type.isInstance(method) ? Set.of(method) : Set.of(); + return type.isAssignableFrom(Conversion.class) ? Set.of(method) : Set.of(); } + /** + * Returns the last method used, which can only be null or the method given at construction time. + * + * @return the method given at construction time. + */ + @Override + @Deprecated + public OperationMethod getLastMethodUsed() { + return method; + } + /** * Returns the builder for the operation method. * diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/CoordinateOperationTest.java index 5170f4ce91,ed84528418..6946f10f20 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/CoordinateOperationTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/CoordinateOperationTest.java @@@ -44,6 -43,6 +43,9 @@@ import static org.junit.jupiter.api.Ass import org.apache.sis.referencing.operation.transform.MathTransformTestCase; import static org.apache.sis.test.Assertions.assertEqualsIgnoreMetadata; ++// Specific to the geoapi-3.1 and geoapi-4.0 branches: ++import org.apache.sis.referencing.operation.CoordinateOperationContext; ++ /** * Tests mixing use of EPSG dataset, change of axes convention, application of math transforms, @@@ -54,6 -53,6 +56,11 @@@ * @author Michael Arneson (OSDU) */ public final class CoordinateOperationTest extends MathTransformTestCase { ++ /** ++ * For avoiding ambiguity. ++ */ ++ private static final CoordinateOperationContext CONTEXT = null; ++ /** * The transformation factory to use for testing. */ @@@ -81,7 -80,7 +88,7 @@@ final Ellipsoid ellipsoid = CommonCRS.WGS84.ellipsoid(); final CoordinateReferenceSystem sourceCRS = AbstractCRS.castOrCopy(CommonCRS.WGS84.geographic3D()).forConvention(AxesConvention.RIGHT_HANDED); final CoordinateReferenceSystem targetCRS = CommonCRS.WGS84.geocentric(); - final CoordinateOperation operation = opFactory.createOperation(sourceCRS, targetCRS); - final CoordinateOperation operation = opFactory.createOperation(sourceCRS, targetCRS, null); ++ final CoordinateOperation operation = opFactory.createOperation(sourceCRS, targetCRS, CONTEXT); transform = operation.getMathTransform(); final int dimension = transform.getSourceDimensions(); assertEquals(3, dimension); @@@ -237,7 -236,7 +244,7 @@@ CoordinateReferenceSystem sourceCRS = crsFactory.createCoordinateReferenceSystem("3001"); CoordinateReferenceSystem targetCRS = crsFactory.createCoordinateReferenceSystem("4211"); - CoordinateOperation operation = opFactory.createOperation(sourceCRS, targetCRS); - CoordinateOperation operation = opFactory.createOperation(sourceCRS, targetCRS, null); ++ CoordinateOperation operation = opFactory.createOperation(sourceCRS, targetCRS, CONTEXT); MathTransform mt = operation.getMathTransform(); double[] expectedXyValues = new double[] {-2.0, -71.0}; diff --cc geoapi/snapshot index cea536768f,e55b18a854..c93fa79af9 --- a/geoapi/snapshot +++ b/geoapi/snapshot @@@ -1,1 -1,1 +1,1 @@@ - Subproject commit cea536768f975f275f2fb4d32d99274e094f4b53 -Subproject commit e55b18a85498f5baaa5ca83cce323a1cfe038eda ++Subproject commit c93fa79af984aecb487e55de301ce12afe9f72b7