This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sis.git
commit a04bd4b29816c91fc4dfc66135b8de5e962933a0 Merge: 6b6f91b255 371e65c59f Author: Martin Desruisseaux <[email protected]> AuthorDate: Sun Aug 21 19:56:17 2022 +0200 Merge branch 'geoapi-3.1'. .../sis/gui/metadata/IdentificationInfo.java | 79 +++-- .../apache/sis/gui/metadata/MetadataSummary.java | 44 ++- .../sis/gui/metadata/RepresentationInfo.java | 12 +- .../java/org/apache/sis/gui/metadata/Section.java | 4 +- .../apache/sis/gui/metadata/VerboseFormats.java | 68 ++++ .../org/apache/sis/gui/metadata/package-info.java | 2 +- ...{TextFormats.java => PropertyValueFormats.java} | 19 +- .../sis/internal/gui/PropertyValueFormatter.java | 4 +- .../org/apache/sis/internal/gui/PropertyView.java | 4 +- .../org/apache/sis/coverage/BandedCoverage.java | 2 +- .../sis/coverage/grid/ConvertedGridCoverage.java | 2 +- .../apache/sis/coverage/grid/DefaultEvaluator.java | 2 +- .../apache/sis/coverage/grid/EvaluatorWrapper.java | 2 +- .../sis/coverage/grid/GridCoverageProcessor.java | 6 +- .../org/apache/sis/coverage/grid/GridExtent.java | 37 ++- .../sis/coverage/grid/ResampledGridCoverage.java | 36 ++- .../sis/coverage/grid/TranslatedGridCoverage.java | 9 +- .../internal/coverage/CompoundTransformOf1D.java | 10 +- .../sis/internal/coverage/RepeatedTransform.java | 10 +- .../apache/sis/internal/feature/Geometries.java | 137 ++++++-- .../internal/feature/SpatialOperationContext.java | 23 +- .../apache/sis/internal/feature/esri/Factory.java | 2 +- .../apache/sis/internal/feature/j2d/Factory.java | 2 +- .../sis/internal/feature/j2d/ShapeProperties.java | 10 +- .../apache/sis/internal/feature/jts/Factory.java | 2 +- .../apache/sis/internal/feature/jts/Wrapper.java | 2 +- .../apache/sis/internal/feature/package-info.java | 2 +- .../sis/internal/filter/GeometryConverter.java | 13 +- .../apache/sis/internal/filter/package-info.java | 2 +- .../sis/filter/BinarySpatialFilterTestCase.java | 34 +- .../filter/BinarySpatialFilterUsingESRI_Test.java | 11 +- .../BinarySpatialFilterUsingJava2D_Test.java | 11 +- .../sis/internal/feature/GeometriesTestCase.java | 21 +- .../apache/sis/metadata/iso/extent/Extents.java | 9 +- .../main/java/org/apache/sis/util/iso/Types.java | 5 + .../org/apache/sis/metadata/sql/Citations.sql | 22 +- .../sis/metadata/iso/citation/CitationsTest.java | 29 +- .../org/apache/sis/geometry/GeneralEnvelope.java | 4 +- .../java/org/apache/sis/geometry/Shapes2D.java | 2 +- .../referencing/j2d/AffineTransform2D.java | 2 +- .../main/java/org/apache/sis/referencing/CRS.java | 10 + .../operation/builder/LocalizationGridBuilder.java | 2 +- .../operation/matrix/GeneralMatrix.java | 28 +- .../referencing/operation/matrix/MatrixSIS.java | 17 +- .../referencing/operation/matrix/package-info.java | 2 +- .../operation/projection/AlbersEqualArea.java | 33 +- .../operation/projection/AuthalicConversion.java | 2 +- .../operation/projection/AuthalicMercator.java | 21 +- .../operation/projection/AzimuthalEquidistant.java | 14 +- .../operation/projection/CassiniSoldner.java | 18 +- .../operation/projection/ConformalProjection.java | 4 +- .../operation/projection/CylindricalEqualArea.java | 4 +- .../operation/projection/Initializer.java | 37 +-- .../referencing/operation/projection/Inverter.java | 6 +- .../projection/LambertAzimuthalEqualArea.java | 2 +- .../projection/LambertConicConformal.java | 29 +- .../operation/projection/LongitudeWraparound.java | 351 +++++++++++++++++++++ .../referencing/operation/projection/Mercator.java | 94 +++--- .../projection/ModifiedAzimuthalEquidistant.java | 8 +- .../operation/projection/Mollweide.java | 8 +- .../operation/projection/NormalizedProjection.java | 158 ++++++---- .../operation/projection/ObliqueMercator.java | 2 +- .../operation/projection/ObliqueStereographic.java | 43 +-- .../operation/projection/Orthographic.java | 2 +- .../operation/projection/PolarStereographic.java | 2 +- .../operation/projection/Polyconic.java | 2 +- .../operation/projection/ProjectionException.java | 2 +- .../operation/projection/SatelliteTracking.java | 40 ++- .../operation/projection/Sinusoidal.java | 4 +- .../operation/projection/TransverseMercator.java | 12 +- .../operation/projection/ZonedGridSystem.java | 4 +- .../operation/transform/AbstractMathTransform.java | 50 +-- .../transform/AbstractMathTransform1D.java | 4 +- .../transform/AbstractMathTransform2D.java | 24 +- .../operation/transform/ConcatenatedTransform.java | 4 +- .../transform/ConcatenatedTransform2D.java | 2 +- .../transform/ConcatenatedTransformDirect2D.java | 2 +- .../transform/CoordinateSystemTransform.java | 4 +- .../transform/EllipsoidToCentricTransform.java | 2 +- .../operation/transform/MathTransforms.java | 2 + .../operation/transform/PoleRotation.java | 4 +- .../operation/transform/ProjectiveTransform.java | 4 +- .../transform/SpecializableTransform.java | 22 +- .../operation/transform/WraparoundTransform.java | 2 +- .../operation/transform/package-info.java | 2 +- .../org/apache/sis/geometry/EnvelopesTest.java | 36 ++- .../referencing/j2d/ShapeUtilitiesViewer.java | 2 +- .../operation/matrix/GeneralMatrixTest.java | 19 +- .../operation/projection/AlbersEqualAreaTest.java | 4 +- .../projection/AzimuthalEquidistantTest.java | 2 +- .../operation/projection/Benchmark.java | 4 +- .../projection/LambertAzimuthalEqualAreaTest.java | 2 +- .../projection/LambertConicConformalTest.java | 2 +- .../operation/projection/MercatorTest.java | 8 +- .../operation/projection/MollweideTest.java | 2 +- .../projection/ObliqueStereographicTest.java | 4 +- .../projection/PolarStereographicTest.java | 2 +- .../operation/projection/PolyconicTest.java | 2 +- .../projection/ProjectionResultComparator.java | 4 +- .../projection/TransverseMercatorTest.java | 4 +- .../operation/transform/PolarToCartesianTest.java | 2 +- .../transform/SphericalToCartesianTest.java | 2 +- .../org/apache/sis/internal/util/DoubleDouble.java | 14 +- .../main/java/org/apache/sis/measure/Units.java | 3 + .../org/apache/sis/util/OptionalCandidate.java | 44 +++ ide-project/NetBeans/nbproject/project.properties | 8 +- .../sis/internal/storage/inflater/CCITTRLE.java | 8 +- .../storage/inflater/CompressionChannel.java | 19 +- .../sis/internal/storage/inflater/Inflater.java | 26 +- .../apache/sis/internal/storage/inflater/LZW.java | 32 +- .../sis/internal/storage/inflater/PackBits.java | 10 +- .../apache/sis/internal/storage/inflater/ZIP.java | 8 +- .../sis/storage/geotiff/CompressedSubset.java | 2 +- .../org/apache/sis/storage/geotiff/DataCube.java | 16 +- .../org/apache/sis/storage/geotiff/DataSubset.java | 4 +- .../internal/storage/inflater/CCITTRLETest.java | 2 +- .../{ => aggregate}/AggregatedFeatureSet.java | 3 +- .../{ => aggregate}/ConcatenatedFeatureSet.java | 2 +- .../storage/{ => aggregate}/JoinFeatureSet.java | 2 +- .../storage/{io => aggregate}/package-info.java | 9 +- .../sis/internal/storage/io/ChannelData.java | 29 +- .../sis/internal/storage/io/ChannelDataInput.java | 15 +- .../storage/io/ChannelImageInputStream.java | 14 +- .../sis/internal/storage/io/NullChannel.java | 77 +++++ .../sis/internal/storage/io/package-info.java | 2 +- .../org/apache/sis/storage/StorageConnector.java | 11 +- .../ConcatenatedFeatureSetTest.java | 3 +- .../{ => aggregate}/JoinFeatureSetTest.java | 3 +- .../internal/storage/io/ChannelDataOutputTest.java | 10 +- .../apache/sis/test/suite/StorageTestSuite.java | 4 +- 130 files changed, 1618 insertions(+), 649 deletions(-) diff --cc application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/IdentificationInfo.java index 5b039edac4,1cc0ede6fe..cfdefa7a12 --- a/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/IdentificationInfo.java +++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/IdentificationInfo.java @@@ -312,9 -314,25 +315,20 @@@ final class IdentificationInfo extends /* * Topic category. */ - addLine(Vocabulary.Keys.TopicCategory, owner.string(nonNull(info.getTopicCategories()))); - /* - * Type of resource: vector, grid, table, tin, video, etc. It gives a slight overview - * of the next section, "Spatial representation". For that reason we put it close to - * that next section, i.e. last in this section but just before the map. - */ - addLine(Vocabulary.Keys.TypeOfResource, owner.string(nonNull(info.getSpatialRepresentationTypes()))); + final DataIdentification dataInfo = (info instanceof DataIdentification) ? (DataIdentification) info : null; + if (dataInfo != null) { + addLine(Vocabulary.Keys.TopicCategory, owner.string(nonNull(dataInfo.getTopicCategories()))); ++ addLine(Vocabulary.Keys.TypeOfResource, owner.string(nonNull(dataInfo.getSpatialRepresentationTypes()))); ++ } + /* + * Resource format. Current implementation shows only the first format found. + */ + for (final Format format : nonNull(info.getResourceFormats())) { - final Citation c = format.getFormatSpecificationCitation(); - if (c != null) { - text = owner.string(c.getTitle()); - if (text != null) { - addLine(Vocabulary.Keys.Format, text); - break; - } ++ text = owner.string(format.getSpecification()); ++ if (text != null) { ++ addLine(Vocabulary.Keys.Format, text); ++ break; + } } /* * Select a single, arbitrary date. We take the release or publication date if available. @@@ -370,7 -368,9 +364,9 @@@ */ text = null; Identifier identifier = null; - if (dataInfo != null) for (final Extent extent : nonNull(dataInfo.getExtents())) { + Range<Date> timeRange = null; + Range<Double> heights = null; - for (final Extent extent : nonNull(info.getExtents())) { ++ for (final Extent extent : nonNull(dataInfo != null ? dataInfo.getExtents() : null)) { if (extent != null) { if (text == null) { text = owner.string(extent.getDescription()); diff --cc core/sis-feature/src/main/java/org/apache/sis/internal/filter/GeometryConverter.java index 243b0e6d4b,435dce5cbf..3b16cdcd41 --- a/core/sis-feature/src/main/java/org/apache/sis/internal/filter/GeometryConverter.java +++ b/core/sis-feature/src/main/java/org/apache/sis/internal/filter/GeometryConverter.java @@@ -41,9 -44,9 +43,9 @@@ import org.apache.sis.filter.Expression * * @author Martin Desruisseaux (Geomatys) * @author Alexis Manin (Geomatys) - * @version 1.1 + * @version 1.3 * - * @param <R> the type of resources (e.g. {@link org.opengis.feature.Feature}) used as inputs. + * @param <R> the type of resources (e.g. {@code Feature}) used as inputs. * @param <G> the geometry implementation type. * * @see org.apache.sis.filter.ConvertFunction @@@ -149,9 -153,13 +152,13 @@@ final class GeometryConverter<R,G> exte } else if (value instanceof Envelope) { envelope = (Envelope) value; } else try { - return library.castOrWrap(value); - } catch (ClassCastException e) { + if (value instanceof DirectPosition) { + return library.createPoint((DirectPosition) value); + } else { + return library.castOrWrap(value); + } + } catch (ClassCastException | MismatchedDimensionException e) { - throw new InvalidFilterValueException(Errors.format( + throw new IllegalArgumentException(Errors.format( Errors.Keys.IllegalClass_2, library.rootClass, Classes.getClass(value)), e); } return library.toGeometry2D(envelope, WraparoundMethod.NONE); diff --cc core/sis-feature/src/test/java/org/apache/sis/filter/BinarySpatialFilterTestCase.java index e208867d77,0526fc1c7a..aa8080c863 --- a/core/sis-feature/src/test/java/org/apache/sis/filter/BinarySpatialFilterTestCase.java +++ b/core/sis-feature/src/test/java/org/apache/sis/filter/BinarySpatialFilterTestCase.java @@@ -36,8 -41,13 +41,9 @@@ import static org.opengis.test.Assert.a import static org.apache.sis.test.Assert.assertSerializedEquals; // Branch-dependent imports -import org.opengis.feature.Feature; -import org.opengis.filter.Expression; -import org.opengis.filter.Literal; -import org.opengis.filter.FilterFactory; -import org.opengis.filter.DistanceOperator; -import org.opengis.filter.DistanceOperatorName; -import org.opengis.filter.BinarySpatialOperator; +import org.apache.sis.feature.AbstractFeature; +import org.apache.sis.internal.geoapi.filter.Literal; ++import org.apache.sis.internal.geoapi.filter.DistanceOperatorName; /** @@@ -339,8 -349,34 +345,34 @@@ public abstract strictfp class BinarySp */ @Test public void testSerialization() { - final Literal<Feature,G> right = literal(Polygon.RIGHT); - BinarySpatialOperator<Feature> overlaps = factory.overlaps(literal(Polygon.CONTAINS), right); + final Literal<AbstractFeature,G> right = literal(Polygon.RIGHT); + Filter<AbstractFeature> overlaps = factory.overlaps(literal(Polygon.CONTAINS), right); assertSerializedEquals(overlaps); } + + /** + * Ensures that a world geographic envelope, once converted to a polygon and reprojected, remain coherent. + * This is a regression test. In the past, the operation pipeline [envelope → polygon → reprojected polygon] + * caused the result to degenerate to single line following the anti-meridian. + * + * @throws FactoryException if an error occurred while fetching a CRS. + * @throws TransformException if a coordinate conversion was required but failed. + */ + @Test + public void testSpatialContextDoesNotDegenerateEnvelope() throws FactoryException, TransformException { + final GeographicCRS sourceCRS = HardCodedCRS.WGS84; + final Envelope e1 = new Envelope2D(sourceCRS, -180, -90, 360, 180); + final DistanceFilter<?, G> within = new DistanceFilter<>(DistanceOperatorName.WITHIN, + library, factory.literal(e1), + factory.literal(new DirectPosition2D(sourceCRS, 44, 2)), + Quantities.create(1.0, Units.METRE)); + + final GeneralEnvelope envInCtx = within.context.transform(within.expression1.apply(null)).getEnvelope(); + final double xmin = envInCtx.getMinimum(0); + final double xmax = envInCtx.getMaximum(0); + assertNotEquals("Degenerated envelope.", xmin, xmax, 1000); + + final double expected = sourceCRS.getDatum().getEllipsoid().getSemiMajorAxis() * (2*Math.PI); + assertEquals(expected, xmax - xmin, expected / 1000); + } } diff --cc core/sis-metadata/src/main/java/org/apache/sis/util/iso/Types.java index 5b11cb0a74,b88c3f3adb..72679d3433 --- a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/Types.java +++ b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/Types.java @@@ -290,10 -293,11 +292,11 @@@ public final class Types extends Stati * @param code the code for which to get the localized description, or {@code null}. * @return the description, or {@code null} if none or if the given code is null. * - * @see #getCodeTitle(ControlledVocabulary) + * @see #getCodeTitle(CodeList) * @see #getDescription(Class) */ + @OptionalCandidate - public static InternationalString getDescription(final ControlledVocabulary code) { + public static InternationalString getDescription(final CodeList<?> code) { if (code != null) { final String resources = getResources(code.getClass().getName()); if (resources != null) { @@@ -310,8 -314,9 +313,9 @@@ * @param type the GeoAPI interface or code list from which to get the description, or {@code null}. * @return the description, or {@code null} if none or if the given type is {@code null}. * - * @see #getDescription(ControlledVocabulary) + * @see #getDescription(CodeList) */ + @OptionalCandidate public static InternationalString getDescription(final Class<?> type) { final String name = getStandardName(type); if (name != null) { diff --cc core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java index 513de3da82,dabbd9c224..e7494bc585 --- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java +++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java @@@ -121,21 -120,20 +121,20 @@@ public final strictfp class CitationsTe */ @Test public void testGetIdentifier() { - assertEquals("SIS", getIdentifier(SIS)); - assertEquals("OGC", getIdentifier(OGC)); - assertEquals("IOGP", getIdentifier(IOGP)); - assertEquals("EPSG", getIdentifier(EPSG)); - assertEquals("ArcGIS", getIdentifier(ESRI)); - assertEquals("NetCDF", getIdentifier(NETCDF)); - assertEquals("GeoTIFF", getIdentifier(GEOTIFF)); - assertEquals("MapInfo", getIdentifier(MAP_INFO)); - assertEquals("ISBN", getIdentifier(ISBN)); - assertEquals("ISSN", getIdentifier(ISSN)); - assertEquals("PROJ", getIdentifier(PROJ4)); - assertEquals("S-57", getIdentifier(S57)); // Not a valid Unicode identifier. - assertEquals("19115-1", getIdentifier(ISO_19115.get(0))); // The ':' separator is not usual in ISO references - assertEquals("19115-2", getIdentifier(ISO_19115.get(1))); // and could be changed in future SIS versions. - assertEquals("WMS", getIdentifier(WMS)); - assertEquals("Apache:SIS", getIdentifier(SIS)); ++ assertEquals("SIS", getIdentifier(SIS)); + assertEquals("OGC", getIdentifier(OGC)); + assertEquals("IOGP", getIdentifier(IOGP)); + assertEquals("EPSG", getIdentifier(EPSG)); - assertEquals("ESRI:ArcGIS", getIdentifier(ESRI)); ++ assertEquals("ArcGIS", getIdentifier(ESRI)); + assertEquals("NetCDF", getIdentifier(NETCDF)); + assertEquals("GeoTIFF", getIdentifier(GEOTIFF)); + assertEquals("ISBN", getIdentifier(ISBN)); + assertEquals("ISSN", getIdentifier(ISSN)); - assertEquals("OSGeo:PROJ", getIdentifier(PROJ4)); // Not a valid Unicode identifier. - assertEquals("IHO:S-57", getIdentifier(S57)); // Not a valid Unicode identifier. - assertEquals("ISO:19115-1", getIdentifier(ISO_19115.get(0))); // The ':' separator is not usual in ISO references - assertEquals("ISO:19115-2", getIdentifier(ISO_19115.get(1))); // and could be changed in future SIS versions. - assertEquals("OGC:WMS", getIdentifier(WMS)); ++ assertEquals("PROJ", getIdentifier(PROJ4)); // Not a valid Unicode identifier. ++ assertEquals("S-57", getIdentifier(S57)); // Not a valid Unicode identifier. ++ assertEquals("19115-1", getIdentifier(ISO_19115.get(0))); // The ':' separator is not usual in ISO references ++ assertEquals("19115-2", getIdentifier(ISO_19115.get(1))); // and could be changed in future SIS versions. ++ assertEquals("WMS", getIdentifier(WMS)); } /** diff --cc core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java index d8f7afbf04,a0d2dbec1a..2298217243 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java @@@ -286,9 -292,10 +286,9 @@@ public final strictfp class AlbersEqual NaN); // False northing (none) tolerance = Formulas.LINEAR_TOLERANCE; - toleranceModifier = ToleranceModifier.PROJECTION; /* * Skip inverse transform because the 176.003° become -183.997°. It is not the purpose - * of this test to verify longitude wraparound in inverse projection (we do not expect + * of this test to verify longitude wraparound in reverse projection (we do not expect * such wraparound to be applied). */ isInverseTransformSupported = false; diff --cc core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java index 1eaa2daf8b,68652c8320..b90a700f77 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java @@@ -221,8 -222,23 +221,8 @@@ public final strictfp class ObliqueSter assertEquals("Latitude", φt, dstPts[1], Formulas.ANGULAR_TOLERANCE); } - /** - * Tests the <cite>Oblique Stereographic</cite> case (EPSG:9809). - * This test is defined in GeoAPI conformance test suite. - * - * @throws FactoryException if an error occurred while creating the map projection. - * @throws TransformException if an error occurred while projecting a coordinate. - * - * @see org.opengis.test.referencing.ParameterizedTransformTest#testObliqueStereographic() - */ - @Test - @DependsOnMethod({"testTransform", "testInverseTransform"}) - public void testObliqueStereographic() throws FactoryException, TransformException { - createGeoApiTest(new org.apache.sis.internal.referencing.provider.ObliqueStereographic()).testObliqueStereographic(); - } - /** - * Tests consistency between forward and inverse projection using a point that was known to fail. + * Tests consistency between forward and reverse projection using a point that was known to fail. * * @throws FactoryException if an error occurred while creating the map projection. * @throws TransformException if an error occurred while projecting a coordinate. diff --cc storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/AggregatedFeatureSet.java index 5da4737140,e1aadfec5c..59f6df8d85 --- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/AggregatedFeatureSet.java +++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/AggregatedFeatureSet.java @@@ -30,9 -30,10 +30,10 @@@ import org.apache.sis.storage.FeatureSe import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.event.StoreListeners; import org.apache.sis.storage.AbstractFeatureSet; + import org.apache.sis.internal.storage.MetadataBuilder; // Branch-dependent imports -import org.opengis.feature.FeatureType; +import org.apache.sis.feature.DefaultFeatureType; /**
