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 3990491cc6ee92653f598d12f23cab1d1be796ff Merge: 2466fc7ddf 969036a87b Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Thu Mar 14 19:09:18 2024 +0100 Merge branch 'geoapi-3.1': - Documentation fixes. - Rename "ordinate" as "coordinate" where possible. .gitignore | 3 + .../buildtools/coding/VerifyVersionInJavadoc.java | 2 +- .../coverage/grid/CoordinateOperationFinder.java | 2 +- .../coverage/grid/FractionalGridCoordinates.java | 2 +- .../apache/sis/coverage/grid/GridCoverage2D.java | 4 +- .../apache/sis/coverage/privy/TileOpExecutor.java | 2 +- .../apache/sis/geometry/wrapper/jts/Wrapper.java | 6 +- .../main/org/apache/sis/image/ErrorHandler.java | 2 +- .../org/apache/sis/image/MultiSourceLayout.java | 5 +- .../main/org/apache/sis/image/ResamplingGrid.java | 12 +- .../org/apache/sis/image/SourceAlignedImage.java | 8 +- .../apache/sis/image/processing/TiledProcess.java | 6 +- .../sis/image/processing/isoline/Tracer.java | 2 +- .../sis/coverage/grid/GridDerivationTest.java | 2 +- .../apache/sis/coverage/grid/GridExtentTest.java | 2 +- .../sis/metadata/iso/citation/Citations.java | 2 +- .../main/org/apache/sis/util/iso/Names.java | 2 +- .../main/org/apache/sis/xml/Namespaces.java | 2 +- .../org/apache/sis/xml/TransformingReader.java | 2 +- .../referencing/gazetteer/AbstractLocation.java | 2 +- .../sis/geometry/AbstractDirectPosition.java | 76 ++- .../org/apache/sis/geometry/AbstractEnvelope.java | 10 +- .../org/apache/sis/geometry/DirectPosition1D.java | 6 +- .../org/apache/sis/geometry/DirectPosition2D.java | 51 +- .../main/org/apache/sis/geometry/Envelopes.java | 2 +- .../apache/sis/geometry/GeneralDirectPosition.java | 28 +- .../main/org/apache/sis/io/wkt/WKTDictionary.java | 2 +- .../apache/sis/referencing/GeodeticCalculator.java | 6 +- .../operation/builder/LinearTransformBuilder.java | 4 +- .../sis/referencing/privy/DirectPositionView.java | 6 +- .../apache/sis/geometry/AbstractEnvelopeTest.java | 60 +-- .../apache/sis/geometry/CoordinateFormatTest.java | 1 - .../sis/geometry/GeneralDirectPositionTest.java | 6 +- .../apache/sis/geometry/GeneralEnvelopeTest.java | 16 +- .../org/apache/sis/referencing/Assertions.java | 4 +- .../builder/LinearTransformBuilderTest.java | 6 +- .../transform/ProjectiveTransformTest.java | 3 +- .../apache/sis/storage/landsat/MetadataReader.java | 2 +- .../sis/storage/geotiff/ImageFileDirectory.java | 2 +- .../sis/storage/geotiff/reader/CRSBuilderTest.java | 2 +- .../org/apache/sis/storage/DataStoreException.java | 3 +- .../apache/sis/storage/csv/FeatureIterator.java | 2 +- .../apache/sis/storage/image/WorldFileStore.java | 3 +- .../org/apache/sis/storage/folder/StoreTest.java | 2 +- .../main/org/apache/sis/util/CharSequences.java | 42 +- .../org/apache/sis/util/collection/RangeSet.java | 6 +- .../org/apache/sis/util/collection/TreeTable.java | 2 +- .../sis/util/privy/LocalizedParseException.java | 12 +- .../org/apache/sis/util/CharSequencesTest.java | 4 +- .../shapefile/shp/ShapeGeometryEncoder.java | 6 +- .../sis/storage/shapefile/shp/ShapeHeader.java | 4 +- optional/build.gradle.kts | 29 ++ .../main/org/apache/sis/gui/DataViewer.java | 7 +- .../apache/sis/gui/coverage/CoverageExplorer.java | 25 +- .../org/apache/sis/gui/coverage/package-info.java | 2 +- .../org/apache/sis/gui/dataset/WindowHandler.java | 2 +- .../org/apache/sis/gui/dataset/WindowManager.java | 7 +- .../org/apache/sis/gui/dataset/package-info.java | 2 +- .../main/org/apache/sis/gui/internal/FontGIS.java | 517 +++++++++++++++++++++ .../main/org/apache/sis/gui/internal/Styles.java | 7 - .../org/apache/sis/gui/internal/ToolbarButton.java | 7 +- .../org/apache/sis/gui/map/ValuesFormatter.java | 2 +- .../sis/gui/controls/ValueColorMapperApp.java | 3 +- 63 files changed, 862 insertions(+), 197 deletions(-) diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractDirectPosition.java index eda9f4a96a,5713010cd9..f741148698 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractDirectPosition.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractDirectPosition.java @@@ -115,16 -116,16 +115,73 @@@ public abstract class AbstractDirectPos * Returns a sequence of numbers that hold the coordinate of this position in its reference system. * * @return the coordinates. ++ * ++ * @deprecated Renamed {@link #getCoordinates()} for consistency with ISO 19111 terminology. */ @Override ++ @Deprecated(since="1.5") + public double[] getCoordinate() { ++ return getCoordinates(); ++ } ++ ++ /** ++ * Returns a sequence of numbers that hold the coordinate of this position in its reference system. ++ * ++ * @return the coordinates. ++ */ + public double[] getCoordinates() { final double[] coordinates = new double[getDimension()]; for (int i=0; i<coordinates.length; i++) { - coordinates[i] = getOrdinate(i); + coordinates[i] = getCoordinate(i); } return coordinates; } ++ /** ++ * Returns the coordinate at the specified dimension. ++ * ++ * @param dimension the dimension in the range 0 to {@linkplain #getDimension dimension}-1. ++ * @return the coordinate at the specified dimension. ++ * @throws IndexOutOfBoundsException if the given index is negative or is equal or greater ++ * than the {@linkplain #getDimension() number of dimensions}. ++ * ++ * @deprecated Renamed {@link #getCoordinate(int)} for consistency with ISO 19111 terminology. ++ */ ++ @Deprecated(since="1.5") ++ public double getOrdinate(int dimension) throws IndexOutOfBoundsException { ++ return getCoordinate(dimension); ++ } ++ ++ /** ++ * Returns the coordinate at the specified dimension. ++ * ++ * @param dimension the dimension in the range 0 to {@linkplain #getDimension dimension}-1. ++ * @return the coordinate at the specified dimension. ++ * @throws IndexOutOfBoundsException if the given index is negative or is equal or greater ++ * than the {@linkplain #getDimension() number of dimensions}. ++ * ++ * @since 1.5 ++ */ ++ public abstract double getCoordinate(int dimension) throws IndexOutOfBoundsException; ++ ++ /** ++ * Sets the coordinate value along the specified dimension. ++ * ++ * @param dimension the dimension for the coordinate of interest. ++ * @param value the coordinate value of interest. ++ * @throws IndexOutOfBoundsException if the given index is negative or is equal or greater ++ * than the {@linkplain #getDimension() position dimension}. ++ * @throws UnsupportedOperationException if this direct position is immutable. ++ * ++ * @deprecated Renamed {@link #setCoordinate(int, double)} for consistency with ISO 19111 terminology. ++ */ ++ @Deprecated(since="1.5") ++ public void setOrdinate(int dimension, double value) ++ throws IndexOutOfBoundsException, UnsupportedOperationException ++ { ++ setCoordinate(dimension, value); ++ } ++ /** * Sets the coordinate value along the specified dimension. * @@@ -137,8 -138,8 +194,7 @@@ * than the {@linkplain #getDimension() position dimension}. * @throws UnsupportedOperationException if this direct position is immutable. */ -- @Override - public void setOrdinate(int dimension, double value) { + public void setCoordinate(int dimension, double value) { throw new UnsupportedOperationException(Errors.format(Errors.Keys.UnmodifiableObject_1, getClass())); } @@@ -169,7 -170,7 +225,7 @@@ } } for (int i=0; i<dimension; i++) { - setOrdinate(i, position.getOrdinate(i)); - setCoordinate(i, position.getCoordinate(i)); ++ setCoordinate(i, position.getOrdinate(i)); } } else { for (int i=0; i<dimension; i++) { diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/DirectPosition2D.java index f3b8c3147a,413374bb47..c8a1bdbd9e --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/DirectPosition2D.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/DirectPosition2D.java @@@ -222,31 -222,35 +222,65 @@@ public class DirectPosition2D extends P this.crs = crs; } + /** + * Returns a sequence of numbers that hold the coordinate of this position in its reference system. + * + * <div class="note"><b>API note:</b> + * This method is final for ensuring consistency with the {@code x} and {@code y} fields, which are public.</div> + * + * @return the coordinate. ++ * @deprecated Renamed {@link #getCoordinates()} for consistency with ISO 19111 terminology. + */ + @Override ++ @Deprecated(since="1.5") + public final double[] getCoordinate() { ++ return getCoordinates(); ++ } ++ + /** + * Returns a sequence of numbers that hold the coordinate of this position in its reference system. + * + * <div class="note"><b>API note:</b> + * This method is final for ensuring consistency with the {@code x} and {@code y} fields, which are public.</div> + * + * @return the coordinate. + * + * @since 1.5 + */ - @Override + public final double[] getCoordinates() { return new double[] {x,y}; } + /** + * Returns the coordinate at the specified dimension. + * + * <div class="note"><b>API note:</b> + * This method is final for ensuring consistency with the {@code x} and {@code y} fields, which are public.</div> + * + * @param dimension the dimension in the range 0 to 1 inclusive. + * @return the coordinate at the specified dimension. + * @throws IndexOutOfBoundsException if the specified dimension is out of bounds. ++ * @deprecated Renamed {@link #getCoordinate(int)} for consistency with ISO 19111 terminology. + */ + @Override ++ @Deprecated(since="1.5") + public final double getOrdinate(final int dimension) throws IndexOutOfBoundsException { ++ return getCoordinate(dimension); ++ } ++ + /** + * Returns the coordinate at the specified dimension. + * + * <div class="note"><b>API note:</b> + * This method is final for ensuring consistency with the {@code x} and {@code y} fields, which are public.</div> + * + * @param dimension the dimension in the range 0 to 1 inclusive. + * @return the coordinate at the specified dimension. + * @throws IndexOutOfBoundsException if the specified dimension is out of bounds. + * + * @since 1.5 + */ - @Override + public final double getCoordinate(final int dimension) throws IndexOutOfBoundsException { switch (dimension) { case 0: return x; case 1: return y; @@@ -254,15 -258,17 +288,30 @@@ } } + /** + * Sets the coordinate value along the specified dimension. + * + * @param dimension the dimension for the coordinate of interest. + * @param value the coordinate value of interest. + * @throws IndexOutOfBoundsException if the specified dimension is out of bounds. ++ * @deprecated Renamed {@link #setCoordinate(int, double)} for consistency with ISO 19111 terminology. + */ + @Override ++ @Deprecated(since="1.5") + public void setOrdinate(int dimension, double value) throws IndexOutOfBoundsException { ++ setCoordinate(dimension, value); ++ } ++ + /** + * Sets the coordinate value along the specified dimension. + * + * @param dimension the dimension for the coordinate of interest. + * @param value the coordinate value of interest. + * @throws IndexOutOfBoundsException if the specified dimension is out of bounds. + * + * @since 1.5 + */ - @Override + public void setCoordinate(int dimension, double value) throws IndexOutOfBoundsException { switch (dimension) { case 0: x = value; break; case 1: y = value; break; diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/AbstractEnvelopeTest.java index c14e1dc1f9,5a0cffcdb0..7b9d21980e --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/AbstractEnvelopeTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/AbstractEnvelopeTest.java @@@ -255,16 -252,16 +255,16 @@@ public final class AbstractEnvelopeTes final Envelope envelope = create(type, 12, -364, 30, 50); final DirectPosition lower = envelope.getLowerCorner(); final DirectPosition upper = envelope.getUpperCorner(); - assertEquals( 30, envelope.getMinimum (1), label); - assertEquals( 50, envelope.getMaximum (1), label); - assertEquals( 40, envelope.getMedian (1), label); - assertEquals( 20, envelope.getSpan (1), label); - assertEquals( 12, lower .getOrdinate(0), label); - assertEquals(-180, envelope.getMinimum (0), label); - assertEquals(-364, upper .getOrdinate(0), label); - assertEquals(+180, envelope.getMaximum (0), label); - assertEquals( 4, envelope.getMedian (0), label); // Note the alternance with the previous test methods. - assertEquals( NaN, envelope.getSpan (0), label); // testCrossingAntiMeridian() + 360°. + assertEquals( 30, envelope.getMinimum (1), label); + assertEquals( 50, envelope.getMaximum (1), label); + assertEquals( 40, envelope.getMedian (1), label); + assertEquals( 20, envelope.getSpan (1), label); - assertEquals( 12, lower .getCoordinate(0), label); ++ assertEquals( 12, lower .getOrdinate (0), label); + assertEquals(-180, envelope.getMinimum (0), label); - assertEquals(-364, upper .getCoordinate(0), label); ++ assertEquals(-364, upper .getOrdinate (0), label); + assertEquals(+180, envelope.getMaximum (0), label); + assertEquals( 4, envelope.getMedian (0), label); // Note the alternance with the previous test methods. + assertEquals( NaN, envelope.getSpan (0), label); // testCrossingAntiMeridian() + 360°. if (envelope instanceof AbstractEnvelope ext) { assertTrue (ext.contains (inside), label); assertFalse(ext.contains (outside), label); @@@ -308,16 -305,16 +308,16 @@@ final Envelope envelope = create(type, 372, -364, 30, 50); final DirectPosition lower = envelope.getLowerCorner(); final DirectPosition upper = envelope.getUpperCorner(); - assertEquals( 30, envelope.getMinimum (1), label); - assertEquals( 50, envelope.getMaximum (1), label); - assertEquals( 40, envelope.getMedian (1), label); - assertEquals( 20, envelope.getSpan (1), label); - assertEquals( 372, lower .getOrdinate(0), label); - assertEquals(-180, envelope.getMinimum (0), label); - assertEquals(-364, upper .getOrdinate(0), label); - assertEquals(+180, envelope.getMaximum (0), label); - assertEquals(-176, envelope.getMedian (0), label); // Note the alternance with the previous test methods. - assertEquals( NaN, envelope.getSpan (0), label); // testCrossingAntiMeridianTwice() + 360°. + assertEquals( 30, envelope.getMinimum (1), label); + assertEquals( 50, envelope.getMaximum (1), label); + assertEquals( 40, envelope.getMedian (1), label); + assertEquals( 20, envelope.getSpan (1), label); - assertEquals( 372, lower .getCoordinate(0), label); ++ assertEquals( 372, lower .getOrdinate (0), label); + assertEquals(-180, envelope.getMinimum (0), label); - assertEquals(-364, upper .getCoordinate(0), label); ++ assertEquals(-364, upper .getOrdinate (0), label); + assertEquals(+180, envelope.getMaximum (0), label); + assertEquals(-176, envelope.getMedian (0), label); // Note the alternance with the previous test methods. + assertEquals( NaN, envelope.getSpan (0), label); // testCrossingAntiMeridianTwice() + 360°. switch (type) { default: { final var ext = (AbstractEnvelope) envelope; @@@ -412,16 -409,16 +412,16 @@@ final Envelope envelope = create(type, 0.0, -0.0, 30, 50); final DirectPosition lower = envelope.getLowerCorner(); final DirectPosition upper = envelope.getUpperCorner(); - assertEquals( 30, envelope.getMinimum (1), label); - assertEquals( 50, envelope.getMaximum (1), label); - assertEquals( 40, envelope.getMedian (1), label); - assertEquals( 20, envelope.getSpan (1), label); - assertEquals( 0.0, lower .getOrdinate(0), label); - assertEquals(-180, envelope.getMinimum (0), label); - assertEquals(-0.0, upper .getOrdinate(0), label); - assertEquals(+180, envelope.getMaximum (0), label); - assertEquals( 180, envelope.getMedian (0), label); - assertEquals( 360, envelope.getSpan (0), label); + assertEquals( 30, envelope.getMinimum (1), label); + assertEquals( 50, envelope.getMaximum (1), label); + assertEquals( 40, envelope.getMedian (1), label); + assertEquals( 20, envelope.getSpan (1), label); - assertEquals( 0.0, lower .getCoordinate(0), label); ++ assertEquals( 0.0, lower .getOrdinate (0), label); + assertEquals(-180, envelope.getMinimum (0), label); - assertEquals(-0.0, upper .getCoordinate(0), label); ++ assertEquals(-0.0, upper .getOrdinate (0), label); + assertEquals(+180, envelope.getMaximum (0), label); + assertEquals( 180, envelope.getMedian (0), label); + assertEquals( 360, envelope.getSpan (0), label); switch (type) { default: { final var ext = (AbstractEnvelope) envelope; diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/GeneralEnvelopeTest.java index 7a24f96126,5ecf0ba1bd..3bf7fa7e30 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/GeneralEnvelopeTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/GeneralEnvelopeTest.java @@@ -118,14 -115,14 +118,14 @@@ public class GeneralEnvelopeTest extend } final DirectPosition lower = test.getLowerCorner(); final DirectPosition upper = test.getUpperCorner(); - assertEquals(xLower, lower.getOrdinate(0), "lower"); - assertEquals(xUpper, upper.getOrdinate(0), "upper"); - assertEquals(xmin, test .getMinimum (0), "xmin"); - assertEquals(xmax, test .getMaximum (0), "xmax"); - assertEquals(ymin, test .getMinimum (1), "ymin"); - assertEquals(ymax, test .getMaximum (1), "ymax"); - assertEquals(ymin, lower.getOrdinate(1), "ymin"); - assertEquals(ymax, upper.getOrdinate(1), "ymax"); - assertEquals(xLower, lower.getCoordinate(0), "lower"); - assertEquals(xUpper, upper.getCoordinate(0), "upper"); ++ assertEquals(xLower, lower.getOrdinate (0), "lower"); ++ assertEquals(xUpper, upper.getOrdinate (0), "upper"); + assertEquals(xmin, test .getMinimum (0), "xmin"); + assertEquals(xmax, test .getMaximum (0), "xmax"); + assertEquals(ymin, test .getMinimum (1), "ymin"); + assertEquals(ymax, test .getMaximum (1), "ymax"); - assertEquals(ymin, lower.getCoordinate(1), "ymin"); - assertEquals(ymax, upper.getCoordinate(1), "ymax"); ++ assertEquals(ymin, lower.getOrdinate (1), "ymin"); ++ assertEquals(ymax, upper.getOrdinate (1), "ymax"); if (test instanceof Envelope2D ri) { assertEquals(xmin, ri.getMinX(), "xmin"); assertEquals(xmax, ri.getMaxX(), "xmax"); diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java index 79523b4beb,8f737b500b..e315d47e87 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java @@@ -56,23 -54,11 +56,22 @@@ import org.apache.sis.test.GeoapiAssert * * @author Martin Desruisseaux (Geomatys) */ +@SuppressWarnings("doclint:missing") @ExtendWith(FailureDetailsReporter.class) -public class ProjectiveTransformTest extends AffineTransformTest { +public class ProjectiveTransformTest extends TransformTestCase { + /** + * The factory to use for creating linear transforms. + */ + private final MathTransformFactory mtFactory; + + /** + * The matrix for the tested transform. + */ + private Matrix matrix; + /** * A math transform factory which delegates instantiations to the enclosing test class. - * This is a workaround for RFE #4093999 ("Relax constraint on placement of this()/super() - * call in constructors"). + * This is a workaround while waiting for JEP 447: Statements before super(…). */ private static final class Proxy extends MathTransformFactoryBase { /** The enclosing test class. */ diff --cc optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageExplorer.java index 5247fa3e15,8e6f1b9e4b..a6cc599843 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageExplorer.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageExplorer.java @@@ -68,10 -69,10 +69,10 @@@ import org.apache.sis.gui.map.StatusBar * * <h2>Limitations</h2> * Current implementation is restricted to {@link GridCoverage} instances, but a future - * implementation may generalize to {@link org.opengis.coverage.Coverage} instances. + * implementation may generalize to {@code org.opengis.coverage.Coverage} instances. * * @author Martin Desruisseaux (Geomatys) - * @version 1.4 + * @version 1.5 * * @see CoverageCanvas * @see GridView