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 84a6d62055cda36f8c55ef11694b762bbb02258e Merge: 1531118a77 9160018564 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Fri Dec 27 11:17:07 2024 +0100 Merge branch 'geoapi-3.1' .../sis/buildtools/coding/ReorganizeImports.java | 2 +- .../org/apache/sis/buildtools/book/OGC.lst | 1 + .../org/apache/sis/cloud/aws/s3/FileService.java | 36 +- .../main/org/apache/sis/cloud/aws/s3/KeyPath.java | 4 +- .../apache/sis/cloud/aws/s3/ObjectAttributes.java | 5 +- .../org/apache/sis/cloud/aws/s3/package-info.java | 31 +- .../coverage/grid/BandAggregateGridCoverage.java | 10 +- .../coverage/grid/CoordinateOperationFinder.java | 2 + .../org/apache/sis/coverage/grid/GridCoverage.java | 5 +- .../sis/coverage/grid/GridCoverageBuilder.java | 9 +- .../sis/coverage/grid/GridCoverageProcessor.java | 8 +- .../apache/sis/coverage/grid/GridDerivation.java | 6 +- .../org/apache/sis/coverage/grid/GridGeometry.java | 219 ++++-- .../apache/sis/coverage/grid/ImageRenderer.java | 13 +- ...rceArgument.java => BandAggregateArgument.java} | 8 +- .../sis/coverage/privy/ColorModelBuilder.java | 757 +++++---------------- .../sis/coverage/privy/ColorModelFactory.java | 57 +- .../apache/sis/coverage/privy/ColorModelType.java | 2 +- ...lorModelBuilder.java => ColorScaleBuilder.java} | 55 +- .../apache/sis/coverage/privy/ColorsForRange.java | 6 +- .../org/apache/sis/coverage/privy/ImageLayout.java | 458 ------------- .../apache/sis/coverage/privy/ImageUtilities.java | 47 +- .../apache/sis/coverage/privy/RasterFactory.java | 2 +- .../sis/coverage/privy/SampleDimensions.java | 27 +- .../sis/coverage/privy/SampleModelFactory.java | 75 +- .../org/apache/sis/feature/internal/Resources.java | 3 +- .../sis/feature/internal/Resources.properties | 2 +- .../sis/feature/internal/Resources_fr.properties | 2 +- .../org/apache/sis/image/BandAggregateImage.java | 125 +++- ...iSourceLayout.java => BandAggregateLayout.java} | 195 +++--- .../main/org/apache/sis/image/BandSelectImage.java | 18 +- .../apache/sis/image/BandedSampleConverter.java | 45 +- .../main/org/apache/sis/image/Colorizer.java | 40 +- .../main/org/apache/sis/image/ComputedImage.java | 23 +- .../main/org/apache/sis/image/ImageAdapter.java | 4 +- .../main/org/apache/sis/image/ImageCombiner.java | 32 +- .../main/org/apache/sis/image/ImageLayout.java | 673 ++++++++++++++++++ .../main/org/apache/sis/image/ImageOverlay.java | 431 ++++++++++++ .../main/org/apache/sis/image/ImageProcessor.java | 227 +++++- .../org/apache/sis/image/MultiSourceImage.java | 41 +- .../main/org/apache/sis/image/PlanarImage.java | 71 +- .../main/org/apache/sis/image/RecoloredImage.java | 63 +- .../main/org/apache/sis/image/ResampledImage.java | 62 +- .../org/apache/sis/image/SourceAlignedImage.java | 10 + .../org/apache/sis/image/StatisticsCalculator.java | 13 +- .../main/org/apache/sis/image/Transferer.java | 1 - .../main/org/apache/sis/image/Visualization.java | 78 ++- .../apache/sis/image/WritableComputedImage.java | 2 +- .../apache/sis/coverage/grid/GridGeometryTest.java | 15 +- .../sis/coverage/privy/ColorModelBuilderTest.java | 13 +- .../sis/coverage/privy/SampleModelFactoryTest.java | 18 +- .../apache/sis/image/BandAggregateImageTest.java | 66 +- .../sis/image/BandedSampleConverterTest.java | 17 +- .../{coverage/privy => image}/ImageLayoutTest.java | 14 +- .../org/apache/sis/image/ImageOverlayTest.java | 116 ++++ .../org/apache/sis/image/ResampledImageTest.java | 22 +- .../apache/sis/metadata/iso/extent/Extents.java | 5 +- .../sis/metadata/privy/ReferencingServices.java | 20 +- .../apache/sis/metadata/sql/privy/Initializer.java | 7 +- .../sis/metadata/sql/privy/LocalDataSource.java | 9 +- .../main/org/apache/sis/xml/MarshallerPool.java | 12 +- .../apache/sis/xml/bind/IdentifierMapAdapter.java | 16 +- .../sis/xml/bind/ModifiableIdentifierMap.java | 16 +- .../org/apache/sis/xml/bind/TypeRegistration.java | 8 +- .../metadata/replace/ReferenceSystemMetadata.java | 8 +- .../apache/sis/metadata/PropertyAccessorTest.java | 19 +- .../org/apache/sis/map/coverage/RenderingData.java | 19 +- .../main/org/apache/sis/io/wkt/Element.java | 20 +- .../main/org/apache/sis/io/wkt/Formatter.java | 56 +- .../apache/sis/referencing/AuthorityFactories.java | 9 +- .../main/org/apache/sis/referencing/CommonCRS.java | 5 +- .../sis/referencing/crs/DefaultCompoundCRS.java | 2 +- .../apache/sis/referencing/cs/AxesConvention.java | 218 +++--- .../factory/ConcurrentAuthorityFactory.java | 4 +- .../referencing/internal/ServicesForMetadata.java | 20 +- .../operation/CoordinateOperationFinder.java | 68 +- .../operation/provider/MapProjection.java | 14 +- .../transform/AbstractMathTransform2D.java | 31 +- .../transform/ConcatenatedTransform2D.java | 2 +- .../transform/ConcatenatedTransformDirect2D.java | 2 +- .../transform/DefaultMathTransformFactory.java | 12 +- .../InterpolatedGeocentricTransform2D.java | 4 +- .../transform/InterpolatedTransform2D.java | 4 +- .../operation/transform/MolodenskyTransform2D.java | 2 +- .../transform/PassThroughTransform2D.java | 2 +- .../operation/transform/ProjectiveTransform2D.java | 2 +- .../transform/SpecializableTransform2D.java | 4 +- .../sis/referencing/privy/ShapeUtilities.java | 105 +-- .../operation/CoordinateOperationFinderTest.java | 10 +- .../referencing/operation/provider/NADCONTest.java | 10 +- .../referencing/operation/provider/NTv2Test.java | 10 +- .../sis/referencing/privy/ShapeUtilitiesTest.java | 23 +- .../referencing/privy/ShapeUtilitiesViewer.java | 10 +- .../apache/sis/storage/geotiff/FormatModifier.java | 14 +- .../apache/sis/storage/geotiff/GeoTiffStore.java | 29 +- .../sis/storage/geotiff/ImageFileDirectory.java | 221 +++--- .../org/apache/sis/storage/geotiff/Writer.java | 153 +++-- .../sis/storage/geotiff/reader/CRSBuilder.java | 68 +- .../geotiff/reader/GridGeometryBuilder.java | 32 +- .../sis/storage/geotiff/reader/Localization.java | 1 + .../sis/storage/geotiff/writer/GeoEncoder.java | 239 ++++--- .../storage/geotiff/writer/ReformattedImage.java | 223 ++++-- .../sis/storage/geotiff/writer/TileMatrix.java | 83 ++- .../sis/storage/geotiff/GeoTiffStoreTest.java | 111 +++ .../org/apache/sis/storage/geotiff/WriterTest.java | 26 +- .../apache/sis/storage/netcdf/AttributeNames.java | 30 + .../apache/sis/storage/netcdf/MetadataReader.java | 28 +- .../apache/sis/storage/netcdf/base/Convention.java | 13 +- .../sis/storage/sql/postgis/RasterReader.java | 3 +- .../sis/storage/xml/stream/StaxStreamReader.java | 10 +- .../sis/storage/xml/stream/StaxStreamWriter.java | 10 +- .../apache/sis/io/stream/ChannelDataOutput.java | 28 + .../org/apache/sis/io/stream/ChannelFactory.java | 46 +- .../apache/sis/io/stream/HyperRectangleWriter.java | 246 +++++-- .../main/org/apache/sis/io/stream/IOUtilities.java | 16 + .../main/org/apache/sis/io/stream/Region.java | 30 + .../org/apache/sis/storage/DataStoreRegistry.java | 47 +- .../main/org/apache/sis/storage/DataStores.java | 63 +- .../sis/storage/IncompatibleResourceException.java | 56 +- .../org/apache/sis/storage/ProbeProviderPair.java | 6 +- .../main/org/apache/sis/storage/ProbeResult.java | 10 +- .../org/apache/sis/storage/StorageConnector.java | 15 +- .../aggregate/BandAggregateGridResource.java | 10 +- .../apache/sis/storage/base/MetadataBuilder.java | 43 +- .../apache/sis/storage/base/TiledGridCoverage.java | 8 +- .../apache/sis/storage/base/TiledGridResource.java | 47 +- .../sis/storage/base/URIDataStoreProvider.java | 33 +- .../sis/storage/base/WritableAggregateSupport.java | 2 +- .../storage/base/WritableGridCoverageSupport.java | 6 +- .../apache/sis/storage/esri/AsciiGridStore.java | 27 +- .../org/apache/sis/storage/esri/RasterStore.java | 23 +- .../org/apache/sis/storage/esri/WritableStore.java | 4 +- .../apache/sis/storage/event/StoreListeners.java | 5 +- .../apache/sis/storage/image/DataStoreFilter.java | 21 +- .../apache/sis/storage/image/WritableStore.java | 27 +- .../apache/sis/storage/esri/WritableStoreTest.java | 8 +- .../org/apache/sis/converter/SystemRegistry.java | 10 +- .../main/org/apache/sis/measure/AngleFormat.java | 47 +- .../main/org/apache/sis/pending/jdk/JDK20.java} | 45 +- .../main/org/apache/sis/pending/jdk/JDK24.txt | 1 + .../main/org/apache/sis/setup/Configuration.java | 45 +- .../apache/sis/setup/InstallationResources.java | 7 +- .../main/org/apache/sis/system/Reflect.java | 27 + .../main/org/apache/sis/system/Shutdown.java | 38 +- .../org/apache/sis/util/collection/RangeSet.java | 6 +- .../main/org/apache/sis/util/logging/Logging.java | 5 +- .../sis/util/resources/IndexedResourceBundle.java | 19 + .../apache/sis/storage/geopackage/GpkgStore.java | 2 +- .../sis/storage/geopackage/GpkgStoreTest.java | 16 +- .../conformance/CoreConformanceTest.java | 2 +- .../sis/storage/shapefile/ShapefileStore.java | 2 +- .../sis/storage/shapefile/dbf/DBFIOTest.java | 2 +- .../sis/storage/shapefile/shp/ShapeIOTest.java | 2 +- netbeans-project/ivy.xml | 2 +- .../org/apache/sis/gui/coverage/GridTileCache.java | 11 +- .../apache/sis/gui/internal/io/FileAccessView.java | 2 +- .../sis/gui/metadata/IdentificationInfo.java | 14 +- .../org/apache/sis/gui/metadata/MetadataTree.java | 15 +- .../sis/gui/metadata/StandardMetadataTree.java | 8 +- .../org/apache/sis/gui/metadata/package-info.java | 2 +- .../org/apache/sis/storage/gdal/TiledResource.java | 17 +- settings.gradle.kts | 3 +- 162 files changed, 4794 insertions(+), 2752 deletions(-) diff --cc endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridGeometry.java index 5a8e234a3b,642cac49b9..0b9510a46a --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridGeometry.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridGeometry.java @@@ -1143,6 -1162,46 +1162,46 @@@ public class GridGeometry implements Le return times; } + /** + * Returns the "real world" coordinates of the cell at indices (0, 0, … 0). + * The returned coordinates map the {@linkplain PixelInCell#CELL_CORNER cell corner}. + * This method computes the origin from the "grid to CRS" transform if available. + * If that transform is not available, then the minimal coordinate values of the + * {@linkplain #getEnvelope() envelope} are returned. + * + * @return the "real world" coordinates of the cell at indices (0, 0, … 0). + * @throws IncompleteGridGeometryException if this grid geometry has no origin — + * i.e. <code>{@linkplain #isDefined(int) isDefined}({@linkplain #ORIGIN})</code> returned {@code false}. + * + * @since 1.5 + */ + public double[] getOrigin() { + if (cornerToCRS == null) { + if (isEnvelopeUndefined()) { + throw incomplete(ORIGIN, Resources.Keys.UnspecifiedTransform); + } - return getEnvelope().getLowerCorner().getCoordinates(); ++ return getEnvelope().getLowerCorner().getCoordinate(); + } + final double[] origin = new double[cornerToCRS.getTargetDimensions()]; + final Matrix matrix = MathTransforms.getMatrix(cornerToCRS); + if (matrix != null) { + final int lastColumn = matrix.getNumCol() - 1; + for (int j=0; j < origin.length; j++) { + if (Double.isNaN(origin[j] = matrix.getElement(j, lastColumn))) { + final Matrix other = MathTransforms.getMatrix(gridToCRS); + if (other != null) { + origin[j] = other.getElement(j, lastColumn); + } + } + } + } else try { + cornerToCRS.transform(new double[cornerToCRS.getSourceDimensions()], 0, origin, 0, 1); + } catch (TransformException e) { + throw new IllegalGridGeometryException(e, "gridToCRS"); + } + return origin; + } + /** * Returns an <em>estimation</em> of the grid resolution, in units of the coordinate reference system axes. * The length of the returned array is the number of CRS dimensions, with {@code resolution[0]} diff --cc endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/Extents.java index 82a111d6e9,50475c36c8..b425ce2b84 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/Extents.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/Extents.java @@@ -420,8 -418,8 +421,8 @@@ public final class Extents extends Stat @OptionalCandidate public static MeasurementRange<Double> getVerticalRange(final Extent extent) { MeasurementRange<Double> range = null; - RealizationMethod selectedMethod = null; + VerticalDatumType selectedMethod = null; - if (extent != null) { + if (extent != null) try { for (final VerticalExtent element : nonNull(extent.getVerticalElements())) { double min = element.getMinimumValue(); double max = element.getMaximumValue(); diff --cc endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/privy/ReferencingServices.java index 09d3707343,78a54e6313..0cff418984 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/privy/ReferencingServices.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/privy/ReferencingServices.java @@@ -246,22 -243,12 +246,22 @@@ public class ReferencingServices extend - /////////////////////////////////////////////////////////////////////////////////////// - //// //// - //// OTHER REFERENCING SERVICES //// - //// //// - /////////////////////////////////////////////////////////////////////////////////////// + // ╔═════════════════════════════════════════════════════════════════════════════╗ + // ║ ║ + // ║ OTHER REFERENCING SERVICES ║ + // ║ ║ + // ╚═════════════════════════════════════════════════════════════════════════════╝ + /** + * Returns the name of the type of values. + * + * @param parameter parameter for which to get the name of type of values, or {@code null}. + * @return name of type of values, or {@code null} if not supported by given implementation. + */ + public TypeName getValueType(ParameterDescriptor<?> parameter) { + return null; + } + /** * Returns a fully implemented parameter descriptor. * diff --cc endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/ReferenceSystemMetadata.java index f3060452fc,570aadf213..885397ce3c --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/ReferenceSystemMetadata.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/ReferenceSystemMetadata.java @@@ -42,9 -46,6 +42,9 @@@ import org.opengis.referencing.Referenc * ├─mrs:referenceSystemIdentifier : mcc:MD_Identifier * └─mrs:referenceSystemType : mrs:MD_ReferenceSystemTypeCode</pre> * - * The {@code referenceSystemType} attribute is currently missing. ++ * The {@code referenceSystemType} attribute is missing. It is present in GeoAPI 3.1 only. + * See <a href="https://issues.apache.org/jira/browse/SIS-470">SIS-470</a>. + * * <p>Note that this implementation is very simple and serves no other purpose than being * a container for XML parsing or formatting. For real referencing service, consider using * {@link org.apache.sis.referencing.AbstractReferenceSystem} subclasses instead.</p> @@@ -56,7 -57,10 +56,9 @@@ * @see org.apache.sis.referencing.AbstractReferenceSystem * @see <a href="https://issues.apache.org/jira/browse/SIS-431">SIS-431</a> */ - @XmlType(name = "MD_ReferenceSystem_Type", namespace = Namespaces.MRS) + @XmlType(name = "MD_ReferenceSystem_Type", namespace = Namespaces.MRS, propOrder = { - "name", - "referenceSystemType" ++ "name" + }) @XmlRootElement(name = "MD_ReferenceSystem", namespace = Namespaces.MRS) public class ReferenceSystemMetadata extends SimpleIdentifiedObject implements ReferenceSystem { /** @@@ -138,12 -150,14 +140,12 @@@ @Override public boolean equals(final Object object, final ComparisonMode mode) { if (super.equals(object, mode) && (object instanceof ReferenceSystem)) { - final ReferenceSystem that = (ReferenceSystem) object; + final var that = (ReferenceSystem) object; - if (that.getReferenceSystemType().orElse(null) == referenceSystemType) { - if (mode.isIgnoringMetadata()) { - // Compare the name because it was ignored by super.equals(…) in "ignore metadata" mode. - return Utilities.deepEquals(getName(), that.getName(), mode); - } - return Containers.isNullOrEmpty(that.getDomains()); + if (mode.isIgnoringMetadata()) { + // Compare the name because it was ignored by super.equals(…) in "ignore metadata" mode. + return Utilities.deepEquals(getName(), that.getName(), mode); } + return that.getDomainOfValidity() == null && that.getScope() == null; } return false; } diff --cc endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyAccessorTest.java index ba13d1028c,1f38589d85..627dc3ae81 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyAccessorTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyAccessorTest.java @@@ -38,6 -38,8 +38,7 @@@ import org.opengis.metadata.identificat import org.opengis.metadata.maintenance.MaintenanceInformation; import org.opengis.metadata.spatial.SpatialRepresentationType; import org.opengis.referencing.IdentifiedObject; + import org.opengis.referencing.ReferenceSystem; -import org.opengis.referencing.ReferenceSystemType; import org.opengis.referencing.crs.GeodeticCRS; import org.opengis.referencing.crs.GeographicCRS; import org.opengis.referencing.datum.GeodeticDatum; @@@ -241,15 -243,16 +242,15 @@@ public final class PropertyAccessorTes @Test public void testConstructorWithCovariantReturnType() { assertMappingEquals(new PropertyAccessor(GeographicCRS.class, GeographicCRSMock.class, GeographicCRSMock.class), - //……Declaring type……………………………Method……………………………………………JavaBeans……………………………UML identifier……………………Sentence………………………………Type………………………………………………………… - GeographicCRS.class, "getCoordinateSystem", "coordinateSystem", "coordinateSystem", "Coordinate system", EllipsoidalCS.class, // Covariant return type - GeodeticCRS.class, "getDatum", "datum", "datum", "Datum", GeodeticDatum.class, // Covariant return type - IdentifiedObject.class, "getName", "name", "name", "Name", ReferenceIdentifier.class, - IdentifiedObject.class, "getAlias", "alias", "alias", "Alias", GenericName[].class, - IdentifiedObject.class, "getIdentifiers", "identifiers", "identifier", "Identifiers", ReferenceIdentifier[].class, - ReferenceSystem.class, "getScope", "scope", "SC_CRS.scope", "Scope", InternationalString.class, - ReferenceSystem.class, "getDomainOfValidity", "domainOfValidity", "domainOfValidity", "Domain of validity", Extent.class, - IdentifiedObject.class, "getRemarks", "remarks", "remarks", "Remarks", InternationalString.class); + //……Declaring type……………………………Method……………………………………………………JavaBeans……………………………………UML identifier………………………Sentence…………………………………………Type………………………………………………………… + GeographicCRS.class, "getCoordinateSystem", "coordinateSystem", "coordinateSystem", "Coordinate system", EllipsoidalCS.class, // Covariant return type + GeodeticCRS.class, "getDatum", "datum", "datum", "Datum", GeodeticDatum.class, // Covariant return type - GeodeticCRS.class, "getDatumEnsemble", "datumEnsemble", "datumEnsemble", "Datum ensemble", DatumEnsemble.class, // Covariant return type + IdentifiedObject.class, "getName", "name", "name", "Name", ReferenceIdentifier.class, + IdentifiedObject.class, "getAlias", "alias", "alias", "Alias", GenericName[].class, + IdentifiedObject.class, "getIdentifiers", "identifiers", "identifier", "Identifiers", ReferenceIdentifier[].class, - IdentifiedObject.class, "getDomains", "domains", "ObjectUsage.domain", "Domains", ObjectDomain[].class, - IdentifiedObject.class, "getRemarks", "remarks", "remarks", "Remarks", InternationalString.class, - ReferenceSystem.class, "getReferenceSystemType", "referenceSystemType", "referenceSystemType", "Reference system type", ReferenceSystemType.class); ++ ReferenceSystem.class, "getScope", "scope", "SC_CRS.scope", "Scope", InternationalString.class, ++ ReferenceSystem.class, "getDomainOfValidity", "domainOfValidity", "domainOfValidity", "Domain of validity", Extent.class, ++ IdentifiedObject.class, "getRemarks", "remarks", "remarks", "Remarks", InternationalString.class); } /** diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/ServicesForMetadata.java index 36e58e702e,8c6fc20090..15366f34aa --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/ServicesForMetadata.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/ServicesForMetadata.java @@@ -455,21 -443,12 +455,21 @@@ public final class ServicesForMetadata - /////////////////////////////////////////////////////////////////////////////////////// - //// //// - //// OTHER REFERENCING SERVICES //// - //// //// - /////////////////////////////////////////////////////////////////////////////////////// + // ╔═════════════════════════════════════════════════════════════════════════════╗ + // ║ ║ + // ║ OTHER REFERENCING SERVICES ║ + // ║ ║ + // ╚═════════════════════════════════════════════════════════════════════════════╝ + /** + * Returns the name of the type of values. + */ + @Override + public TypeName getValueType(final ParameterDescriptor<?> parameter) { + return (parameter instanceof DefaultParameterDescriptor<?>) + ? ((DefaultParameterDescriptor<?>) parameter).getValueType() : null; + } + /** * Returns a fully implemented parameter descriptor. * diff --cc endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Writer.java index 3de9db2926,6801c886f5..2017108c25 --- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Writer.java +++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Writer.java @@@ -52,10 -60,9 +60,9 @@@ import org.apache.sis.util.ArraysExt import org.apache.sis.util.privy.Numerics; import org.apache.sis.util.resources.Errors; import org.apache.sis.math.Fraction; - import org.apache.sis.storage.geotiff.writer.TagValue; - import org.apache.sis.storage.geotiff.writer.TileMatrix; - import org.apache.sis.storage.geotiff.writer.GeoEncoder; - import org.apache.sis.storage.geotiff.writer.ReformattedImage; + -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.coverage.CannotEvaluateException; ++// Specific to the main branch: ++import org.apache.sis.coverage.CannotEvaluateException; /** diff --cc endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/GeoTiffStoreTest.java index 0000000000,feb90f7f13..15b063899a mode 000000,100644..100644 --- a/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/GeoTiffStoreTest.java +++ b/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/GeoTiffStoreTest.java @@@ -1,0 -1,111 +1,111 @@@ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.apache.sis.storage.geotiff; + + import java.nio.file.Path; + import java.nio.file.Files; + import java.awt.image.BufferedImage; + import java.awt.image.RenderedImage; + import org.opengis.referencing.cs.AxisDirection; + import org.apache.sis.storage.DataStore; + import org.apache.sis.storage.DataStores; + import org.apache.sis.storage.StorageConnector; + import org.apache.sis.storage.GridCoverageResource; + import org.apache.sis.coverage.grid.GridExtent; + import org.apache.sis.coverage.grid.GridGeometry; + import org.apache.sis.coverage.grid.PixelInCell; + import org.apache.sis.coverage.grid.GridCoverage; + import org.apache.sis.coverage.grid.GridCoverageBuilder; + import org.apache.sis.referencing.operation.transform.MathTransforms; + import org.apache.sis.referencing.operation.matrix.Matrix4; + import org.apache.sis.referencing.CRS; + + // Test dependencies + import org.junit.jupiter.api.Test; + import static org.junit.jupiter.api.Assertions.*; + import org.apache.sis.test.TestCase; + import org.apache.sis.test.TestUtilities; + import org.apache.sis.referencing.crs.HardCodedCRS; + -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import static org.opengis.test.Assertions.assertMatrixEquals; -import static org.opengis.test.Assertions.assertAxisDirectionsEqual; ++// Specific to the main branch: ++import static org.apache.sis.test.GeoapiAssert.assertMatrixEquals; ++import static org.apache.sis.test.GeoapiAssert.assertAxisDirectionsEqual; + + + /** + * integration tests for {@link GeoTiffStore}. + * + * @author Martin Desruisseaux (Geomatys) + */ + public final class GeoTiffStoreTest extends TestCase { + /** + * Creates a new test case. + */ + public GeoTiffStoreTest() { + } + + /** + * Tests writing an image with a non-linear vertical component in the "grid to CRS" transform. + * This method merely tests that no exception is thrown during the execution, and that reading + * the image back can give back the three-dimensional <abbr>CRS</abbr>. + * + * @throws Exception if an error occurred while preparing or running the test. + */ + @Test + public void testNonLinearVerticalTransform() throws Exception { + final int width = 5; + final int height = 4; + final var builder = new GridCoverageBuilder(); + final var extent = new GridExtent(null, null, new long[] {width, height, 1}, false); + final var crs = CRS.compound(HardCodedCRS.WGS84_LATITUDE_FIRST, HardCodedCRS.DEPTH); + final var gridToCRS = MathTransforms.compound( + MathTransforms.scale(0.25, -0.25), + MathTransforms.interpolate(new double[] {0, 1, 2}, new double[] {3, 4, 9})); + builder.setDomain(new GridGeometry(extent, PixelInCell.CELL_CORNER, gridToCRS, crs)); + builder.setValues(new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB)); + final GridCoverage coverage = builder.build(); + final Path file = Files.createTempFile("sis-test-", ".tiff"); + try { + try (DataStore store = DataStores.openWritable(new StorageConnector(file), "GeoTIFF")) { + assertInstanceOf(GeoTiffStore.class, store).append(coverage, null); + } + /* + * Read the image that we wrote in above block. This block merely tests that no exception is thrown, + * and that the result has the expected number of dimensions, axis order and scale factors. + */ + try (DataStore store = DataStores.open(new StorageConnector(file), "GeoTIFF")) { + GridCoverageResource r = TestUtilities.getSingleton(assertInstanceOf(GeoTiffStore.class, store).components()); + GridGeometry gg = r.getGridGeometry(); + assertEquals(3, gg.getDimension()); + assertAxisDirectionsEqual(gg.getCoordinateReferenceSystem().getCoordinateSystem(), + AxisDirection.EAST, AxisDirection.NORTH, AxisDirection.DOWN); + + assertMatrixEquals(new Matrix4(0, -0.25, 0, 0, + 0.25, 0, 0, 0, + 0, 0, 1, 3, + 0, 0, 0, 1), + MathTransforms.getMatrix(gg.getGridToCRS(PixelInCell.CELL_CORNER)), 0, "gridToCRS"); + + RenderedImage image = r.read(null).render(null); + assertEquals(width, image.getWidth(), "width"); + assertEquals(height, image.getHeight(), "height"); + } + } finally { + Files.delete(file); + } + } + } diff --cc optional/src/org.apache.sis.gui/main/org/apache/sis/gui/metadata/IdentificationInfo.java index b9bfdec7f2,546974e84b..13e8f60ab0 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/metadata/IdentificationInfo.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/metadata/IdentificationInfo.java @@@ -59,10 -61,8 +61,11 @@@ import org.apache.sis.util.logging.Logg import org.apache.sis.util.collection.BackingStoreException; import org.apache.sis.util.resources.Vocabulary; import static org.apache.sis.util.privy.CollectionsExt.nonNull; + import static org.apache.sis.gui.internal.LogHandler.LOGGER; +// Specific to the main branch: +import org.opengis.metadata.identification.DataIdentification; + /** * The pane where to show the values of {@link Identification} objects.