You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2019/06/21 15:48:13 UTC
[sis] branch geoapi-4.0 updated (4e2add0 -> 59a2368)
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a change to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git.
from 4e2add0 Resources.getIdentifier() should be Optional<GenericName> since the identifier may be absent.
new 450ad14 Avoid the use of ImmutableIdentifier in anticipation for its migration to sis-referencing module.
new 2f7d100 Initial move of WKT parser/formatter from sis-metadata module to sis-referencing. https://issues.apache.org/jira/browse/SIS-463
new 7c21a98 First round of simplication allowed by SIS-463: delete ReferencingServices methods which were used for GeodeticObjectParser implementation. Instead, GeodeticObjectParser can now access directly the sis-referencing classes that it needs.
new 4f553de SIS-463 cleanup: move the WKTKeywords class to sis-referencing and add support for Position and Envelope in WKTFormat.format(…).
new 6ab6bbd Retrofit internal Citations class into public Citations class.
new 557fb8b Add an optimization enabled by the previous commit (part of SIS-463).
new a3c2b52 Move EllipsoidalHeightCombiner to sis-referencing module. https://issues.apache.org/jira/browse/SIS-463
new eeebc8d Move AxisDirection from sis-metadata to sis-referencing. https://issues.apache.org/jira/browse/SIS-463
new 2fc100b Remove ReferencingServices that do not need anymore to be in that class. https://issues.apache.org/jira/browse/SIS-463
new 59a2368 EllipsoidalHeightCombiner leverage ReferencingFactoryContainer. https://issues.apache.org/jira/browse/SIS-463
The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/sis/gui/dataset/ResourceTree.java | 4 +-
.../org/apache/sis/coverage/grid/GridExtent.java | 2 +-
.../apache/sis/internal/metadata/Identifiers.java | 269 +++++++++++
.../sis/internal/metadata/NameToIdentifier.java | 14 +
.../sis/internal/metadata/ReferencingServices.java | 335 +------------
.../sis/internal/metadata/ServicesForUtility.java | 13 +
.../internal/simple/SimpleIdentifiedObject.java | 8 +-
.../sis/internal/simple/SimpleIdentifier.java | 5 +-
.../sis/metadata/iso/citation/Citations.java | 233 ++++++++-
.../metadata/iso/extent/DefaultVerticalExtent.java | 4 +-
.../iso/identification/DefaultCoupledResource.java | 6 +-
.../apache/sis/metadata/sql/MetadataWriter.java | 4 +-
.../org/apache/sis/util/iso/DefaultNameSpace.java | 3 +-
.../sis/internal/metadata/IdentifiersTest.java | 106 ++++
.../java/org/apache/sis/io/wkt/WKTFormatTest.txt | 4 -
.../sis/metadata/iso/citation/CitationsTest.java | 23 +-
.../java/org/apache/sis/test/MetadataAssert.java | 79 ---
.../apache/sis/test/suite/MetadataTestSuite.java | 10 +-
.../sis/geometry/AbstractDirectPosition.java | 2 +-
.../apache/sis/internal/jaxb/referencing/Code.java | 3 +-
.../sis/internal/referencing}/AxisDirections.java | 5 +-
.../internal/referencing/CoordinateOperations.java | 101 +++-
.../internal/referencing/DefinitionVerifier.java | 4 +-
.../referencing}/EllipsoidalHeightCombiner.java | 75 +--
.../referencing/GeodeticObjectBuilder.java | 9 +-
.../referencing/ReferencingFactoryContainer.java | 54 ++-
.../internal/referencing/ReferencingUtilities.java | 17 +-
.../internal/referencing/ServicesForMetadata.java | 311 +-----------
.../sis/internal/referencing}/WKTKeywords.java | 2 +-
.../sis/internal/referencing/WKTUtilities.java | 36 ++
.../internal/referencing/WraparoundAdjustment.java | 1 -
.../referencing/provider/GeocentricAffine.java | 2 +-
.../referencing/provider/Geographic3Dto2D.java | 2 +-
.../java/org/apache/sis/io/wkt/AbstractParser.java | 0
.../main/java/org/apache/sis/io/wkt/Colors.java | 0
.../java/org/apache/sis/io/wkt/Convention.java | 0
.../main/java/org/apache/sis/io/wkt/Element.java | 2 +-
.../java/org/apache/sis/io/wkt/ElementKind.java | 0
.../org/apache/sis/io/wkt/FormattableObject.java | 0
.../main/java/org/apache/sis/io/wkt/Formatter.java | 20 +-
.../apache/sis/io/wkt/GeodeticObjectParser.java | 78 +--
.../java/org/apache/sis/io/wkt/KeywordCase.java | 0
.../java/org/apache/sis/io/wkt/KeywordStyle.java | 0
.../org/apache/sis/io/wkt/MathTransformParser.java | 6 +-
.../main/java/org/apache/sis/io/wkt/Parser.java | 0
.../main/java/org/apache/sis/io/wkt/Symbols.java | 0
.../java/org/apache/sis/io/wkt/Transliterator.java | 4 +-
.../sis/io/wkt/UnformattableObjectException.java | 0
.../sis/io/wkt/UnparsableObjectException.java | 0
.../java/org/apache/sis/io/wkt/VerticalInfo.java | 0
.../main/java/org/apache/sis/io/wkt/WKTFormat.java | 4 +-
.../main/java/org/apache/sis/io/wkt/Warnings.java | 0
.../java/org/apache/sis/io/wkt/package-info.java | 0
.../sis/metadata/iso/ImmutableIdentifier.java | 8 +-
.../sis/parameter/AbstractParameterDescriptor.java | 2 +-
.../sis/parameter/DefaultParameterValue.java | 2 +-
.../apache/sis/parameter/ParameterTableRow.java | 2 +-
.../org/apache/sis/parameter/TensorValues.java | 2 +-
.../main/java/org/apache/sis/referencing/CRS.java | 14 +-
.../sis/referencing/EPSGFactoryFallback.java | 3 +-
.../referencing/EllipsoidalHeightSeparator.java | 6 +-
.../apache/sis/referencing/IdentifiedObjects.java | 29 +-
.../sis/referencing/crs/AbstractDerivedCRS.java | 4 +-
.../sis/referencing/crs/DefaultCompoundCRS.java | 2 +-
.../sis/referencing/crs/DefaultDerivedCRS.java | 2 +-
.../sis/referencing/crs/DefaultEngineeringCRS.java | 2 +-
.../sis/referencing/crs/DefaultGeodeticCRS.java | 4 +-
.../sis/referencing/crs/DefaultImageCRS.java | 2 +-
.../sis/referencing/crs/DefaultParametricCRS.java | 2 +-
.../sis/referencing/crs/DefaultProjectedCRS.java | 4 +-
.../sis/referencing/crs/DefaultTemporalCRS.java | 2 +-
.../sis/referencing/crs/DefaultVerticalCRS.java | 2 +-
.../org/apache/sis/referencing/cs/AbstractCS.java | 4 +-
.../apache/sis/referencing/cs/AxesConvention.java | 2 +-
.../sis/referencing/cs/CoordinateSystems.java | 2 +-
.../apache/sis/referencing/cs/DefaultAffineCS.java | 2 +-
.../sis/referencing/cs/DefaultCompoundCS.java | 2 +-
.../cs/DefaultCoordinateSystemAxis.java | 4 +-
.../sis/referencing/cs/DefaultCylindricalCS.java | 2 +-
.../sis/referencing/cs/DefaultEllipsoidalCS.java | 2 +-
.../apache/sis/referencing/cs/DefaultLinearCS.java | 2 +-
.../apache/sis/referencing/cs/DefaultPolarCS.java | 2 +-
.../sis/referencing/cs/DefaultSphericalCS.java | 2 +-
.../apache/sis/referencing/cs/DefaultTimeCS.java | 2 +-
.../sis/referencing/cs/DefaultVerticalCS.java | 2 +-
.../sis/referencing/cs/DirectionAlongMeridian.java | 4 +-
.../org/apache/sis/referencing/cs/Normalizer.java | 2 +-
.../sis/referencing/datum/AbstractDatum.java | 3 +-
.../sis/referencing/datum/BursaWolfParameters.java | 2 +-
.../sis/referencing/datum/DefaultEllipsoid.java | 2 +-
.../referencing/datum/DefaultEngineeringDatum.java | 2 +-
.../referencing/datum/DefaultGeodeticDatum.java | 6 +-
.../sis/referencing/datum/DefaultImageDatum.java | 2 +-
.../referencing/datum/DefaultParametricDatum.java | 2 +-
.../referencing/datum/DefaultPrimeMeridian.java | 2 +-
.../referencing/datum/DefaultTemporalDatum.java | 2 +-
.../referencing/datum/DefaultVerticalDatum.java | 2 +-
.../factory/AuthorityFactoryIdentifier.java | 6 +-
.../factory/CommonAuthorityFactory.java | 5 +-
.../factory/GeodeticAuthorityFactory.java | 14 +-
.../referencing/factory/GeodeticObjectFactory.java | 4 +-
.../factory/IdentifiedObjectFinder.java | 4 +-
.../factory/MultiAuthoritiesFactory.java | 12 +-
.../referencing/factory/sql/EPSGDataAccess.java | 16 +-
.../sis/referencing/factory/sql/TableInfo.java | 2 +-
.../operation/AbstractCoordinateOperation.java | 2 +-
.../operation/AbstractSingleOperation.java | 4 +-
.../referencing/operation/CompoundCRSBuilder.java | 57 ---
.../operation/CoordinateOperationFinder.java | 7 +-
.../operation/CoordinateOperationRegistry.java | 14 +-
.../DefaultCoordinateOperationFactory.java | 25 +-
.../sis/referencing/operation/DefaultFormula.java | 2 +-
.../operation/DefaultOperationMethod.java | 6 +-
.../operation/InverseOperationMethod.java | 4 +-
.../sis/referencing/operation/matrix/Matrices.java | 2 +-
.../operation/projection/NormalizedProjection.java | 5 +-
.../operation/transform/AbstractMathTransform.java | 2 +-
.../operation/transform/ConcatenatedTransform.java | 2 +-
.../operation/transform/ContextualParameters.java | 2 +-
.../transform/DefaultMathTransformFactory.java | 5 +-
.../operation/transform/PassThroughTransform.java | 2 +-
.../org/apache/sis/geometry/ArrayEnvelopeTest.java | 2 +-
.../AxisDirectionsTest.java | 8 +-
.../EllipsoidalHeightCombinerTest.java | 13 +-
.../sis/internal/referencing}/WKTKeywordsTest.java | 2 +-
.../sis/internal/referencing/WKTUtilitiesTest.java | 1 -
.../internal/referencing/provider/AffineTest.java | 2 +-
.../provider/LongitudeRotationTest.java | 2 +-
.../java/org/apache/sis/io/wkt/ColorsTest.java | 0
.../java/org/apache/sis/io/wkt/ConventionTest.java | 0
.../java/org/apache/sis/io/wkt/ElementTest.java | 0
.../java/org/apache/sis/io/wkt/FormatterTest.java | 2 +-
.../java/org/apache/sis/io/wkt/SymbolsTest.java | 0
.../org/apache/sis/io/wkt/TransliteratorTest.java | 0
.../sis/metadata/iso/ImmutableIdentifierTest.java | 4 +-
.../DefaultParameterDescriptorGroupTest.java | 2 +-
.../parameter/DefaultParameterDescriptorTest.java | 2 +-
.../sis/parameter/DefaultParameterValueTest.java | 2 +-
.../org/apache/sis/parameter/TensorValuesTest.java | 2 +-
.../referencing/AbstractReferenceSystemTest.java | 2 +-
.../sis/referencing/crs/DefaultDerivedCRSTest.java | 2 +-
.../referencing/crs/DefaultEngineeringCRSTest.java | 2 +-
.../referencing/crs/DefaultGeocentricCRSTest.java | 2 +-
.../referencing/crs/DefaultGeographicCRSTest.java | 2 +-
.../sis/referencing/crs/DefaultImageCRSTest.java | 2 +-
.../referencing/crs/DefaultTemporalCRSTest.java | 2 +-
.../referencing/crs/DefaultVerticalCRSTest.java | 2 +-
.../sis/referencing/cs/DefaultCompoundCSTest.java | 2 +-
.../cs/DefaultCoordinateSystemAxisTest.java | 2 +-
.../referencing/cs/DefaultCylindricalCSTest.java | 2 +-
.../sis/referencing/cs/DefaultPolarCSTest.java | 2 +-
.../sis/referencing/cs/DefaultSphericalCSTest.java | 2 +-
.../referencing/cs/DirectionAlongMeridianTest.java | 4 +-
.../apache/sis/referencing/cs/HardCodedAxes.java | 2 +-
.../referencing/datum/DefaultEllipsoidTest.java | 2 +-
.../datum/DefaultGeodeticDatumTest.java | 2 +-
.../datum/DefaultPrimeMeridianTest.java | 2 +-
.../datum/DefaultVerticalDatumTest.java | 2 +-
.../factory/GeodeticObjectFactoryTest.java | 2 +-
.../DefaultConcatenatedOperationTest.java | 2 +-
.../operation/DefaultConversionTest.java | 4 +-
.../referencing/operation/DefaultFormulaTest.java | 2 +-
.../operation/DefaultTransformationTest.java | 6 +-
.../org/apache/sis/test/ReferencingAssert.java | 85 +++-
.../sis/test/suite/ReferencingTestSuite.java | 14 +-
.../org/apache/sis/internal/util/Citations.java | 536 ---------------------
.../apache/sis/internal/util/CollectionsExt.java | 22 +
.../org/apache/sis/internal/util/Constants.java | 8 +
.../apache/sis/internal/util/MetadataServices.java | 12 +
.../org/apache/sis/io/IdentifiedObjectFormat.java | 7 +-
.../java/org/apache/sis/measure/UnitFormat.java | 3 +-
.../org/apache/sis/internal/util/CitationMock.java | 105 ----
.../apache/sis/internal/util/CitationsTest.java | 123 -----
.../apache/sis/test/suite/UtilityTestSuite.java | 1 -
.../profile/fra/DirectReferenceSystemTest.java | 4 +-
.../sis/profile/france/FrenchProfileTest.java | 4 +-
.../java/org/apache/sis/storage/gdal/Proj4.java | 2 +-
.../org/apache/sis/storage/gdal/Proj4Factory.java | 20 +-
.../org/apache/sis/storage/geotiff/CRSBuilder.java | 7 +-
.../java/org/apache/sis/internal/netcdf/Axis.java | 2 +-
.../java/org/apache/sis/internal/netcdf/Grid.java | 2 +-
.../apache/sis/internal/netcdf/GridMapping.java | 2 +-
.../sis/internal/netcdf/impl/ChannelDecoder.java | 4 +-
.../apache/sis/internal/netcdf/impl/GridInfo.java | 2 +-
.../apache/sis/storage/netcdf/MetadataReader.java | 2 +-
.../sis/internal/storage/StoreUtilities.java | 6 +-
.../sis/internal/storage/wkt/StoreProvider.java | 2 +-
187 files changed, 1330 insertions(+), 1964 deletions(-)
create mode 100644 core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Identifiers.java
create mode 100644 core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/IdentifiersTest.java
delete mode 100644 core/sis-metadata/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.txt
rename core/{sis-metadata/src/main/java/org/apache/sis/internal/metadata => sis-referencing/src/main/java/org/apache/sis/internal/referencing}/AxisDirections.java (99%)
rename core/{sis-metadata/src/main/java/org/apache/sis/internal/metadata => sis-referencing/src/main/java/org/apache/sis/internal/referencing}/EllipsoidalHeightCombiner.java (80%)
rename core/{sis-metadata/src/main/java/org/apache/sis/internal/metadata => sis-referencing/src/main/java/org/apache/sis/internal/referencing}/WKTKeywords.java (99%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/AbstractParser.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/Colors.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/Convention.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/Element.java (99%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/ElementKind.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/FormattableObject.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/Formatter.java (98%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java (97%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/KeywordCase.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java (99%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/Parser.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/Symbols.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/Transliterator.java (99%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/UnformattableObjectException.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/UnparsableObjectException.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/VerticalInfo.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/WKTFormat.java (99%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/Warnings.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/io/wkt/package-info.java (100%)
rename core/{sis-metadata => sis-referencing}/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java (98%)
delete mode 100644 core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CompoundCRSBuilder.java
rename core/sis-referencing/src/test/java/org/apache/sis/internal/{metadata => referencing}/AxisDirectionsTest.java (98%)
rename core/sis-referencing/src/test/java/org/apache/sis/internal/{metadata => referencing}/EllipsoidalHeightCombinerTest.java (94%)
rename core/{sis-metadata/src/test/java/org/apache/sis/internal/metadata => sis-referencing/src/test/java/org/apache/sis/internal/referencing}/WKTKeywordsTest.java (98%)
rename core/{sis-metadata => sis-referencing}/src/test/java/org/apache/sis/io/wkt/ColorsTest.java (100%)
rename core/{sis-metadata => sis-referencing}/src/test/java/org/apache/sis/io/wkt/ConventionTest.java (100%)
rename core/{sis-metadata => sis-referencing}/src/test/java/org/apache/sis/io/wkt/ElementTest.java (100%)
rename core/{sis-metadata => sis-referencing}/src/test/java/org/apache/sis/io/wkt/FormatterTest.java (98%)
rename core/{sis-metadata => sis-referencing}/src/test/java/org/apache/sis/io/wkt/SymbolsTest.java (100%)
rename core/{sis-metadata => sis-referencing}/src/test/java/org/apache/sis/io/wkt/TransliteratorTest.java (100%)
rename core/{sis-metadata => sis-referencing}/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java (98%)
delete mode 100644 core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
delete mode 100644 core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationMock.java
delete mode 100644 core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java
[sis] 02/10: Initial move of WKT parser/formatter from sis-metadata
module to sis-referencing. https://issues.apache.org/jira/browse/SIS-463
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 2f7d100c28e4c06b67b8b1099c69f53c449df27e
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jun 21 10:37:48 2019 +0200
Initial move of WKT parser/formatter from sis-metadata module to sis-referencing.
https://issues.apache.org/jira/browse/SIS-463
---
.../sis/internal/metadata/ReferencingServices.java | 32 ---------
.../java/org/apache/sis/io/wkt/WKTFormatTest.txt | 4 --
.../java/org/apache/sis/test/MetadataAssert.java | 79 ---------------------
.../apache/sis/test/suite/MetadataTestSuite.java | 8 ---
.../internal/referencing/ServicesForMetadata.java | 6 +-
.../java/org/apache/sis/io/wkt/AbstractParser.java | 0
.../main/java/org/apache/sis/io/wkt/Colors.java | 0
.../java/org/apache/sis/io/wkt/Convention.java | 0
.../main/java/org/apache/sis/io/wkt/Element.java | 0
.../java/org/apache/sis/io/wkt/ElementKind.java | 0
.../org/apache/sis/io/wkt/FormattableObject.java | 0
.../main/java/org/apache/sis/io/wkt/Formatter.java | 6 +-
.../apache/sis/io/wkt/GeodeticObjectParser.java | 0
.../java/org/apache/sis/io/wkt/KeywordCase.java | 0
.../java/org/apache/sis/io/wkt/KeywordStyle.java | 0
.../org/apache/sis/io/wkt/MathTransformParser.java | 0
.../main/java/org/apache/sis/io/wkt/Parser.java | 0
.../main/java/org/apache/sis/io/wkt/Symbols.java | 0
.../java/org/apache/sis/io/wkt/Transliterator.java | 0
.../sis/io/wkt/UnformattableObjectException.java | 0
.../sis/io/wkt/UnparsableObjectException.java | 0
.../java/org/apache/sis/io/wkt/VerticalInfo.java | 0
.../main/java/org/apache/sis/io/wkt/WKTFormat.java | 0
.../main/java/org/apache/sis/io/wkt/Warnings.java | 0
.../java/org/apache/sis/io/wkt/package-info.java | 0
.../sis/metadata/iso/ImmutableIdentifier.java | 0
.../org/apache/sis/geometry/ArrayEnvelopeTest.java | 2 +-
.../internal/referencing/provider/AffineTest.java | 2 +-
.../provider/LongitudeRotationTest.java | 2 +-
.../java/org/apache/sis/io/wkt/ColorsTest.java | 0
.../java/org/apache/sis/io/wkt/ConventionTest.java | 0
.../java/org/apache/sis/io/wkt/ElementTest.java | 0
.../java/org/apache/sis/io/wkt/FormatterTest.java | 2 +-
.../java/org/apache/sis/io/wkt/SymbolsTest.java | 0
.../org/apache/sis/io/wkt/TransliteratorTest.java | 0
.../sis/metadata/iso/ImmutableIdentifierTest.java | 4 +-
.../DefaultParameterDescriptorGroupTest.java | 2 +-
.../parameter/DefaultParameterDescriptorTest.java | 2 +-
.../sis/parameter/DefaultParameterValueTest.java | 2 +-
.../org/apache/sis/parameter/TensorValuesTest.java | 2 +-
.../referencing/AbstractReferenceSystemTest.java | 2 +-
.../referencing/crs/DefaultEngineeringCRSTest.java | 2 +-
.../referencing/crs/DefaultGeocentricCRSTest.java | 2 +-
.../referencing/crs/DefaultGeographicCRSTest.java | 2 +-
.../sis/referencing/crs/DefaultImageCRSTest.java | 2 +-
.../referencing/crs/DefaultTemporalCRSTest.java | 2 +-
.../referencing/crs/DefaultVerticalCRSTest.java | 2 +-
.../cs/DefaultCoordinateSystemAxisTest.java | 2 +-
.../referencing/cs/DirectionAlongMeridianTest.java | 2 +-
.../referencing/datum/DefaultEllipsoidTest.java | 2 +-
.../datum/DefaultGeodeticDatumTest.java | 2 +-
.../datum/DefaultPrimeMeridianTest.java | 2 +-
.../datum/DefaultVerticalDatumTest.java | 2 +-
.../factory/GeodeticObjectFactoryTest.java | 2 +-
.../DefaultConcatenatedOperationTest.java | 2 +-
.../referencing/operation/DefaultFormulaTest.java | 2 +-
.../operation/DefaultTransformationTest.java | 2 +-
.../org/apache/sis/test/ReferencingAssert.java | 80 +++++++++++++++++++++-
.../sis/test/suite/ReferencingTestSuite.java | 9 +++
59 files changed, 119 insertions(+), 159 deletions(-)
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
index a56a050..2653d77 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
@@ -54,7 +54,6 @@ import org.apache.sis.metadata.iso.extent.DefaultSpatialTemporalExtent;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.OptionalDependency;
import org.apache.sis.internal.system.Modules;
-import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.util.Deprecable;
@@ -332,37 +331,6 @@ public class ReferencingServices extends OptionalDependency {
throw moduleNotFound();
}
- /**
- * Converts the given object in a {@code FormattableObject} instance.
- *
- * @param object the object to wrap.
- * @return the given object converted to a {@code FormattableObject} instance.
- * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has not been found on the classpath.
- *
- * @see org.apache.sis.referencing.AbstractIdentifiedObject#castOrCopy(IdentifiedObject)
- *
- * @since 0.4
- */
- public FormattableObject toFormattableObject(IdentifiedObject object) {
- throw moduleNotFound();
- }
-
- /**
- * Converts the given object in a {@code FormattableObject} instance. Callers should verify that the given
- * object is not already an instance of {@code FormattableObject} before to invoke this method. This method
- * returns {@code null} if it can not convert the object.
- *
- * @param object the object to wrap.
- * @param internal {@code true} if the formatting convention is {@code Convention.INTERNAL}.
- * @return the given object converted to a {@code FormattableObject} instance, or {@code null}.
- * @throws UnsupportedOperationException if the {@code "sis-referencing"} module has not been found on the classpath.
- *
- * @since 0.6
- */
- public FormattableObject toFormattableObject(MathTransform object, boolean internal) {
- throw moduleNotFound();
- }
-
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.txt b/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.txt
deleted file mode 100644
index 1101ffb..0000000
--- a/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-WKTFormat and some of its dependencies (GeodeticObjectParser and
-MathTransformParser) can not be tested in "sis-metadata" module,
-because they need the "sis-referencing" module at execution time.
-Those test classes are added by the "sis-referencing" module.
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java b/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java
index 8f22c56..56a76c7 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java
@@ -27,10 +27,6 @@ import org.opengis.metadata.maintenance.Scope;
import org.opengis.metadata.maintenance.ScopeCode;
import org.opengis.metadata.content.FeatureTypeInfo;
import org.opengis.metadata.content.FeatureCatalogueDescription;
-import org.opengis.referencing.IdentifiedObject;
-import org.apache.sis.io.wkt.Symbols;
-import org.apache.sis.io.wkt.WKTFormat;
-import org.apache.sis.io.wkt.Convention;
import org.apache.sis.xml.Namespaces;
import org.apache.sis.test.xml.DocumentComparator;
import org.apache.sis.internal.xml.LegacyNamespaces;
@@ -53,18 +49,6 @@ import org.opengis.metadata.citation.Responsibility;
*/
public strictfp class MetadataAssert extends Assert {
/**
- * The formatter to be used by {@link #assertWktEquals(String, Object)}.
- * This formatter uses the {@code “…”} quotation marks instead of {@code "…"}
- * for easier readability of {@link String} constants in Java code.
- */
- private static final WKTFormat WKT_FORMAT = new WKTFormat(null, null);
- static {
- final Symbols s = new Symbols(Symbols.SQUARE_BRACKETS);
- s.setPairedQuotes("“”", "\"\"");
- WKT_FORMAT.setSymbols(s);
- }
-
- /**
* For subclass constructor only.
*/
protected MetadataAssert() {
@@ -145,69 +129,6 @@ public strictfp class MetadataAssert extends Assert {
}
/**
- * Asserts that the WKT 2 of the given object is equal to the expected one.
- * This method expected the {@code “…”} quotation marks instead of {@code "…"}
- * for easier readability of {@link String} constants in Java code.
- *
- * @param expected the expected text, or {@code null} if {@code object} is expected to be null.
- * @param object the object to format in <cite>Well Known Text</cite> format, or {@code null}.
- */
- public static void assertWktEquals(final String expected, final Object object) {
- assertWktEquals(Convention.WKT2, expected, object);
- }
-
- /**
- * Asserts that the WKT of the given object according the given convention is equal to the expected one.
- * This method expected the {@code “…”} quotation marks instead of {@code "…"} for easier readability of
- * {@link String} constants in Java code.
- *
- * @param convention the WKT convention to use.
- * @param expected the expected text, or {@code null} if {@code object} is expected to be null.
- * @param object the object to format in <cite>Well Known Text</cite> format, or {@code null}.
- */
- public static void assertWktEquals(final Convention convention, final String expected, final Object object) {
- if (expected == null) {
- assertNull(object);
- } else {
- assertNotNull(object);
- final String wkt;
- synchronized (WKT_FORMAT) {
- WKT_FORMAT.setConvention(convention);
- wkt = WKT_FORMAT.format(object);
- }
- assertMultilinesEquals((object instanceof IdentifiedObject) ?
- ((IdentifiedObject) object).getName().getCode() : object.getClass().getSimpleName(), expected, wkt);
- }
- }
-
- /**
- * Asserts that the WKT of the given object according the given convention is equal to the given regular expression.
- * This method is like {@link #assertWktEquals(String, Object)}, but the use of regular expression allows some
- * tolerance for example on numerical parameter values that may be subject to a limited form of rounding errors.
- *
- * @param convention the WKT convention to use.
- * @param expected the expected regular expression, or {@code null} if {@code object} is expected to be null.
- * @param object the object to format in <cite>Well Known Text</cite> format, or {@code null}.
- *
- * @since 0.6
- */
- public static void assertWktEqualsRegex(final Convention convention, final String expected, final Object object) {
- if (expected == null) {
- assertNull(object);
- } else {
- assertNotNull(object);
- final String wkt;
- synchronized (WKT_FORMAT) {
- WKT_FORMAT.setConvention(convention);
- wkt = WKT_FORMAT.format(object);
- }
- if (!wkt.matches(expected.replace("\n", System.lineSeparator()))) {
- fail("WKT does not match the expected regular expression. The WKT that we got is:\n" + wkt);
- }
- }
- }
-
- /**
* Parses two XML trees as DOM documents, and compares the nodes.
* The inputs given to this method can be any of the following types:
*
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java b/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
index bcd9d9e..014361a 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
@@ -124,20 +124,12 @@ import org.junit.BeforeClass;
org.apache.sis.metadata.iso.lineage.DefaultProcessStepTest.class,
org.apache.sis.metadata.iso.constraint.DefaultLegalConstraintsTest.class,
org.apache.sis.metadata.iso.DefaultIdentifierTest.class,
- org.apache.sis.metadata.iso.ImmutableIdentifierTest.class,
org.apache.sis.metadata.iso.DefaultMetadataTest.class,
org.apache.sis.metadata.iso.CustomMetadataTest.class,
org.apache.sis.metadata.iso.AllMetadataTest.class,
org.apache.sis.metadata.iso.MarshallingTest.class,
org.apache.sis.metadata.iso.APIVerifier.class,
- org.apache.sis.io.wkt.ConventionTest.class,
- org.apache.sis.io.wkt.SymbolsTest.class,
- org.apache.sis.io.wkt.TransliteratorTest.class,
- org.apache.sis.io.wkt.ColorsTest.class,
- org.apache.sis.io.wkt.FormatterTest.class,
- org.apache.sis.io.wkt.ElementTest.class,
-
org.apache.sis.internal.metadata.sql.SQLUtilitiesTest.class,
org.apache.sis.internal.metadata.sql.TypeMapperTest.class,
org.apache.sis.internal.metadata.sql.ScriptRunnerTest.class,
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
index f5e455d..d44c5f1 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
@@ -531,8 +531,7 @@ public final class ServicesForMetadata extends ReferencingServices {
* @param object the object to wrap.
* @return the given object converted to a {@code FormattableObject} instance.
*/
- @Override
- public FormattableObject toFormattableObject(final IdentifiedObject object) {
+ public static FormattableObject toFormattableObject(final IdentifiedObject object) {
return AbstractIdentifiedObject.castOrCopy(object);
}
@@ -547,8 +546,7 @@ public final class ServicesForMetadata extends ReferencingServices {
*
* @since 0.6
*/
- @Override
- public FormattableObject toFormattableObject(final MathTransform object, boolean internal) {
+ public static FormattableObject toFormattableObject(final MathTransform object, boolean internal) {
Matrix matrix;
final ParameterValueGroup parameters;
if (internal && (matrix = MathTransforms.getMatrix(object)) != null) {
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Colors.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Colors.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Colors.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Colors.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Convention.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Convention.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Element.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Element.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ElementKind.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/ElementKind.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ElementKind.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/ElementKind.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
similarity index 99%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
index d17e2ff..b924553 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
@@ -75,7 +75,7 @@ import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.StandardDateFormat;
import org.apache.sis.internal.simple.SimpleExtent;
import org.apache.sis.internal.metadata.WKTKeywords;
-import org.apache.sis.internal.metadata.ReferencingServices;
+import org.apache.sis.internal.referencing.ServicesForMetadata;
import org.apache.sis.internal.metadata.Resources;
import org.apache.sis.measure.UnitFormat;
import org.apache.sis.measure.Range;
@@ -984,7 +984,7 @@ public class Formatter implements Localized {
if (transform instanceof FormattableObject) {
append((FormattableObject) transform);
} else {
- final FormattableObject object = ReferencingServices.getInstance()
+ final FormattableObject object = ServicesForMetadata
.toFormattableObject(transform, convention == Convention.INTERNAL);
if (object != null) {
append(object);
@@ -1549,7 +1549,7 @@ public class Formatter implements Localized {
if (value instanceof FormattableObject) {
append((FormattableObject) value);
} else if (value instanceof IdentifiedObject) {
- append(ReferencingServices.getInstance().toFormattableObject((IdentifiedObject) value));
+ append(ServicesForMetadata.toFormattableObject((IdentifiedObject) value));
} else if (value instanceof MathTransform) {
append((MathTransform) value);
} else if (value instanceof Unit<?>) {
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordCase.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/KeywordCase.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordCase.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/KeywordCase.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Parser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Parser.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Parser.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Parser.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Symbols.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Symbols.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Symbols.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Symbols.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Transliterator.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Transliterator.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Transliterator.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Transliterator.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/UnformattableObjectException.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/UnformattableObjectException.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/UnformattableObjectException.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/UnformattableObjectException.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/UnparsableObjectException.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/UnparsableObjectException.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/UnparsableObjectException.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/UnparsableObjectException.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/VerticalInfo.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/VerticalInfo.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/VerticalInfo.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/VerticalInfo.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Warnings.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Warnings.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/package-info.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/package-info.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/io/wkt/package-info.java
rename to core/sis-referencing/src/main/java/org/apache/sis/io/wkt/package-info.java
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java b/core/sis-referencing/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
similarity index 100%
rename from core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
rename to core/sis-referencing/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/geometry/ArrayEnvelopeTest.java b/core/sis-referencing/src/test/java/org/apache/sis/geometry/ArrayEnvelopeTest.java
index 4f77c3e..25d44e1 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/geometry/ArrayEnvelopeTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/geometry/ArrayEnvelopeTest.java
@@ -21,7 +21,7 @@ import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
index bb3a334..40a9921 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
@@ -25,7 +25,7 @@ import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java
index 3b11e2a..b711a08 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java
@@ -26,7 +26,7 @@ import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ColorsTest.java b/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/ColorsTest.java
similarity index 100%
rename from core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ColorsTest.java
rename to core/sis-referencing/src/test/java/org/apache/sis/io/wkt/ColorsTest.java
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ConventionTest.java b/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/ConventionTest.java
similarity index 100%
rename from core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ConventionTest.java
rename to core/sis-referencing/src/test/java/org/apache/sis/io/wkt/ConventionTest.java
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ElementTest.java b/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/ElementTest.java
similarity index 100%
rename from core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ElementTest.java
rename to core/sis-referencing/src/test/java/org/apache/sis/io/wkt/ElementTest.java
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java b/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
similarity index 98%
rename from core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
rename to core/sis-referencing/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
index a314290..f70e0e8 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
@@ -29,7 +29,7 @@ import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/SymbolsTest.java b/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/SymbolsTest.java
similarity index 100%
rename from core/sis-metadata/src/test/java/org/apache/sis/io/wkt/SymbolsTest.java
rename to core/sis-referencing/src/test/java/org/apache/sis/io/wkt/SymbolsTest.java
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/TransliteratorTest.java b/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/TransliteratorTest.java
similarity index 100%
rename from core/sis-metadata/src/test/java/org/apache/sis/io/wkt/TransliteratorTest.java
rename to core/sis-referencing/src/test/java/org/apache/sis/io/wkt/TransliteratorTest.java
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java b/core/sis-referencing/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
similarity index 98%
rename from core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
rename to core/sis-referencing/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
index 5952c47..6ec6251 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
@@ -30,10 +30,9 @@ import org.apache.sis.io.wkt.Convention;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.xml.TestCase;
import org.opengis.test.Validators;
-import org.apache.sis.test.DependsOn;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
import static org.opengis.metadata.Identifier.*;
@@ -45,7 +44,6 @@ import static org.opengis.metadata.Identifier.*;
* @since 0.3
* @module
*/
-@DependsOn(DefaultIdentifierTest.class)
public final strictfp class ImmutableIdentifierTest extends TestCase {
/**
* Returns the properties map to be used in argument to test methods.
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java b/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
index 046c739..629f3d3 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
@@ -32,7 +32,7 @@ import org.junit.Test;
import static org.opengis.test.Validators.*;
import static java.util.Collections.singletonMap;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
import static org.opengis.referencing.IdentifiedObject.*;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java b/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
index d97be2a..8ec3dae 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
@@ -35,7 +35,7 @@ import org.apache.sis.test.TestCase;
import org.junit.Test;
import static org.opengis.test.Validators.*;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java b/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
index ba21073..caa4c5d 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
@@ -32,7 +32,7 @@ import org.junit.Test;
import static java.lang.StrictMath.*;
import static org.opengis.test.Validators.*;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java b/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
index ae167d2..a47d554 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
@@ -35,7 +35,7 @@ import org.junit.Test;
import static java.util.Collections.singletonMap;
import static org.opengis.test.Validators.validate;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
import static org.apache.sis.internal.util.Constants.NUM_ROW;
import static org.apache.sis.internal.util.Constants.NUM_COL;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
index 7cbcfa0..e378d7a 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
@@ -35,7 +35,7 @@ import org.junit.Test;
import static org.opengis.referencing.ReferenceSystem.*;
import static org.apache.sis.test.Assert.*;
-import static org.apache.sis.test.MetadataAssert.assertWktEquals;
+import static org.apache.sis.test.ReferencingAssert.assertWktEquals;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
index 8b75811..e130975 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
@@ -29,7 +29,7 @@ import org.apache.sis.test.xml.TestCase;
import org.apache.sis.xml.Namespaces;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
index 9a50c1e..66c289a 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
@@ -30,7 +30,7 @@ import org.apache.sis.test.TestCase;
import org.opengis.test.Validators;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
index 1859e12..36dec06 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
@@ -29,7 +29,7 @@ import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
import static org.apache.sis.test.TestUtilities.getSingleton;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultImageCRSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultImageCRSTest.java
index 9cbee7f..65d7f1d 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultImageCRSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultImageCRSTest.java
@@ -32,7 +32,7 @@ import org.apache.sis.test.xml.TestCase;
import org.apache.sis.xml.Namespaces;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java
index 9b07d48..b347b7e 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java
@@ -25,7 +25,7 @@ import org.apache.sis.io.wkt.Convention;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
import static org.apache.sis.internal.util.StandardDateFormat.MILLISECONDS_PER_DAY;
import static org.apache.sis.internal.util.StandardDateFormat.NANOS_PER_MILLISECOND;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java
index e42bd87..f95a529 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java
@@ -21,7 +21,7 @@ import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
index 5ce1c2c..9bd3343 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
@@ -28,7 +28,7 @@ import org.apache.sis.test.TestCase;
import org.junit.Test;
import static java.util.Collections.singletonMap;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
import static org.apache.sis.referencing.cs.HardCodedAxes.*;
import static org.apache.sis.referencing.IdentifiedObjects.getProperties;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
index aef101e..dabdbbe 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
@@ -22,7 +22,7 @@ import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
index b0303a5..09a4b73 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
@@ -29,7 +29,7 @@ import org.apache.sis.test.DependsOnMethod;
import org.junit.Test;
import static java.lang.StrictMath.*;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
index c32647a..b6ac4fc 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
@@ -35,7 +35,7 @@ import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestStep;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
import static org.apache.sis.referencing.GeodeticObjectVerifier.*;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
index e5d5149..901a0bc 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
@@ -33,7 +33,7 @@ import org.apache.sis.test.DependsOn;
import org.junit.Test;
import static java.util.Collections.singletonMap;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
import static org.apache.sis.referencing.GeodeticObjectVerifier.*;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
index ccce077..34cd0cc 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
@@ -31,7 +31,7 @@ import org.apache.sis.test.xml.TestCase;
import org.junit.Test;
import static java.util.Collections.singletonMap;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
import static org.apache.sis.referencing.GeodeticObjectVerifier.*;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java
index af54012..4fc04a0 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java
@@ -54,7 +54,7 @@ import org.junit.runner.RunWith;
import org.junit.Ignore;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java
index bf2477f..a8de4ad 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java
@@ -35,7 +35,7 @@ import org.apache.sis.test.DependsOn;
import org.apache.sis.test.xml.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
import static org.apache.sis.test.TestUtilities.getSingleton;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultFormulaTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultFormulaTest.java
index 9a9e524..fe6fa83 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultFormulaTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultFormulaTest.java
@@ -20,7 +20,7 @@ import org.apache.sis.io.wkt.Convention;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java
index 55bb30e..1878fe9 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java
@@ -37,7 +37,7 @@ import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java b/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
index 6776155..007a2e3 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
@@ -35,6 +35,9 @@ import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.cs.RangeMeaning;
import org.opengis.util.GenericName;
+import org.apache.sis.io.wkt.Symbols;
+import org.apache.sis.io.wkt.WKTFormat;
+import org.apache.sis.io.wkt.Convention;
import org.apache.sis.geometry.AbstractEnvelope;
import org.apache.sis.geometry.Envelopes;
import org.apache.sis.geometry.GeneralDirectPosition;
@@ -52,12 +55,24 @@ import static java.lang.StrictMath.*;
* from other modules and libraries.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
* @since 0.3
* @module
*/
public strictfp class ReferencingAssert extends MetadataAssert {
/**
+ * The formatter to be used by {@link #assertWktEquals(String, Object)}.
+ * This formatter uses the {@code “…”} quotation marks instead of {@code "…"}
+ * for easier readability of {@link String} constants in Java code.
+ */
+ private static final WKTFormat WKT_FORMAT = new WKTFormat(null, null);
+ static {
+ final Symbols s = new Symbols(Symbols.SQUARE_BRACKETS);
+ s.setPairedQuotes("“”", "\"\"");
+ WKT_FORMAT.setSymbols(s);
+ }
+
+ /**
* For subclass constructor only.
*/
protected ReferencingAssert() {
@@ -456,4 +471,67 @@ public strictfp class ReferencingAssert extends MetadataAssert {
assertFalse("getMatrix().isIdentity()", ((LinearTransform) transform).getMatrix().isIdentity());
}
}
+
+ /**
+ * Asserts that the WKT 2 of the given object is equal to the expected one.
+ * This method expected the {@code “…”} quotation marks instead of {@code "…"}
+ * for easier readability of {@link String} constants in Java code.
+ *
+ * @param expected the expected text, or {@code null} if {@code object} is expected to be null.
+ * @param object the object to format in <cite>Well Known Text</cite> format, or {@code null}.
+ */
+ public static void assertWktEquals(final String expected, final Object object) {
+ assertWktEquals(Convention.WKT2, expected, object);
+ }
+
+ /**
+ * Asserts that the WKT of the given object according the given convention is equal to the expected one.
+ * This method expected the {@code “…”} quotation marks instead of {@code "…"} for easier readability of
+ * {@link String} constants in Java code.
+ *
+ * @param convention the WKT convention to use.
+ * @param expected the expected text, or {@code null} if {@code object} is expected to be null.
+ * @param object the object to format in <cite>Well Known Text</cite> format, or {@code null}.
+ */
+ public static void assertWktEquals(final Convention convention, final String expected, final Object object) {
+ if (expected == null) {
+ assertNull(object);
+ } else {
+ assertNotNull(object);
+ final String wkt;
+ synchronized (WKT_FORMAT) {
+ WKT_FORMAT.setConvention(convention);
+ wkt = WKT_FORMAT.format(object);
+ }
+ assertMultilinesEquals((object instanceof IdentifiedObject) ?
+ ((IdentifiedObject) object).getName().getCode() : object.getClass().getSimpleName(), expected, wkt);
+ }
+ }
+
+ /**
+ * Asserts that the WKT of the given object according the given convention is equal to the given regular expression.
+ * This method is like {@link #assertWktEquals(String, Object)}, but the use of regular expression allows some
+ * tolerance for example on numerical parameter values that may be subject to a limited form of rounding errors.
+ *
+ * @param convention the WKT convention to use.
+ * @param expected the expected regular expression, or {@code null} if {@code object} is expected to be null.
+ * @param object the object to format in <cite>Well Known Text</cite> format, or {@code null}.
+ *
+ * @since 0.6
+ */
+ public static void assertWktEqualsRegex(final Convention convention, final String expected, final Object object) {
+ if (expected == null) {
+ assertNull(object);
+ } else {
+ assertNotNull(object);
+ final String wkt;
+ synchronized (WKT_FORMAT) {
+ WKT_FORMAT.setConvention(convention);
+ wkt = WKT_FORMAT.format(object);
+ }
+ if (!wkt.matches(expected.replace("\n", System.lineSeparator()))) {
+ fail("WKT does not match the expected regular expression. The WKT that we got is:\n" + wkt);
+ }
+ }
+ }
}
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java b/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
index dec780f..aa46588 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
@@ -41,6 +41,15 @@ import org.junit.BeforeClass;
org.apache.sis.internal.jaxb.referencing.CodeTest.class,
org.apache.sis.internal.jaxb.referencing.SecondDefiningParameterTest.class,
+ // Well Known Text (WKT) base.
+ org.apache.sis.io.wkt.ConventionTest.class,
+ org.apache.sis.io.wkt.SymbolsTest.class,
+ org.apache.sis.io.wkt.TransliteratorTest.class,
+ org.apache.sis.io.wkt.ColorsTest.class,
+ org.apache.sis.io.wkt.FormatterTest.class,
+ org.apache.sis.io.wkt.ElementTest.class,
+ org.apache.sis.metadata.iso.ImmutableIdentifierTest.class,
+
// Identification of objects, needed by large parts of sis-referencing.
org.apache.sis.referencing.NamedIdentifierTest.class,
org.apache.sis.referencing.IdentifiedObjectsTest.class,
[sis] 06/10: Add an optimization enabled by the previous commit
(part of SIS-463).
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 557fb8bc673cfc53a5d34541a21ca666a00cc4d0
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jun 21 15:50:36 2019 +0200
Add an optimization enabled by the previous commit (part of SIS-463).
---
.../java/org/apache/sis/metadata/iso/citation/Citations.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
index 4bea3e6..5eaf426 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
@@ -636,6 +636,15 @@ public final class Citations extends Static {
return true; // Optimisation for a common case.
}
/*
+ * If both argument are one of the constants defined in the Citations class,
+ * then we do not need to compare identifier; call to `equals` is sufficient.
+ * This special case avoids the potentially costly call to `getIdentifiers()`
+ * since that call may cause a connection to the spatial metadata database.
+ */
+ if (c1 instanceof CitationConstant && c2 instanceof CitationConstant) {
+ return c1.equals(c2);
+ }
+ /*
* If there is no identifier in both citations, fallback on title comparisons.
* If there is identifiers in only one citation, make sure that this citation
* is the second one (c2) in order to allow at least one call to
[sis] 08/10: Move AxisDirection from sis-metadata to
sis-referencing. https://issues.apache.org/jira/browse/SIS-463
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit eeebc8d55b248e993bacf5a41a93cf82b3f6bb43
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jun 21 16:21:59 2019 +0200
Move AxisDirection from sis-metadata to sis-referencing.
https://issues.apache.org/jira/browse/SIS-463
---
.../java/org/apache/sis/coverage/grid/GridExtent.java | 2 +-
.../apache/sis/internal/metadata/NameToIdentifier.java | 14 ++++++++++++++
.../sis/internal/metadata/ReferencingServices.java | 18 +-----------------
.../sis/internal/referencing}/AxisDirections.java | 5 +++--
.../sis/internal/referencing/CoordinateOperations.java | 1 -
.../sis/internal/referencing/ReferencingUtilities.java | 3 +--
.../sis/internal/referencing/ServicesForMetadata.java | 17 -----------------
.../sis/internal/referencing/WraparoundAdjustment.java | 1 -
.../org/apache/sis/io/wkt/GeodeticObjectParser.java | 2 +-
.../java/org/apache/sis/io/wkt/Transliterator.java | 2 +-
.../src/main/java/org/apache/sis/referencing/CRS.java | 2 +-
.../sis/referencing/EllipsoidalHeightSeparator.java | 2 +-
.../apache/sis/referencing/crs/DefaultGeodeticCRS.java | 2 +-
.../sis/referencing/crs/DefaultProjectedCRS.java | 2 +-
.../java/org/apache/sis/referencing/cs/AbstractCS.java | 2 +-
.../org/apache/sis/referencing/cs/AxesConvention.java | 2 +-
.../apache/sis/referencing/cs/CoordinateSystems.java | 2 +-
.../org/apache/sis/referencing/cs/DefaultAffineCS.java | 2 +-
.../apache/sis/referencing/cs/DefaultCompoundCS.java | 2 +-
.../referencing/cs/DefaultCoordinateSystemAxis.java | 2 +-
.../sis/referencing/cs/DefaultCylindricalCS.java | 2 +-
.../sis/referencing/cs/DefaultEllipsoidalCS.java | 2 +-
.../org/apache/sis/referencing/cs/DefaultLinearCS.java | 2 +-
.../org/apache/sis/referencing/cs/DefaultPolarCS.java | 2 +-
.../apache/sis/referencing/cs/DefaultSphericalCS.java | 2 +-
.../org/apache/sis/referencing/cs/DefaultTimeCS.java | 2 +-
.../apache/sis/referencing/cs/DefaultVerticalCS.java | 2 +-
.../sis/referencing/cs/DirectionAlongMeridian.java | 2 +-
.../java/org/apache/sis/referencing/cs/Normalizer.java | 2 +-
.../operation/CoordinateOperationFinder.java | 2 +-
.../sis/referencing/operation/matrix/Matrices.java | 2 +-
.../{metadata => referencing}/AxisDirectionsTest.java | 8 ++++----
.../sis/referencing/cs/DefaultCompoundCSTest.java | 2 +-
.../sis/referencing/cs/DefaultCylindricalCSTest.java | 2 +-
.../apache/sis/referencing/cs/DefaultPolarCSTest.java | 2 +-
.../sis/referencing/cs/DefaultSphericalCSTest.java | 2 +-
.../sis/referencing/cs/DirectionAlongMeridianTest.java | 2 +-
.../org/apache/sis/referencing/cs/HardCodedAxes.java | 2 +-
.../apache/sis/test/suite/ReferencingTestSuite.java | 2 +-
.../main/java/org/apache/sis/storage/gdal/Proj4.java | 2 +-
.../java/org/apache/sis/storage/gdal/Proj4Factory.java | 2 +-
.../main/java/org/apache/sis/internal/netcdf/Axis.java | 2 +-
.../main/java/org/apache/sis/internal/netcdf/Grid.java | 2 +-
.../org/apache/sis/internal/netcdf/GridMapping.java | 2 +-
.../org/apache/sis/internal/netcdf/impl/GridInfo.java | 2 +-
.../org/apache/sis/storage/netcdf/MetadataReader.java | 2 +-
46 files changed, 61 insertions(+), 82 deletions(-)
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
index b98b213..b2fa4ec 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
@@ -39,7 +39,7 @@ import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.collection.WeakValueHashMap;
import org.apache.sis.internal.referencing.ExtendedPrecisionMatrix;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.feature.Resources;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.internal.util.Strings;
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
index f888169..4626f51 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
@@ -22,6 +22,7 @@ import java.util.Collection;
import org.opengis.util.NameSpace;
import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
+import org.opengis.referencing.IdentifiedObject;
import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
import org.apache.sis.metadata.iso.citation.Citations;
@@ -288,6 +289,19 @@ public final class NameToIdentifier implements Identifier {
}
/**
+ * Returns {@code true} if the {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getName()
+ * primary name} or an aliases of the given object matches the given name. The comparison ignores case,
+ * some Latin diacritical signs and any characters that are not letters or digits.
+ *
+ * @param object the object for which to check the name or alias.
+ * @param name the name to compare with the object name or aliases.
+ * @return {@code true} if the primary name of at least one alias matches the specified {@code name}.
+ */
+ public static boolean isHeuristicMatchForName(final IdentifiedObject object, final String name) {
+ return isHeuristicMatchForName(object.getName(), object.getAlias(), name, Simplifier.DEFAULT);
+ }
+
+ /**
* A function for simplifying an {@link org.opengis.referencing.IdentifiedObject} name before comparison with
* {@link NameToIdentifier#isHeuristicMatchForName(Identifier, Collection, CharSequence, Simplifier)}.
*
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
index fd83ea4..ac327a6 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
@@ -363,22 +363,6 @@ public class ReferencingServices extends OptionalDependency {
}
/**
- * Returns {@code true} if the {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getName()
- * primary name} or an aliases of the given object matches the given name. The comparison ignores case,
- * some Latin diacritical signs and any characters that are not letters or digits.
- *
- * @param object the object for which to check the name or alias.
- * @param name the name to compare with the object name or aliases.
- * @return {@code true} if the primary name of at least one alias matches the specified {@code name}.
- *
- * @since 0.6
- */
- public boolean isHeuristicMatchForName(final IdentifiedObject object, final String name) {
- return NameToIdentifier.isHeuristicMatchForName(object.getName(), object.getAlias(), name,
- NameToIdentifier.Simplifier.DEFAULT);
- }
-
- /**
* Returns the operation method for the specified name or identifier. The given argument shall be either a
* method name (e.g. <cite>"Transverse Mercator"</cite>) or one of its identifiers (e.g. {@code "EPSG:9807"}).
*
@@ -394,7 +378,7 @@ public class ReferencingServices extends OptionalDependency {
public final OperationMethod getOperationMethod(final Iterable<? extends OperationMethod> methods, final String identifier) {
OperationMethod fallback = null;
for (final OperationMethod method : methods) {
- if (isHeuristicMatchForName(method, identifier) ||
+ if (NameToIdentifier.isHeuristicMatchForName(method, identifier) ||
NameToIdentifier.isHeuristicMatchForIdentifier(method.getIdentifiers(), identifier))
{
/*
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java
similarity index 99%
rename from core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java
rename to core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java
index c159f24..545760c 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.internal.metadata;
+package org.apache.sis.internal.referencing;
import java.util.Map;
import java.util.HashMap;
@@ -25,6 +25,7 @@ import org.opengis.annotation.UML;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.apache.sis.internal.metadata.NameToIdentifier;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.Characters;
import org.apache.sis.util.Utilities;
@@ -524,7 +525,7 @@ next: for (int i=0; i <= limit; i++) {
if (equal) continue;
}
if (match) {
- match = ReferencingServices.getInstance().isHeuristicMatchForName(actual, expected.getName().getCode());
+ match = NameToIdentifier.isHeuristicMatchForName(actual, expected.getName().getCode());
}
}
if (equal) {
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java
index 4327a87..87fb26d 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java
@@ -29,7 +29,6 @@ import org.opengis.referencing.operation.CoordinateOperation;
import org.opengis.referencing.operation.CoordinateOperationFactory;
import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
import org.apache.sis.referencing.operation.AbstractCoordinateOperation;
-import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.system.SystemListener;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
index b5438d2..2fddf38 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
@@ -49,7 +49,6 @@ import org.apache.sis.referencing.crs.DefaultGeographicCRS;
import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.cs.DefaultEllipsoidalCS;
import org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory.Context;
-import org.apache.sis.internal.metadata.AxisDirections;
import static java.util.Collections.singletonMap;
@@ -106,7 +105,7 @@ public final class ReferencingUtilities extends Static {
* @param cs the coordinate system for which to get the unit, or {@code null}.
* @return the unit for all axis in the given coordinate system, or {@code null}.
*
- * @see org.apache.sis.internal.metadata.AxisDirections#getAngularUnit(CoordinateSystem, Unit)
+ * @see org.apache.sis.internal.referencing.AxisDirections#getAngularUnit(CoordinateSystem, Unit)
*/
public static Unit<?> getUnit(final CoordinateSystem cs) {
Unit<?> unit = null;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
index 4c5225e..2396213 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
@@ -58,7 +58,6 @@ import org.apache.sis.geometry.CoordinateFormat;
import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.referencing.IdentifiedObjects;
-import org.apache.sis.referencing.AbstractIdentifiedObject;
import org.apache.sis.referencing.crs.DefaultTemporalCRS;
import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
import org.apache.sis.parameter.DefaultParameterDescriptor;
@@ -69,7 +68,6 @@ import org.apache.sis.metadata.iso.extent.DefaultSpatialTemporalExtent;
import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
import org.apache.sis.measure.Latitude;
import org.apache.sis.measure.Longitude;
-import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Modules;
@@ -551,21 +549,6 @@ public final class ServicesForMetadata extends ReferencingServices {
}
/**
- * Returns {@code true} if the {@linkplain AbstractIdentifiedObject#getName() primary name} or an aliases
- * of the given object matches the given name.
- *
- * @param object the object for which to check the name or alias.
- * @param name the name to compare with the object name or aliases.
- * @return {@code true} if the primary name of at least one alias matches the specified {@code name}.
- *
- * @since 0.6
- */
- @Override
- public boolean isHeuristicMatchForName(final IdentifiedObject object, final String name) {
- return IdentifiedObjects.isHeuristicMatchForName(object, name);
- }
-
- /**
* Returns information about the Apache SIS configuration.
* See super-class for a list of keys.
*
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WraparoundAdjustment.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WraparoundAdjustment.java
index b9e9da5..a84d79e 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WraparoundAdjustment.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WraparoundAdjustment.java
@@ -29,7 +29,6 @@ import org.opengis.referencing.crs.ProjectedCRS;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
import org.apache.sis.referencing.operation.transform.MathTransforms;
-import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.measure.Longitude;
import org.apache.sis.measure.Units;
import org.apache.sis.math.MathFunctions;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
index 3ec0373..7d0bfbe 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
@@ -73,12 +73,12 @@ import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
import org.apache.sis.metadata.iso.extent.DefaultGeographicDescription;
import org.apache.sis.metadata.iso.extent.DefaultVerticalExtent;
import org.apache.sis.metadata.iso.extent.DefaultTemporalExtent;
-import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.metadata.AxisNames;
import org.apache.sis.internal.metadata.VerticalDatumTypes;
import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.metadata.TransformationAccuracy;
import org.apache.sis.internal.referencing.EllipsoidalHeightCombiner;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.util.Constants;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Transliterator.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Transliterator.java
index 85bcb2c..8293c36 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Transliterator.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Transliterator.java
@@ -25,8 +25,8 @@ import org.opengis.referencing.cs.SphericalCS;
import org.opengis.referencing.cs.EllipsoidalCS;
import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.cs.AxisDirection;
-import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.metadata.AxisNames;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Characters;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
index d0bbfd0..8953954 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
@@ -58,7 +58,7 @@ import org.opengis.referencing.operation.TransformException;
import org.apache.sis.measure.Units;
import org.apache.sis.geometry.Envelopes;
import org.apache.sis.geometry.GeneralEnvelope;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.EllipsoidalHeightCombiner;
import org.apache.sis.internal.referencing.PositionalAccuracyConstant;
import org.apache.sis.internal.referencing.CoordinateOperations;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/EllipsoidalHeightSeparator.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/EllipsoidalHeightSeparator.java
index 668a0b9..562fada 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/EllipsoidalHeightSeparator.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/EllipsoidalHeightSeparator.java
@@ -32,7 +32,7 @@ import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.datum.GeodeticDatum;
import org.opengis.referencing.operation.Conversion;
import org.apache.sis.internal.system.DefaultFactories;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.referencing.cs.CoordinateSystems;
import org.apache.sis.referencing.cs.AxisFilter;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
index 5aa247a..15f6476 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
@@ -32,7 +32,7 @@ import org.opengis.referencing.crs.SingleCRS;
import org.opengis.referencing.datum.GeodeticDatum;
import org.opengis.referencing.datum.PrimeMeridian;
import org.apache.sis.internal.referencing.Legacy;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.WKTUtilities;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
index a8a717d..5388e19 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
@@ -39,7 +39,7 @@ import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.operation.DefaultOperationMethod;
import org.apache.sis.internal.referencing.ReferencingUtilities;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.util.Constants;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
index a612991..21a0622 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
@@ -39,7 +39,7 @@ import org.apache.sis.referencing.AbstractIdentifiedObject;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.CRS;
import org.apache.sis.internal.referencing.WKTUtilities;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.system.Modules;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
index d5a4cd5..7e97721 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
@@ -20,7 +20,7 @@ import javax.measure.Unit;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystem; // For javadoc
import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
index 005e9c5..6996a92 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
@@ -41,7 +41,7 @@ import org.apache.sis.util.NullArgumentException;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.util.DoubleDouble;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.referencing.operation.matrix.Matrices;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java
index 33745b1..0bc88d6 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java
@@ -24,7 +24,7 @@ import org.opengis.referencing.cs.AffineCS;
import org.opengis.referencing.cs.CartesianCS;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java
index cb4e029..1d8e7c9 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java
@@ -21,7 +21,7 @@ import java.util.List;
import javax.xml.bind.annotation.XmlTransient;
import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.util.UnmodifiableArrayList;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.Workaround;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
index b3145ae7..9050526 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
@@ -39,7 +39,7 @@ import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.apache.sis.internal.metadata.AxisNames;
import org.apache.sis.internal.referencing.WKTKeywords;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.referencing.AbstractIdentifiedObject;
import org.apache.sis.referencing.IdentifiedObjects;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java
index c9714df..7c9f87c 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.referencing.cs.CylindricalCS;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
index 1d77329..d2423d0 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.referencing.cs.EllipsoidalCS;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.measure.Units;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java
index 9b186ee..588567c 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.referencing.cs.LinearCS;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java
index 0300628..5458797 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.referencing.cs.PolarCS;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java
index 6646bd1..41f89c6 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.referencing.cs.SphericalCS;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java
index 3173810..af5fd1a 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.referencing.cs.TimeCS;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java
index e73dddc..c2fb5ab 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.referencing.cs.VerticalCS;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
index 313cee0..33d2b12 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
@@ -23,7 +23,7 @@ import org.apache.sis.util.iso.Types;
import org.apache.sis.measure.Units;
import org.apache.sis.measure.Longitude;
import org.apache.sis.internal.util.Numerics;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.io.wkt.FormattableObject;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
index 6a7106f..f1c38a8 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
@@ -31,7 +31,7 @@ import org.opengis.referencing.cs.SphericalCS;
import org.opengis.referencing.cs.CylindricalCS;
import org.opengis.referencing.cs.PolarCS;
import org.apache.sis.internal.util.Numerics;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.util.CharSequences;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java
index 2e991ce..dd8aa01 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java
@@ -35,7 +35,7 @@ import org.opengis.metadata.Identifier;
import org.opengis.metadata.extent.GeographicBoundingBox;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.parameter.ParameterDescriptorGroup;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.referencing.provider.Affine;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
index df4d943..2ec524f 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
@@ -33,7 +33,7 @@ import org.apache.sis.util.resources.Errors;
import org.apache.sis.math.DecimalFunctions;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.internal.util.DoubleDouble;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.referencing.ExtendedPrecisionMatrix;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
similarity index 98%
rename from core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java
rename to core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
index 911815b..c711d32 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.internal.metadata;
+package org.apache.sis.internal.referencing;
import java.lang.reflect.Field;
import javax.measure.Unit;
@@ -31,9 +31,9 @@ import org.junit.Test;
import static org.junit.Assert.*;
import static java.lang.StrictMath.abs;
import static org.opengis.referencing.cs.AxisDirection.*;
-import static org.apache.sis.internal.metadata.AxisDirections.AWAY_FROM;
-import static org.apache.sis.internal.metadata.AxisDirections.CLOCKWISE;
-import static org.apache.sis.internal.metadata.AxisDirections.COUNTER_CLOCKWISE;
+import static org.apache.sis.internal.referencing.AxisDirections.AWAY_FROM;
+import static org.apache.sis.internal.referencing.AxisDirections.CLOCKWISE;
+import static org.apache.sis.internal.referencing.AxisDirections.COUNTER_CLOCKWISE;
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
index e198aba..2b1522c 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
@@ -32,7 +32,7 @@ import static org.junit.Assert.*;
* @since 0.4
* @module
*/
-@DependsOn(org.apache.sis.internal.metadata.AxisDirectionsTest.class)
+@DependsOn(org.apache.sis.internal.referencing.AxisDirectionsTest.class)
public final strictfp class DefaultCompoundCSTest extends TestCase {
/**
* Tests {@link DefaultCompoundCS} construction.
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCylindricalCSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCylindricalCSTest.java
index 74ebdf6..59763de 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCylindricalCSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCylindricalCSTest.java
@@ -19,7 +19,7 @@ package org.apache.sis.referencing.cs;
import java.util.Collections;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.RangeMeaning;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
import org.apache.sis.test.TestCase;
import org.apache.sis.test.DependsOn;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultPolarCSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultPolarCSTest.java
index 9af78a1..5f5052d 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultPolarCSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultPolarCSTest.java
@@ -19,7 +19,7 @@ package org.apache.sis.referencing.cs;
import java.util.Collections;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.RangeMeaning;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
import org.apache.sis.test.TestCase;
import org.apache.sis.test.DependsOn;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java
index 0a87af0..1b994f6 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java
@@ -18,7 +18,7 @@ package org.apache.sis.referencing.cs;
import java.util.Collections;
import org.opengis.referencing.cs.AxisDirection;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.test.TestCase;
import org.apache.sis.test.DependsOn;
import org.junit.Test;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
index dabdbbe..a4e3dc4 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
@@ -33,7 +33,7 @@ import static org.apache.sis.test.ReferencingAssert.*;
* @since 0.4
* @module
*/
-@DependsOn(org.apache.sis.internal.metadata.AxisDirectionsTest.class)
+@DependsOn(org.apache.sis.internal.referencing.AxisDirectionsTest.class)
public final strictfp class DirectionAlongMeridianTest extends TestCase {
/**
* Tests the {@link DirectionAlongMeridian#parse(AxisDirection)} method.
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
index 0e82a40..aa8c636 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
@@ -22,7 +22,7 @@ import javax.measure.Unit;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.RangeMeaning;
import org.apache.sis.internal.metadata.AxisNames;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.measure.Units;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java b/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
index 46cc1a8..347b4ea 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
@@ -30,7 +30,7 @@ import org.junit.BeforeClass;
* @module
*/
@Suite.SuiteClasses({
- org.apache.sis.internal.metadata.AxisDirectionsTest.class,
+ org.apache.sis.internal.referencing.AxisDirectionsTest.class,
org.apache.sis.internal.referencing.LazySetTest.class,
org.apache.sis.internal.referencing.FormulasTest.class,
org.apache.sis.internal.referencing.j2d.ShapeUtilitiesTest.class,
diff --git a/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java b/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
index 90d8692..5ebbb37 100644
--- a/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
+++ b/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
@@ -48,7 +48,7 @@ import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.referencing.CRS;
import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.system.OS;
import org.apache.sis.util.logging.Logging;
diff --git a/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java b/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java
index e51b50c..a188743 100644
--- a/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java
+++ b/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java
@@ -47,7 +47,7 @@ import org.apache.sis.internal.util.Constants;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.metadata.iso.citation.DefaultCitation;
import org.apache.sis.metadata.iso.ImmutableIdentifier;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Modules;
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Axis.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Axis.java
index 402da81..5be89ad 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Axis.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Axis.java
@@ -35,7 +35,7 @@ import org.opengis.referencing.operation.Matrix;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.metadata.content.TransferFunctionType;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.referencing.operation.builder.LocalizationGridBuilder;
import org.apache.sis.referencing.operation.transform.TransferFunction;
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Grid.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Grid.java
index c539fa1..dce6940 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Grid.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Grid.java
@@ -31,7 +31,7 @@ import org.opengis.referencing.crs.SingleCRS;
import org.opengis.referencing.crs.GeographicCRS;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.metadata.spatial.DimensionNameType;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.referencing.operation.matrix.Matrices;
import org.apache.sis.referencing.CRS;
import org.apache.sis.coverage.grid.GridExtent;
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/GridMapping.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/GridMapping.java
index 6733462..6c52aa5 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/GridMapping.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/GridMapping.java
@@ -52,7 +52,7 @@ import org.apache.sis.referencing.operation.matrix.Matrix3;
import org.apache.sis.referencing.operation.transform.MathTransforms;
import org.apache.sis.referencing.operation.transform.TransformSeparator;
import org.apache.sis.internal.referencing.j2d.AffineTransform2D;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.storage.DataStoreContentException;
import org.apache.sis.coverage.grid.GridGeometry;
import org.apache.sis.coverage.grid.GridExtent;
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridInfo.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridInfo.java
index cfd0cbd..db9460a 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridInfo.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridInfo.java
@@ -31,7 +31,7 @@ import org.apache.sis.internal.netcdf.Grid;
import org.apache.sis.internal.netcdf.Decoder;
import org.apache.sis.internal.netcdf.Dimension;
import org.apache.sis.internal.netcdf.Resources;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.util.UnmodifiableArrayList;
import org.apache.sis.storage.DataStoreContentException;
import org.apache.sis.storage.DataStoreException;
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java b/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
index 010ff70..5532b33 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
@@ -65,7 +65,7 @@ import org.apache.sis.internal.netcdf.Grid;
import org.apache.sis.internal.storage.io.IOUtilities;
import org.apache.sis.internal.storage.MetadataBuilder;
import org.apache.sis.internal.storage.wkt.StoreFormat;
-import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.CharSequences;
[sis] 10/10: EllipsoidalHeightCombiner leverage
ReferencingFactoryContainer. https://issues.apache.org/jira/browse/SIS-463
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 59a23685545dcf5aac04f369eb3c5cb3731f326a
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jun 21 17:41:30 2019 +0200
EllipsoidalHeightCombiner leverage ReferencingFactoryContainer.
https://issues.apache.org/jira/browse/SIS-463
---
.../referencing/EllipsoidalHeightCombiner.java | 60 ++++++----------------
.../referencing/GeodeticObjectBuilder.java | 8 +--
.../referencing/ReferencingFactoryContainer.java | 32 +++++++++++-
.../main/java/org/apache/sis/referencing/CRS.java | 10 +---
.../referencing/operation/CompoundCRSBuilder.java | 57 --------------------
.../operation/CoordinateOperationFinder.java | 5 +-
.../operation/CoordinateOperationRegistry.java | 5 +-
.../referencing/EllipsoidalHeightCombinerTest.java | 8 +--
8 files changed, 57 insertions(+), 128 deletions(-)
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombiner.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombiner.java
index 96cfdd7..0f90726 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombiner.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombiner.java
@@ -53,32 +53,20 @@ import org.apache.sis.util.ArraysExt;
* @since 0.8
* @module
*/
-public class EllipsoidalHeightCombiner {
+public final class EllipsoidalHeightCombiner extends ReferencingFactoryContainer {
/**
- * The kind of factory initialized by {@link #initialize(int)}.
- */
- protected static final int CRS=1, CS=2, OPERATION=4;
-
- /**
- * The factory to use for creating compound or three-dimensional geographic CRS.
- */
- protected CRSFactory crsFactory;
-
- /**
- * The factory to use for creating three-dimensional ellipsoidal CS, if needed.
- */
- protected CSFactory csFactory;
-
- /**
- * The factory to use for creating defining conversions, if needed.
+ * Creates a new combiner with no initial factory.
*/
- protected CoordinateOperationFactory opFactory;
+ public EllipsoidalHeightCombiner() {
+ }
/**
- * Creates a new combiner with no initial factory.
- * Subclasses must override the {@link #initialize(int)} method.
+ * Creates a new instance initialized to the factories of the given container.
+ *
+ * @param c the container from which to fetch the factories.
*/
- protected EllipsoidalHeightCombiner() {
+ protected EllipsoidalHeightCombiner(final ReferencingFactoryContainer c) {
+ super(c);
}
/**
@@ -92,20 +80,7 @@ public class EllipsoidalHeightCombiner {
public EllipsoidalHeightCombiner(final CRSFactory crsFactory, final CSFactory csFactory,
final CoordinateOperationFactory opFactory)
{
- this.crsFactory = crsFactory;
- this.csFactory = csFactory;
- this.opFactory = opFactory;
- }
-
- /**
- * Initializes the factory identified by the given code. This is used for lazy initialization if any factory given
- * to the constructor was null. In such case, subclass must override. If the same {@code EllipsoidalHeightCombiner}
- * instance is used more than once, than it is subclass responsibility to verify that the {@link #crsFactory},
- * {@link #csFactory} or {@link #opFactory} field has not already been set.
- *
- * @param factoryTypes a bitwise combination of {@link #CRS}, {@link #CS} and {@link #OPERATION}.
- */
- protected void initialize(final int factoryTypes) {
+ super(crsFactory, csFactory, opFactory);
}
/**
@@ -164,11 +139,9 @@ public class EllipsoidalHeightCombiner {
final Map<String,?> crsProps = (components.length == 2) ? properties
: IdentifiedObjects.getProperties(crs, CoordinateReferenceSystem.IDENTIFIERS_KEY);
if (crs instanceof GeodeticCRS) {
- initialize(CS | CRS);
- cs = csFactory.createEllipsoidalCS(csProps, axes[0], axes[1], axes[2]);
- crs = crsFactory.createGeographicCRS(crsProps, ((GeodeticCRS) crs).getDatum(), (EllipsoidalCS) cs);
+ cs = getCSFactory().createEllipsoidalCS(csProps, axes[0], axes[1], axes[2]);
+ crs = getCRSFactory().createGeographicCRS(crsProps, ((GeodeticCRS) crs).getDatum(), (EllipsoidalCS) cs);
} else {
- initialize(CS | CRS | OPERATION);
final ProjectedCRS proj = (ProjectedCRS) crs;
GeographicCRS base = proj.getBaseCRS();
if (base.getCoordinateSystem().getDimension() == 2) {
@@ -181,10 +154,11 @@ public class EllipsoidalHeightCombiner {
* for letting SIS create or associate new ones, which will be three-dimensional now.
*/
Conversion fromBase = proj.getConversionFromBase();
- fromBase = opFactory.createDefiningConversion(IdentifiedObjects.getProperties(fromBase),
+ fromBase = getCoordinateOperationFactory().createDefiningConversion(
+ IdentifiedObjects.getProperties(fromBase),
fromBase.getMethod(), fromBase.getParameterValues());
- cs = csFactory.createCartesianCS(csProps, axes[0], axes[1], axes[2]);
- crs = crsFactory.createProjectedCRS(crsProps, base, fromBase, (CartesianCS) cs);
+ cs = getCSFactory().createCartesianCS(csProps, axes[0], axes[1], axes[2]);
+ crs = getCRSFactory().createProjectedCRS(crsProps, base, fromBase, (CartesianCS) cs);
}
/*
* Remove the VerticalCRS and store the three-dimensional GeographicCRS in place of the previous
@@ -200,7 +174,7 @@ public class EllipsoidalHeightCombiner {
switch (components.length) {
case 0: return null;
case 1: return components[0];
- default: initialize(CRS); return crsFactory.createCompoundCRS(properties, components);
+ default: return getCRSFactory().createCompoundCRS(properties, components);
}
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
index 74c24cd..683a1ca 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
@@ -508,13 +508,7 @@ public final class GeodeticObjectBuilder extends Builder<GeodeticObjectBuilder>
* @throws FactoryException if the object creation failed.
*/
public CoordinateReferenceSystem createCompoundCRS(final CoordinateReferenceSystem... components) throws FactoryException {
- return new EllipsoidalHeightCombiner() {
- @Override public void initialize(final int factoryTypes) {
- if ((factoryTypes & CRS) != 0) crsFactory = factories.getCRSFactory();
- if ((factoryTypes & CS) != 0) csFactory = factories.getCSFactory();
- if ((factoryTypes & OPERATION) != 0) opFactory = factories.getCoordinateOperationFactory();
- }
- }.createCompoundCRS(properties, components);
+ return new EllipsoidalHeightCombiner(factories).createCompoundCRS(properties, components);
}
/**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingFactoryContainer.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingFactoryContainer.java
index 3a3e6a7..d495833 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingFactoryContainer.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingFactoryContainer.java
@@ -28,9 +28,9 @@ import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.CoordinateOperationFactory;
import org.opengis.referencing.operation.CoordinateOperationAuthorityFactory;
import org.apache.sis.referencing.factory.NoSuchAuthorityFactoryException;
+import org.apache.sis.referencing.CRS;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.util.Constants;
-import org.apache.sis.referencing.CRS;
/**
@@ -116,6 +116,36 @@ public class ReferencingFactoryContainer {
}
/**
+ * Creates a new instance initialized to the factories of the given container.
+ *
+ * @param c the container from which to fetch the factories.
+ */
+ protected ReferencingFactoryContainer(final ReferencingFactoryContainer c) {
+ crsAuthorityFactory = c.crsAuthorityFactory;
+ datumFactory = c.datumFactory;
+ csFactory = c.csFactory;
+ crsFactory = c.crsFactory;
+ operationFactory = c.operationFactory;
+ mtFactory = c.mtFactory;
+ }
+
+ /**
+ * Creates a new instance which will use the given factories.
+ * Any factory given in argument may be {@code null} if lazy instantiation is desired.
+ *
+ * @param crsFactory the factory to use for creating compound or three-dimensional geographic CRS.
+ * @param csFactory the factory to use for creating three-dimensional ellipsoidal CS, if needed.
+ * @param operationFactory the factory to use for creating defining conversions, if needed.
+ */
+ protected ReferencingFactoryContainer(final CRSFactory crsFactory, final CSFactory csFactory,
+ final CoordinateOperationFactory operationFactory)
+ {
+ this.crsFactory = crsFactory;
+ this.csFactory = csFactory;
+ this.operationFactory = operationFactory;
+ }
+
+ /**
* Returns the factory for creating coordinate reference systems from authority codes.
* Currently only EPSG codes are supported.
*
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
index 8953954..1b9b49d 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
@@ -30,7 +30,6 @@ import org.opengis.referencing.cs.EllipsoidalCS;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.opengis.referencing.cs.CSFactory;
import org.opengis.referencing.crs.CRSFactory;
import org.opengis.referencing.crs.SingleCRS;
import org.opengis.referencing.crs.CompoundCRS;
@@ -46,7 +45,6 @@ import org.opengis.referencing.crs.EngineeringCRS;
import org.opengis.referencing.datum.Datum;
import org.opengis.referencing.datum.GeodeticDatum;
import org.opengis.referencing.operation.Conversion;
-import org.opengis.referencing.operation.CoordinateOperationFactory;
import org.opengis.referencing.operation.OperationNotFoundException;
import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.extent.Extent;
@@ -921,13 +919,7 @@ public final class CRS extends Static {
break;
}
}
- return new EllipsoidalHeightCombiner() {
- @Override public void initialize(final int factoryTypes) {
- if ((factoryTypes & CRS) != 0) crsFactory = DefaultFactories.forBuildin(CRSFactory.class);
- if ((factoryTypes & CS) != 0) csFactory = DefaultFactories.forBuildin(CSFactory.class);
- if ((factoryTypes & OPERATION) != 0) opFactory = DefaultFactories.forBuildin(CoordinateOperationFactory.class);
- }
- }.createCompoundCRS(components);
+ return new EllipsoidalHeightCombiner().createCompoundCRS(components);
}
/**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CompoundCRSBuilder.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CompoundCRSBuilder.java
deleted file mode 100644
index d9b2062..0000000
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CompoundCRSBuilder.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.referencing.operation;
-
-import org.apache.sis.internal.referencing.EllipsoidalHeightCombiner;
-import org.opengis.referencing.operation.CoordinateOperationFactory;
-
-
-/**
- * Helper class for combining two-dimensional geographic or projected CRS with an ellipsoidal height
- * into a three-dimensional CRS.
- *
- * @author Martin Desruisseaux (Geomatys)
- * @version 0.8
- * @since 0.8
- * @module
- */
-final class CompoundCRSBuilder extends EllipsoidalHeightCombiner {
- /**
- * The Apache SIS implementation of {@link CoordinateOperationFactory}.
- */
- private final DefaultCoordinateOperationFactory factorySIS;
-
- /**
- * Creates a new builder for the given coordinate operation factory.
- *
- * @param factory the factory to use for creating coordinate operations.
- * @param factorySIS used only when we need a SIS-specific method.
- */
- CompoundCRSBuilder(final CoordinateOperationFactory factory, final DefaultCoordinateOperationFactory factorySIS) {
- super(null, null, factory);
- this.factorySIS = factorySIS;
- }
-
- /**
- * Invoked when the builder needs a CRS or CS factory.
- */
- @Override
- public void initialize(final int factoryTypes) {
- if ((factoryTypes & CRS) != 0) crsFactory = factorySIS.getCRSFactory();
- if ((factoryTypes & CS) != 0) csFactory = factorySIS.getCSFactory();
- }
-}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java
index dd8aa01..79bbbbc 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java
@@ -37,6 +37,7 @@ import org.opengis.parameter.ParameterValueGroup;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.apache.sis.internal.referencing.AxisDirections;
import org.apache.sis.internal.referencing.CoordinateOperations;
+import org.apache.sis.internal.referencing.EllipsoidalHeightCombiner;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.referencing.provider.Affine;
import org.apache.sis.internal.referencing.provider.DatumShiftMethod;
@@ -970,8 +971,8 @@ public class CoordinateOperationFinder extends CoordinateOperationRegistry {
} else if (stepComponents.length == 1) {
stepTargetCRS = target; // Slight optimization of the next block.
} else {
- stepTargetCRS = toAuthorityDefinition(CoordinateReferenceSystem.class,
- new CompoundCRSBuilder(factory, factorySIS).createCompoundCRS(derivedFrom(target), stepComponents));
+ final EllipsoidalHeightCombiner c = new EllipsoidalHeightCombiner(factorySIS.getCRSFactory(), factorySIS.getCSFactory(), factory);
+ stepTargetCRS = toAuthorityDefinition(CoordinateReferenceSystem.class, c.createCompoundCRS(derivedFrom(target), stepComponents));
}
int delta = source.getCoordinateSystem().getDimension();
final int startAtDimension = endAtDimension;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
index a11b64e..91feda4 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
@@ -62,6 +62,7 @@ import org.apache.sis.metadata.iso.extent.Extents;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.DeferredCoordinateOperation;
+import org.apache.sis.internal.referencing.EllipsoidalHeightCombiner;
import org.apache.sis.internal.referencing.PositionalAccuracyConstant;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.referencing.provider.Affine;
@@ -1024,8 +1025,8 @@ class CoordinateOperationRegistry {
return candidate; // Keep the existing instance since it may contain useful metadata.
}
}
- return toAuthorityDefinition(CoordinateReferenceSystem.class,
- new CompoundCRSBuilder(factory, factorySIS).createCompoundCRS(derivedFrom(crs), crs, CommonCRS.Vertical.ELLIPSOIDAL.crs()));
+ final EllipsoidalHeightCombiner c = new EllipsoidalHeightCombiner(factorySIS.getCRSFactory(), factorySIS.getCSFactory(), factory);
+ return toAuthorityDefinition(CoordinateReferenceSystem.class, c.createCompoundCRS(derivedFrom(crs), crs, CommonCRS.Vertical.ELLIPSOIDAL.crs()));
}
/**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombinerTest.java b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombinerTest.java
index 2666dec..a71c9fa 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombinerTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombinerTest.java
@@ -62,13 +62,7 @@ public final strictfp class EllipsoidalHeightCombinerTest extends TestCase {
*/
private static EllipsoidalHeightCombiner create() {
final GeodeticObjectFactory factory = new GeodeticObjectFactory();
- return new EllipsoidalHeightCombiner(factory, factory, null) {
- @Override protected void initialize(final int factoryTypes) {
- if ((factoryTypes & OPERATION) != 0) {
- opFactory = new DefaultCoordinateOperationFactory();
- }
- }
- };
+ return new EllipsoidalHeightCombiner(factory, factory, new DefaultCoordinateOperationFactory());
}
/**
[sis] 09/10: Remove ReferencingServices that do not need anymore to
be in that class. https://issues.apache.org/jira/browse/SIS-463
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 2fc100b607108501ee1039e411b5a77cae7ab587
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jun 21 17:11:10 2019 +0200
Remove ReferencingServices that do not need anymore to be in that class.
https://issues.apache.org/jira/browse/SIS-463
---
.../sis/internal/metadata/ReferencingServices.java | 112 +--------------------
.../metadata/iso/extent/DefaultVerticalExtent.java | 4 +-
.../internal/referencing/CoordinateOperations.java | 100 +++++++++++++++++-
.../referencing/ReferencingFactoryContainer.java | 22 ++++
.../internal/referencing/ServicesForMetadata.java | 42 +-------
.../apache/sis/io/wkt/GeodeticObjectParser.java | 16 +--
.../org/apache/sis/io/wkt/MathTransformParser.java | 4 +-
.../sis/referencing/crs/AbstractDerivedCRS.java | 4 +-
.../referencing/datum/DefaultGeodeticDatum.java | 4 +-
.../referencing/factory/GeodeticObjectFactory.java | 4 +-
.../referencing/factory/sql/EPSGDataAccess.java | 9 +-
.../operation/AbstractSingleOperation.java | 4 +-
.../operation/CoordinateOperationRegistry.java | 9 +-
.../DefaultCoordinateOperationFactory.java | 25 ++---
.../operation/InverseOperationMethod.java | 4 +-
.../operation/projection/NormalizedProjection.java | 5 +-
.../transform/DefaultMathTransformFactory.java | 5 +-
.../operation/DefaultConversionTest.java | 4 +-
.../operation/DefaultTransformationTest.java | 4 +-
.../org/apache/sis/storage/gdal/Proj4Factory.java | 18 ++--
20 files changed, 185 insertions(+), 214 deletions(-)
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
index ac327a6..f03647d 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
@@ -16,7 +16,6 @@
*/
package org.apache.sis.internal.metadata;
-import java.util.Map;
import java.util.Locale;
import java.util.TimeZone;
import java.text.Format;
@@ -24,13 +23,7 @@ import org.opengis.geometry.Envelope;
import org.opengis.geometry.DirectPosition;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.referencing.IdentifiedObject;
-import org.opengis.referencing.crs.CRSFactory;
-import org.opengis.referencing.cs.CSFactory;
-import org.opengis.referencing.datum.DatumFactory;
-import org.opengis.referencing.operation.MathTransform;
-import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.CoordinateOperationFactory;
-import org.opengis.referencing.operation.OperationMethod;
import org.opengis.referencing.operation.TransformException;
import org.opengis.util.FactoryException;
import org.apache.sis.metadata.iso.extent.DefaultExtent;
@@ -41,7 +34,6 @@ import org.apache.sis.metadata.iso.extent.DefaultSpatialTemporalExtent;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.OptionalDependency;
import org.apache.sis.internal.system.Modules;
-import org.apache.sis.util.Deprecable;
/**
@@ -71,53 +63,6 @@ public class ReferencingServices extends OptionalDependency {
public static final double AUTHALIC_RADIUS = 6371007;
/**
- * The {@link org.apache.sis.referencing.datum.DefaultGeodeticDatum#BURSA_WOLF_KEY} value.
- */
- public static final String BURSA_WOLF_KEY = "bursaWolf";
-
- /**
- * The key for specifying explicitly the value to be returned by
- * {@link org.apache.sis.referencing.operation.DefaultConversion#getParameterValues()}.
- * It is usually not necessary to specify those parameters because they are inferred either from
- * the {@link MathTransform}, or specified explicitly in a {@code DefiningConversion}. However
- * there is a few cases, for example the Molodenski transform, where none of the above can apply,
- * because SIS implements those operations as a concatenation of math transforms, and such
- * concatenations do not have {@link org.opengis.parameter.ParameterValueGroup}.
- */
- public static final String PARAMETERS_KEY = "parameters";
-
- /**
- * The key for specifying the base type of the coordinate operation to create. This optional entry
- * is used by {@code DefaultCoordinateOperationFactory.createSingleOperation(…)}. Apache SIS tries
- * to infer this value automatically, but this entry may help SIS to perform a better choice in
- * some cases. For example an "Affine" operation can be both a conversion or a transformation
- * (the later is used in datum shift in geocentric coordinates).
- */
- public static final String OPERATION_TYPE_KEY = "operationType";
-
- /**
- * The key for specifying a {@link MathTransformFactory} instance to use for geodetic object constructions.
- * This is usually not needed for CRS construction, except in the special case of a derived CRS created
- * from a defining conversion.
- */
- public static final String MT_FACTORY = "mtFactory";
-
- /**
- * The key for specifying a {@link CRSFactory} instance to use for geodetic object constructions.
- */
- public static final String CRS_FACTORY = "crsFactory";
-
- /**
- * The key for specifying a {@link CSFactory} instance to use for geodetic object constructions.
- */
- public static final String CS_FACTORY = "csFactory";
-
- /**
- * The key for specifying a {@link DatumFactory} instance to use for geodetic object constructions.
- */
- public static final String DATUM_FACTORY = "datumFactory";
-
- /**
* The services, fetched when first needed.
*/
private static volatile ReferencingServices instance;
@@ -301,7 +246,7 @@ public class ReferencingServices extends OptionalDependency {
///////////////////////////////////////////////////////////////////////////////////////
//// ////
- //// SERVICES FOR WKT FORMATTING ////
+ //// OTHER REFERENCING SERVICES ////
//// ////
///////////////////////////////////////////////////////////////////////////////////////
@@ -332,28 +277,11 @@ public class ReferencingServices extends OptionalDependency {
}
/**
- * Returns the coordinate operation factory to use for the given properties and math transform factory.
- * If the given properties are empty and the {@code mtFactory} is the system default, then this method
- * returns the system default {@code CoordinateOperationFactory} instead of creating a new one.
+ * Returns the default coordinate operation factory.
*
- * <p>It is okay to set all parameters to {@code null} in order to get the system default factory.</p>
- *
- * @param properties the default properties.
- * @param mtFactory the math transform factory to use.
- * @param crsFactory the factory to use if the operation factory needs to create CRS for intermediate steps.
- * @param csFactory the factory to use if the operation factory needs to create CS for intermediate steps.
* @return the coordinate operation factory to use.
- *
- * @since 0.7
*/
- public CoordinateOperationFactory getCoordinateOperationFactory(Map<String,?> properties,
- final MathTransformFactory mtFactory, final CRSFactory crsFactory, final CSFactory csFactory)
- {
- /*
- * The check for 'properties' and 'mtFactory' is performed by the ServicesForMetadata subclass. If this code is
- * executed, this means that the "sis-referencing" module is not on the classpath, in which case we do not know
- * how to pass the 'properties' and 'mtFactory' arguments to the foreigner CoordinateOperationFactory anyway.
- */
+ public CoordinateOperationFactory getCoordinateOperationFactory() {
final CoordinateOperationFactory factory = DefaultFactories.forClass(CoordinateOperationFactory.class);
if (factory != null) {
return factory;
@@ -363,40 +291,6 @@ public class ReferencingServices extends OptionalDependency {
}
/**
- * Returns the operation method for the specified name or identifier. The given argument shall be either a
- * method name (e.g. <cite>"Transverse Mercator"</cite>) or one of its identifiers (e.g. {@code "EPSG:9807"}).
- *
- * @param methods the method candidates.
- * @param identifier the name or identifier of the operation method to search.
- * @return the coordinate operation method for the given name or identifier, or {@code null} if none.
- *
- * @see org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory#getOperationMethod(String)
- * @see org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#getOperationMethod(String)
- *
- * @since 0.6
- */
- public final OperationMethod getOperationMethod(final Iterable<? extends OperationMethod> methods, final String identifier) {
- OperationMethod fallback = null;
- for (final OperationMethod method : methods) {
- if (NameToIdentifier.isHeuristicMatchForName(method, identifier) ||
- NameToIdentifier.isHeuristicMatchForIdentifier(method.getIdentifiers(), identifier))
- {
- /*
- * Stop the iteration at the first non-deprecated method.
- * If we find only deprecated methods, take the first one.
- */
- if (!(method instanceof Deprecable) || !((Deprecable) method).isDeprecated()) {
- return method;
- }
- if (fallback == null) {
- fallback = method;
- }
- }
- }
- return fallback;
- }
-
- /**
* Returns information about the Apache SIS configuration to be reported in {@link org.apache.sis.setup.About}.
* This method is invoked only for aspects that depends on other modules than {@code sis-utility}.
*
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java
index 55e5c62..1638288 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java
@@ -328,8 +328,8 @@ public class DefaultVerticalExtent extends ISOMetadata implements VerticalExtent
private MathTransform1D getConversionFrom(final VerticalCRS source) throws FactoryException {
if (!Utilities.equalsIgnoreMetadata(verticalCRS, source) && verticalCRS != null && source != null) {
final MathTransform1D cv = (MathTransform1D) ReferencingServices.getInstance()
- .getCoordinateOperationFactory(null, null, null, null)
- .createOperation(source, verticalCRS).getMathTransform();
+ .getCoordinateOperationFactory().createOperation(source, verticalCRS)
+ .getMathTransform();
if (!cv.isIdentity()) {
return cv;
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java
index 87fb26d..21397ee 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/CoordinateOperations.java
@@ -17,23 +17,32 @@
package org.apache.sis.internal.referencing;
import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
import java.util.Collections;
import javax.measure.UnitConverter;
import javax.measure.IncommensurableException;
+import org.opengis.referencing.cs.CSFactory;
import org.opengis.referencing.cs.RangeMeaning;
import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.crs.CRSFactory;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.crs.GeneralDerivedCRS;
+import org.opengis.referencing.operation.OperationMethod;
import org.opengis.referencing.operation.CoordinateOperation;
import org.opengis.referencing.operation.CoordinateOperationFactory;
+import org.opengis.referencing.operation.MathTransformFactory;
import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
import org.apache.sis.referencing.operation.AbstractCoordinateOperation;
+import org.apache.sis.internal.metadata.NameToIdentifier;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.system.SystemListener;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.internal.jdk9.JDK9;
+import org.apache.sis.util.Deprecable;
+import org.apache.sis.util.collection.Containers;
/**
@@ -41,12 +50,37 @@ import org.apache.sis.internal.jdk9.JDK9;
* until first needed. Contains also utility methods related to coordinate operations.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
* @since 0.7
* @module
*/
public final class CoordinateOperations extends SystemListener {
/**
+ * The {@link org.apache.sis.referencing.datum.DefaultGeodeticDatum#BURSA_WOLF_KEY} value.
+ */
+ public static final String BURSA_WOLF_KEY = "bursaWolf";
+
+ /**
+ * The key for specifying explicitly the value to be returned by
+ * {@link org.apache.sis.referencing.operation.DefaultConversion#getParameterValues()}.
+ * It is usually not necessary to specify those parameters because they are inferred either from the
+ * {@link org.opengis.referencing.operation.MathTransform}, or specified explicitly in a {@code DefiningConversion}.
+ * However there is a few cases, for example the Molodenski transform, where none of the above can apply,
+ * because SIS implements those operations as a concatenation of math transforms,
+ * and such concatenations do not have {@link org.opengis.parameter.ParameterValueGroup}.
+ */
+ public static final String PARAMETERS_KEY = "parameters";
+
+ /**
+ * The key for specifying the base type of the coordinate operation to create. This optional entry
+ * is used by {@code DefaultCoordinateOperationFactory.createSingleOperation(…)}. Apache SIS tries
+ * to infer this value automatically, but this entry may help SIS to perform a better choice in
+ * some cases. For example an "Affine" operation can be both a conversion or a transformation
+ * (the later is used in datum shift in geocentric coordinates).
+ */
+ public static final String OPERATION_TYPE_KEY = "operationType";
+
+ /**
* Cached values or {@link #wrapAroundChanges wrapAroundChanges(…)}, created when first needed.
* Indices are bit masks computed by {@link #changes changes(…)}. Since the most common "wrap around" axes
* are longitude at dimension 0 or 1, and some measurement of time (in climatology) at dimension 2 or 3,
@@ -105,6 +139,70 @@ public final class CoordinateOperations extends SystemListener {
}
/**
+ * Returns the coordinate operation factory to use for the given properties and math transform factory.
+ * If the given properties are empty and the {@code mtFactory} is the system default, then this method
+ * returns the system default {@code CoordinateOperationFactory} instead of creating a new one.
+ *
+ * <p>It is okay to set all parameters to {@code null} in order to get the system default factory.</p>
+ *
+ * @param properties the default properties.
+ * @param mtFactory the math transform factory to use.
+ * @param crsFactory the factory to use if the operation factory needs to create CRS for intermediate steps.
+ * @param csFactory the factory to use if the operation factory needs to create CS for intermediate steps.
+ * @return the coordinate operation factory to use.
+ */
+ public static CoordinateOperationFactory getCoordinateOperationFactory(Map<String,?> properties,
+ final MathTransformFactory mtFactory, final CRSFactory crsFactory, final CSFactory csFactory)
+ {
+ if (Containers.isNullOrEmpty(properties)) {
+ if (DefaultFactories.isDefaultInstance(MathTransformFactory.class, mtFactory) &&
+ DefaultFactories.isDefaultInstance(CRSFactory.class, crsFactory) &&
+ DefaultFactories.isDefaultInstance(CSFactory.class, csFactory))
+ {
+ return CoordinateOperations.factory();
+ }
+ properties = Collections.emptyMap();
+ }
+ final HashMap<String,Object> p = new HashMap<>(properties);
+ p.putIfAbsent(ReferencingFactoryContainer.CRS_FACTORY, crsFactory);
+ p.putIfAbsent(ReferencingFactoryContainer.CS_FACTORY, csFactory);
+ properties = p;
+ return new DefaultCoordinateOperationFactory(properties, mtFactory);
+ }
+
+ /**
+ * Returns the operation method for the specified name or identifier. The given argument shall be either a
+ * method name (e.g. <cite>"Transverse Mercator"</cite>) or one of its identifiers (e.g. {@code "EPSG:9807"}).
+ *
+ * @param methods the method candidates.
+ * @param identifier the name or identifier of the operation method to search.
+ * @return the coordinate operation method for the given name or identifier, or {@code null} if none.
+ *
+ * @see org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory#getOperationMethod(String)
+ * @see org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#getOperationMethod(String)
+ */
+ public static OperationMethod getOperationMethod(final Iterable<? extends OperationMethod> methods, final String identifier) {
+ OperationMethod fallback = null;
+ for (final OperationMethod method : methods) {
+ if (NameToIdentifier.isHeuristicMatchForName(method, identifier) ||
+ NameToIdentifier.isHeuristicMatchForIdentifier(method.getIdentifiers(), identifier))
+ {
+ /*
+ * Stop the iteration at the first non-deprecated method.
+ * If we find only deprecated methods, take the first one.
+ */
+ if (!(method instanceof Deprecable) || !((Deprecable) method).isDeprecated()) {
+ return method;
+ }
+ if (fallback == null) {
+ fallback = method;
+ }
+ }
+ }
+ return fallback;
+ }
+
+ /**
* Returns {@code true} if the given axis is of kind "Wrap Around".
* Defined here because used together with {@link #wrapAroundChanges wrapAroundChanges(…)}.
*
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingFactoryContainer.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingFactoryContainer.java
index 7cd98bd..3a3e6a7 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingFactoryContainer.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingFactoryContainer.java
@@ -52,6 +52,28 @@ import org.apache.sis.referencing.CRS;
*/
public class ReferencingFactoryContainer {
/**
+ * The key for specifying a {@link MathTransformFactory} instance to use for geodetic object constructions.
+ * This is usually not needed for CRS construction, except in the special case of a derived CRS created
+ * from a defining conversion.
+ */
+ public static final String MT_FACTORY = "mtFactory";
+
+ /**
+ * The key for specifying a {@link CRSFactory} instance to use for geodetic object constructions.
+ */
+ public static final String CRS_FACTORY = "crsFactory";
+
+ /**
+ * The key for specifying a {@link CSFactory} instance to use for geodetic object constructions.
+ */
+ public static final String CS_FACTORY = "csFactory";
+
+ /**
+ * The key for specifying a {@link DatumFactory} instance to use for geodetic object constructions.
+ */
+ public static final String DATUM_FACTORY = "datumFactory";
+
+ /**
* The factory for creating coordinate reference systems from authority codes.
* If null, then a default factory will be created only when first needed.
*/
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
index 2396213..289ff48 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
@@ -16,11 +16,8 @@
*/
package org.apache.sis.internal.referencing;
-import java.util.Map;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.Collection;
-import java.util.Collections;
import java.util.Locale;
import java.util.TimeZone;
import java.text.Format;
@@ -34,10 +31,7 @@ import org.opengis.referencing.crs.TemporalCRS;
import org.opengis.referencing.crs.VerticalCRS;
import org.opengis.referencing.crs.GeographicCRS;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.opengis.referencing.crs.CRSFactory;
-import org.opengis.referencing.cs.CSFactory;
import org.opengis.referencing.cs.CoordinateSystem;
-import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.TransformException;
import org.opengis.referencing.operation.CoordinateOperation;
import org.opengis.referencing.operation.CoordinateOperationFactory;
@@ -59,7 +53,6 @@ import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.crs.DefaultTemporalCRS;
-import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
import org.apache.sis.parameter.DefaultParameterDescriptor;
import org.apache.sis.metadata.iso.extent.DefaultExtent;
import org.apache.sis.metadata.iso.extent.DefaultVerticalExtent;
@@ -69,11 +62,9 @@ import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
import org.apache.sis.measure.Latitude;
import org.apache.sis.measure.Longitude;
import org.apache.sis.internal.metadata.ReferencingServices;
-import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.TemporalUtilities;
-import org.apache.sis.util.collection.Containers;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.logging.Logging;
@@ -484,7 +475,7 @@ public final class ServicesForMetadata extends ReferencingServices {
///////////////////////////////////////////////////////////////////////////////////////
//// ////
- //// SERVICES FOR WKT PARSING AND FORMATTING ////
+ //// OTHER REFERENCING SERVICES ////
//// ////
///////////////////////////////////////////////////////////////////////////////////////
@@ -514,38 +505,13 @@ public final class ServicesForMetadata extends ReferencingServices {
}
/**
- * Returns the coordinate operation factory to use for the given properties and math transform factory.
- * If the given properties are empty and the {@code mtFactory} is the system default, then this method
- * returns the system default {@code CoordinateOperationFactory} instead of creating a new one.
+ * Returns the default coordinate operation factory.
*
- * <p>It is okay to set all parameters to {@code null} in order to get the system default factory.</p>
- *
- * @param properties the default properties.
- * @param mtFactory the math transform factory to use.
- * @param crsFactory the factory to use if the operation factory needs to create CRS for intermediate steps.
- * @param csFactory the factory to use if the operation factory needs to create CS for intermediate steps.
* @return the coordinate operation factory to use.
- *
- * @since 0.7
*/
@Override
- public CoordinateOperationFactory getCoordinateOperationFactory(Map<String,?> properties,
- final MathTransformFactory mtFactory, final CRSFactory crsFactory, final CSFactory csFactory)
- {
- if (Containers.isNullOrEmpty(properties)) {
- if (DefaultFactories.isDefaultInstance(MathTransformFactory.class, mtFactory) &&
- DefaultFactories.isDefaultInstance(CRSFactory.class, crsFactory) &&
- DefaultFactories.isDefaultInstance(CSFactory.class, csFactory))
- {
- return CoordinateOperations.factory();
- }
- properties = Collections.emptyMap();
- }
- final HashMap<String,Object> p = new HashMap<>(properties);
- p.putIfAbsent(CRS_FACTORY, crsFactory);
- p.putIfAbsent(CS_FACTORY, csFactory);
- properties = p;
- return new DefaultCoordinateOperationFactory(properties, mtFactory);
+ public CoordinateOperationFactory getCoordinateOperationFactory() {
+ return CoordinateOperations.factory();
}
/**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
index 7d0bfbe..5c5c1da 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
@@ -75,7 +75,6 @@ import org.apache.sis.metadata.iso.extent.DefaultVerticalExtent;
import org.apache.sis.metadata.iso.extent.DefaultTemporalExtent;
import org.apache.sis.internal.metadata.AxisNames;
import org.apache.sis.internal.metadata.VerticalDatumTypes;
-import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.metadata.TransformationAccuracy;
import org.apache.sis.internal.referencing.EllipsoidalHeightCombiner;
import org.apache.sis.internal.referencing.AxisDirections;
@@ -135,11 +134,6 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
private final CoordinateOperationFactory opFactory;
/**
- * Other services from "sis-referencing" module which can not be provided by the standard factories.
- */
- private final ReferencingServices referencing;
-
- /**
* During WKT 1 parsing, {@code true} means that {@code PRIMEM} and {@code PARAMETER} angular units
* need to be forced to {@code Units.DEGREE} instead than inferred from the context.
* Note that this rule does not apply to {@code AXIS} elements
@@ -215,8 +209,7 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
crsFactory = (CRSFactory) factories;
csFactory = (CSFactory) factories;
datumFactory = (DatumFactory) factories;
- referencing = ReferencingServices.getInstance();
- opFactory = referencing.getCoordinateOperationFactory(defaultProperties, mtFactory, crsFactory, csFactory);
+ opFactory = CoordinateOperations.getCoordinateOperationFactory(defaultProperties, mtFactory, crsFactory, csFactory);
transliterator = Transliterator.DEFAULT;
usesCommonUnits = false;
ignoreAxes = false;
@@ -246,14 +239,13 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
crsFactory = getFactory(CRSFactory.class, factories);
csFactory = getFactory(CSFactory.class, factories);
datumFactory = getFactory(DatumFactory.class, factories);
- referencing = ReferencingServices.getInstance();
usesCommonUnits = convention.usesCommonUnits;
ignoreAxes = convention == Convention.WKT1_IGNORE_AXES;
final Factory f = factories.get(CoordinateOperationFactory.class);
if (f != null) {
opFactory = (CoordinateOperationFactory) f;
} else {
- opFactory = referencing.getCoordinateOperationFactory(null, mtFactory, crsFactory, csFactory);
+ opFactory = CoordinateOperations.getCoordinateOperationFactory(null, mtFactory, crsFactory, csFactory);
factories.put(CoordinateOperationFactory.class, opFactory);
}
}
@@ -1429,7 +1421,7 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
meridian = CommonCRS.WGS84.primeMeridian();
}
if (toWGS84 != null) {
- properties.put(ReferencingServices.BURSA_WOLF_KEY, toWGS84);
+ properties.put(CoordinateOperations.BURSA_WOLF_KEY, toWGS84);
}
try {
return datumFactory.createGeodeticDatum(properties, ellipsoid, meridian);
@@ -2289,7 +2281,7 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
final Map<String,Object> properties = parseMetadataAndClose(element, name, method);
final ParameterValueGroup parameters = method.getParameters().createValue();
parseParameters(element, parameters, null, null);
- properties.put(ReferencingServices.PARAMETERS_KEY, parameters);
+ properties.put(CoordinateOperations.PARAMETERS_KEY, parameters);
if (accuracy != null) {
properties.put(CoordinateOperation.COORDINATE_OPERATION_ACCURACY_KEY,
TransformationAccuracy.create(accuracy.pullDouble("accuracy")));
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
index ba4defc..390f1b5 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
@@ -38,8 +38,8 @@ import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.NoninvertibleTransformException;
import org.opengis.referencing.operation.OperationMethod;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.WKTKeywords;
-import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.math.DecimalFunctions;
import org.apache.sis.measure.UnitFormat;
@@ -531,7 +531,7 @@ class MathTransformParser extends AbstractParser {
* getLastMethod(). Performs a slower and less robust check as a fallback.
*/
if (classification != null) {
- lastMethod = ReferencingServices.getInstance().getOperationMethod(
+ lastMethod = CoordinateOperations.getOperationMethod(
mtFactory.getAvailableMethods(SingleOperation.class), classification);
}
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
index 9fd4a31..3df352b 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
@@ -36,8 +36,8 @@ import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.geometry.MismatchedDimensionException;
import org.apache.sis.referencing.operation.DefaultConversion;
import org.apache.sis.internal.jaxb.referencing.CC_Conversion;
+import org.apache.sis.internal.referencing.ReferencingFactoryContainer;
import org.apache.sis.internal.metadata.MetadataUtilities;
-import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Semaphores;
import org.apache.sis.util.resources.Errors;
@@ -160,7 +160,7 @@ abstract class AbstractDerivedCRS<C extends Conversion> extends AbstractCRS impl
private C createConversionFromBase(final Map<String,?> properties, final SingleCRS baseCRS, final Conversion conversion) {
MathTransformFactory factory = null;
if (properties != null) {
- factory = (MathTransformFactory) properties.get(ReferencingServices.MT_FACTORY);
+ factory = (MathTransformFactory) properties.get(ReferencingFactoryContainer.MT_FACTORY);
}
if (factory == null) {
factory = DefaultFactories.forBuildin(MathTransformFactory.class);
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
index d36fc2c..6226814 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
@@ -38,7 +38,7 @@ import org.apache.sis.metadata.iso.extent.Extents;
import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.metadata.NameToIdentifier;
import org.apache.sis.internal.metadata.MetadataUtilities;
-import org.apache.sis.internal.metadata.ReferencingServices;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.ExtentSelector;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.internal.system.Loggers;
@@ -147,7 +147,7 @@ public class DefaultGeodeticDatum extends AbstractDatum implements GeodeticDatum
* The <code>{@value #BURSA_WOLF_KEY}</code> property for
* {@linkplain #getBursaWolfParameters() Bursa-Wolf parameters}.
*/
- public static final String BURSA_WOLF_KEY = ReferencingServices.BURSA_WOLF_KEY;
+ public static final String BURSA_WOLF_KEY = CoordinateOperations.BURSA_WOLF_KEY;
/**
* The array to be returned by {@link #getBursaWolfParameters()} when there is no Bursa-Wolf parameters.
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
index d776df6..d32a37a 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
@@ -50,7 +50,7 @@ import org.apache.sis.referencing.NamedIdentifier;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.AbstractReferenceSystem;
import org.apache.sis.referencing.AbstractIdentifiedObject;
-import org.apache.sis.internal.metadata.ReferencingServices;
+import org.apache.sis.internal.referencing.ReferencingFactoryContainer;
import org.apache.sis.internal.referencing.MergedProperties;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Loggers;
@@ -284,7 +284,7 @@ public class GeodeticObjectFactory extends AbstractFactory implements CRSFactory
*/
@Override
protected Object invisibleEntry(final Object key) {
- if (ReferencingServices.MT_FACTORY.equals(key)) {
+ if (ReferencingFactoryContainer.MT_FACTORY.equals(key)) {
return getMathTransformFactory();
} else {
return super.invisibleEntry(key);
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
index e5f34e4..05dde98 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
@@ -67,10 +67,11 @@ import org.opengis.referencing.operation.*;
import org.opengis.referencing.IdentifiedObject;
import org.opengis.referencing.NoSuchAuthorityCodeException;
-import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.metadata.TransformationAccuracy;
import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.metadata.sql.SQLUtilities;
+import org.apache.sis.internal.referencing.CoordinateOperations;
+import org.apache.sis.internal.referencing.ReferencingFactoryContainer;
import org.apache.sis.internal.referencing.DeferredCoordinateOperation;
import org.apache.sis.internal.referencing.DeprecatedCode;
import org.apache.sis.internal.referencing.EPSGParameterDomain;
@@ -1167,7 +1168,7 @@ codes: for (int i=0; i<codes.length; i++) {
}
properties.put(IdentifiedObject.REMARKS_KEY, remarks);
properties.put(AbstractIdentifiedObject.LOCALE_KEY, locale);
- properties.put(ReferencingServices.MT_FACTORY, owner.mtFactory);
+ properties.put(ReferencingFactoryContainer.MT_FACTORY, owner.mtFactory);
return properties;
}
@@ -2970,8 +2971,8 @@ next: while (r.next()) {
opType = s.asSubclass(SingleOperation.class);
}
}
- opProperties.put(ReferencingServices.OPERATION_TYPE_KEY, opType);
- opProperties.put(ReferencingServices.PARAMETERS_KEY, parameters);
+ opProperties.put(CoordinateOperations.OPERATION_TYPE_KEY, opType);
+ opProperties.put(CoordinateOperations.PARAMETERS_KEY, parameters);
/*
* Following restriction will be removed in a future SIS version if the method is added to GeoAPI.
*/
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
index 7dbac4a..69ac527 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
@@ -46,8 +46,8 @@ import org.apache.sis.internal.jaxb.referencing.CC_OperationParameterGroup;
import org.apache.sis.internal.jaxb.referencing.CC_OperationMethod;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.referencing.Resources;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.ReferencingUtilities;
-import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.util.Constants;
@@ -130,7 +130,7 @@ class AbstractSingleOperation extends AbstractCoordinateOperation implements Sin
* However there is a few cases, for example the Molodenski transform, where we can not infer the
* parameters easily because the operation is implemented by a concatenation of math transforms.
*/
- parameters = Parameters.unmodifiable(Containers.property(properties, ReferencingServices.PARAMETERS_KEY, ParameterValueGroup.class));
+ parameters = Parameters.unmodifiable(Containers.property(properties, CoordinateOperations.PARAMETERS_KEY, ParameterValueGroup.class));
}
/**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
index 7f3b92d..a11b64e 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
@@ -66,7 +66,6 @@ import org.apache.sis.internal.referencing.PositionalAccuracyConstant;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.referencing.provider.Affine;
import org.apache.sis.internal.referencing.Resources;
-import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.system.Semaphores;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.util.ArgumentChecks;
@@ -781,7 +780,7 @@ class CoordinateOperationRegistry {
} else {
type = Classes.getLeafInterfaces(operation.getClass(), CoordinateOperation.class)[0];
}
- properties.put(ReferencingServices.OPERATION_TYPE_KEY, type);
+ properties.put(CoordinateOperations.OPERATION_TYPE_KEY, type);
/*
* Reuse the same operation method, but we may need to change its number of dimension.
* The capability to resize an OperationMethod is specific to Apache SIS, so we must
@@ -790,7 +789,7 @@ class CoordinateOperationRegistry {
*/
if (operation instanceof SingleOperation) {
final SingleOperation single = (SingleOperation) operation;
- properties.put(ReferencingServices.PARAMETERS_KEY, single.getParameterValues());
+ properties.put(CoordinateOperations.PARAMETERS_KEY, single.getParameterValues());
if (method == null) {
final int sourceDimensions = transform.getSourceDimensions();
final int targetDimensions = transform.getTargetDimensions();
@@ -1157,9 +1156,9 @@ class CoordinateOperationRegistry {
}
}
if (parameters != null) {
- properties.put(ReferencingServices.PARAMETERS_KEY, parameters);
+ properties.put(CoordinateOperations.PARAMETERS_KEY, parameters);
}
- properties.put(ReferencingServices.OPERATION_TYPE_KEY, type);
+ properties.put(CoordinateOperations.OPERATION_TYPE_KEY, type);
if (Conversion.class.isAssignableFrom(type) && transform.isIdentity()) {
properties.replace(IdentifiedObject.NAME_KEY, AXIS_CHANGES, IDENTITY);
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
index eccf694..128a808 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
@@ -36,14 +36,15 @@ import org.opengis.referencing.crs.SingleCRS;
import org.opengis.referencing.crs.CRSFactory;
import org.opengis.referencing.cs.CSFactory;
import org.opengis.referencing.datum.Datum;
+import org.apache.sis.internal.referencing.LazySet;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.referencing.MergedProperties;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.SpecializedOperationFactory;
-import org.apache.sis.internal.metadata.ReferencingServices;
+import org.apache.sis.internal.referencing.ReferencingFactoryContainer;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.internal.util.Constants;
-import org.apache.sis.internal.referencing.LazySet;
import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.AbstractIdentifiedObject;
@@ -184,14 +185,14 @@ public class DefaultCoordinateOperationFactory extends AbstractFactory implement
* MathTransformFactory because math transforms are intimately related to coordinate operations.
*/
try {
- crsFactory = (CRSFactory) (value = properties.remove(key = ReferencingServices.CRS_FACTORY));
- csFactory = (CSFactory) (value = properties.remove(key = ReferencingServices.CS_FACTORY));
- mtFactory = (MathTransformFactory) (value = properties.remove(key = ReferencingServices.MT_FACTORY));
+ crsFactory = (CRSFactory) (value = properties.remove(key = ReferencingFactoryContainer.CRS_FACTORY));
+ csFactory = (CSFactory) (value = properties.remove(key = ReferencingFactoryContainer.CS_FACTORY));
+ mtFactory = (MathTransformFactory) (value = properties.remove(key = ReferencingFactoryContainer.MT_FACTORY));
} catch (ClassCastException e) {
throw new IllegalArgumentException(Errors.getResources(properties)
.getString(Errors.Keys.IllegalPropertyValueClass_2, key, Classes.getClass(value)));
}
- properties.remove(ReferencingServices.DATUM_FACTORY);
+ properties.remove(ReferencingFactoryContainer.DATUM_FACTORY);
properties = CollectionsExt.compact(properties);
}
defaultProperties = properties;
@@ -310,7 +311,7 @@ public class DefaultCoordinateOperationFactory extends AbstractFactory implement
if (mtFactory instanceof DefaultMathTransformFactory) {
return ((DefaultMathTransformFactory) mtFactory).getOperationMethod(name);
}
- final OperationMethod method = ReferencingServices.getInstance().getOperationMethod(
+ final OperationMethod method = CoordinateOperations.getOperationMethod(
mtFactory.getAvailableMethods(SingleOperation.class), name);
if (method != null) {
return method;
@@ -541,7 +542,7 @@ next: for (int i=components.size(); --i >= 0;) {
*/
if (transform == null) {
final ParameterValueGroup parameters = Containers.property(properties,
- ReferencingServices.PARAMETERS_KEY, ParameterValueGroup.class);
+ CoordinateOperations.PARAMETERS_KEY, ParameterValueGroup.class);
if (parameters == null) {
throw new NullArgumentException(Errors.format(Errors.Keys.NullArgument_1, "transform"));
}
@@ -556,7 +557,7 @@ next: for (int i=components.size(); --i >= 0;) {
* If we have both a 'baseType' and a Method.getOperationType(), take the most specific type.
* An exception will be thrown if the two types are incompatible.
*/
- Class<?> baseType = Containers.property(properties, ReferencingServices.OPERATION_TYPE_KEY, Class.class);
+ Class<?> baseType = Containers.property(properties, CoordinateOperations.OPERATION_TYPE_KEY, Class.class);
if (baseType == null) {
baseType = SingleOperation.class;
}
@@ -567,7 +568,7 @@ next: for (int i=components.size(); --i >= 0;) {
baseType = c;
} else if (!c.isAssignableFrom(baseType)) {
throw new IllegalArgumentException(Errors.format(Errors.Keys.IncompatiblePropertyValue_1,
- ReferencingServices.OPERATION_TYPE_KEY));
+ CoordinateOperations.OPERATION_TYPE_KEY));
}
}
}
@@ -720,9 +721,9 @@ next: for (int i=components.size(); --i >= 0;) {
if (single instanceof SingleOperation) {
final Map<String,Object> merge = new HashMap<>(
IdentifiedObjects.getProperties(single, CoordinateOperation.IDENTIFIERS_KEY));
- merge.put(ReferencingServices.PARAMETERS_KEY, ((SingleOperation) single).getParameterValues());
+ merge.put(CoordinateOperations.PARAMETERS_KEY, ((SingleOperation) single).getParameterValues());
if (single instanceof AbstractIdentifiedObject) {
- merge.put(ReferencingServices.OPERATION_TYPE_KEY, ((AbstractIdentifiedObject) single).getInterface());
+ merge.put(CoordinateOperations.OPERATION_TYPE_KEY, ((AbstractIdentifiedObject) single).getInterface());
}
merge.putAll(properties);
return createSingleOperation(merge, op.getSourceCRS(), op.getTargetCRS(),
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/InverseOperationMethod.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/InverseOperationMethod.java
index 2673162..c59806a 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/InverseOperationMethod.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/InverseOperationMethod.java
@@ -31,7 +31,7 @@ import org.opengis.parameter.GeneralParameterValue;
import org.opengis.parameter.GeneralParameterDescriptor;
import org.opengis.referencing.operation.OperationMethod;
import org.opengis.referencing.operation.SingleOperation;
-import org.apache.sis.internal.metadata.ReferencingServices;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.SignReversalComment;
import org.apache.sis.internal.referencing.provider.AbstractProvider;
import org.apache.sis.metadata.iso.ImmutableIdentifier;
@@ -188,6 +188,6 @@ final class InverseOperationMethod extends DefaultOperationMethod {
}
copy.values().add(gp);
}
- target.put(ReferencingServices.PARAMETERS_KEY, copy);
+ target.put(CoordinateOperations.PARAMETERS_KEY, copy);
}
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
index 81788f4..e236aeb 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
@@ -50,7 +50,7 @@ import org.apache.sis.referencing.operation.transform.ContextualParameters;
import org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory;
import org.apache.sis.referencing.operation.transform.MathTransformProvider;
import org.apache.sis.internal.referencing.provider.MapProjection;
-import org.apache.sis.internal.metadata.ReferencingServices;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.system.Loggers;
@@ -539,8 +539,7 @@ public abstract class NormalizedProjection extends AbstractMathTransform2D imple
if (factory instanceof DefaultMathTransformFactory) {
method = ((DefaultMathTransformFactory) factory).getOperationMethod(name);
} else {
- method = ReferencingServices.getInstance().getOperationMethod(
- factory.getAvailableMethods(SingleOperation.class), name);
+ method = CoordinateOperations.getOperationMethod(factory.getAvailableMethods(SingleOperation.class), name);
}
if (method instanceof MathTransformProvider) {
return ((MathTransformProvider) method).createMathTransform(factory, context);
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
index f5337df..f4755cc 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
@@ -56,7 +56,7 @@ import org.apache.sis.io.wkt.Parser;
import org.apache.sis.internal.referencing.LazySet;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.referencing.Formulas;
-import org.apache.sis.internal.metadata.ReferencingServices;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.referencing.j2d.ParameterizedAffine;
import org.apache.sis.internal.referencing.provider.AbstractProvider;
@@ -389,9 +389,8 @@ public class DefaultMathTransformFactory extends AbstractFactory implements Math
ArgumentChecks.ensureNonEmpty("identifier", identifier);
OperationMethod method = methodsByName.get(identifier);
if (method == null) {
- final ReferencingServices services = ReferencingServices.getInstance();
synchronized (methods) {
- method = services.getOperationMethod(methods, identifier);
+ method = CoordinateOperations.getOperationMethod(methods, identifier);
}
if (method == null) {
throw new NoSuchIdentifierException(Resources.format(Resources.Keys.NoSuchOperationMethod_1, identifier), identifier);
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
index 25fef9e..647c5ea 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
@@ -31,7 +31,7 @@ import org.opengis.referencing.operation.Matrix;
import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.Conversion;
import org.opengis.referencing.operation.OperationMethod;
-import org.apache.sis.internal.metadata.ReferencingServices;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.referencing.IdentifiedObjects;
@@ -159,7 +159,7 @@ public final strictfp class DefaultConversionTest extends TestCase {
*/
final Map<String, Object> properties = new HashMap<>(4);
properties.put(DefaultTransformation.NAME_KEY, "Paris to Greenwich");
- properties.put(ReferencingServices.PARAMETERS_KEY, pg);
+ properties.put(CoordinateOperations.PARAMETERS_KEY, pg);
return new DefaultConversion(properties, sourceCRS, targetCRS, interpolationCRS,
method, MathTransforms.linear(rotation));
}
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java
index 1878fe9..a65632c 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java
@@ -23,7 +23,7 @@ import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.datum.GeodeticDatum;
import org.opengis.referencing.operation.Matrix;
import org.opengis.referencing.operation.OperationMethod;
-import org.apache.sis.internal.metadata.ReferencingServices;
+import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.parameter.DefaultParameterDescriptorTest;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.cs.HardCodedCS;
@@ -95,7 +95,7 @@ public final strictfp class DefaultTransformationTest extends TestCase {
*/
final Map<String, Object> properties = new HashMap<>(4);
properties.put(DefaultTransformation.NAME_KEY, "Tokyo to JGD2000 (GSI)");
- properties.put(ReferencingServices.PARAMETERS_KEY, pg);
+ properties.put(CoordinateOperations.PARAMETERS_KEY, pg);
return new DefaultTransformation(properties,
createCRS(null, HardCodedDatum.TOKYO), // SourceCRS
createCRS("JGD2000", HardCodedDatum.JGD2000), // TargetCRS
diff --git a/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java b/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java
index a188743..50674f3 100644
--- a/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java
+++ b/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java
@@ -47,12 +47,12 @@ import org.apache.sis.internal.util.Constants;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.metadata.iso.citation.DefaultCitation;
import org.apache.sis.metadata.iso.ImmutableIdentifier;
+import org.apache.sis.internal.referencing.LazySet;
import org.apache.sis.internal.referencing.AxisDirections;
-import org.apache.sis.internal.metadata.ReferencingServices;
+import org.apache.sis.internal.referencing.ReferencingFactoryContainer;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.util.CollectionsExt;
-import org.apache.sis.internal.referencing.LazySet;
import org.apache.sis.util.iso.SimpleInternationalString;
import org.apache.sis.util.collection.WeakValueHashMap;
import org.apache.sis.util.resources.Vocabulary;
@@ -201,10 +201,10 @@ public class Proj4Factory extends GeodeticAuthorityFactory implements CRSAuthori
*/
public Proj4Factory(Map<String,?> properties) {
properties = new HashMap<>(properties != null ? properties : Collections.emptyMap());
- crsFactory = factory(CRSFactory.class, properties, ReferencingServices.CRS_FACTORY);
- csFactory = factory(CSFactory.class, properties, ReferencingServices.CS_FACTORY);
- datumFactory = factory(DatumFactory.class, properties, ReferencingServices.DATUM_FACTORY);
- mtFactory = factory(MathTransformFactory.class, properties, ReferencingServices.MT_FACTORY);
+ crsFactory = factory(CRSFactory.class, properties, ReferencingFactoryContainer.CRS_FACTORY);
+ csFactory = factory(CSFactory.class, properties, ReferencingFactoryContainer.CS_FACTORY);
+ datumFactory = factory(DatumFactory.class, properties, ReferencingFactoryContainer.DATUM_FACTORY);
+ mtFactory = factory(MathTransformFactory.class, properties, ReferencingFactoryContainer.MT_FACTORY);
defaultProperties = CollectionsExt.compact(properties);
}
@@ -233,9 +233,9 @@ public class Proj4Factory extends GeodeticAuthorityFactory implements CRSAuthori
DefaultCoordinateOperationFactory factory = opFactory;
if (factory == null) {
final Map<String,Object> properties = new HashMap<>(defaultProperties);
- properties.put(ReferencingServices.CRS_FACTORY, crsFactory);
- properties.put(ReferencingServices.CS_FACTORY, csFactory);
- properties.put(ReferencingServices.DATUM_FACTORY, datumFactory);
+ properties.put(ReferencingFactoryContainer.CRS_FACTORY, crsFactory);
+ properties.put(ReferencingFactoryContainer.CS_FACTORY, csFactory);
+ properties.put(ReferencingFactoryContainer.DATUM_FACTORY, datumFactory);
factory = new DefaultCoordinateOperationFactory(properties, mtFactory);
opFactory = factory;
}
[sis] 07/10: Move EllipsoidalHeightCombiner to sis-referencing
module. https://issues.apache.org/jira/browse/SIS-463
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit a3c2b520ce8e14f8aa22c6d40975ea331433937d
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jun 21 16:03:56 2019 +0200
Move EllipsoidalHeightCombiner to sis-referencing module.
https://issues.apache.org/jira/browse/SIS-463
---
.../sis/internal/metadata/ReferencingServices.java | 14 --------------
.../referencing}/EllipsoidalHeightCombiner.java | 17 ++++++++++-------
.../sis/internal/referencing/GeodeticObjectBuilder.java | 1 -
.../sis/internal/referencing/ServicesForMetadata.java | 16 ----------------
.../org/apache/sis/io/wkt/GeodeticObjectParser.java | 5 +++--
.../src/main/java/org/apache/sis/referencing/CRS.java | 2 +-
.../sis/referencing/EllipsoidalHeightSeparator.java | 4 ++--
.../sis/referencing/operation/CompoundCRSBuilder.java | 2 +-
.../EllipsoidalHeightCombinerTest.java | 5 ++---
.../org/apache/sis/test/suite/ReferencingTestSuite.java | 2 +-
10 files changed, 20 insertions(+), 48 deletions(-)
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
index ef7a0ed..fd83ea4 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
@@ -17,7 +17,6 @@
package org.apache.sis.internal.metadata;
import java.util.Map;
-import java.util.Collections;
import java.util.Locale;
import java.util.TimeZone;
import java.text.Format;
@@ -364,19 +363,6 @@ public class ReferencingServices extends OptionalDependency {
}
/**
- * Returns the properties of the given object.
- *
- * @param object the object from which to get the properties.
- * @param keepId {@code true} for preserving the identifiers, {@code false} for discarding them.
- * @return the properties of the given object.
- *
- * @since 0.6
- */
- public Map<String,?> getProperties(final IdentifiedObject object, final boolean keepId) {
- return Collections.singletonMap(IdentifiedObject.NAME_KEY, object.getName());
- }
-
- /**
* Returns {@code true} if the {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getName()
* primary name} or an aliases of the given object matches the given name. The comparison ignores case,
* some Latin diacritical signs and any characters that are not letters or digits.
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/EllipsoidalHeightCombiner.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombiner.java
similarity index 95%
rename from core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/EllipsoidalHeightCombiner.java
rename to core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombiner.java
index 75288ef..96cfdd7 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/EllipsoidalHeightCombiner.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombiner.java
@@ -14,10 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.internal.metadata;
+package org.apache.sis.internal.referencing;
import java.util.Map;
import java.util.HashMap;
+import org.opengis.util.FactoryException;
import org.opengis.metadata.extent.Extent;
import org.opengis.referencing.crs.CRSFactory;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -33,7 +34,8 @@ import org.opengis.referencing.cs.EllipsoidalCS;
import org.opengis.referencing.datum.VerticalDatum;
import org.opengis.referencing.operation.Conversion;
import org.opengis.referencing.operation.CoordinateOperationFactory;
-import org.opengis.util.FactoryException;
+import org.apache.sis.internal.metadata.VerticalDatumTypes;
+import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.metadata.iso.extent.Extents;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.ArraysExt;
@@ -158,9 +160,9 @@ public class EllipsoidalHeightCombiner {
axes[axisPosition++ ] = cs.getAxis(0);
axes[axisPosition++ ] = cs.getAxis(1);
axes[axisPosition %= 3] = vertical.getCoordinateSystem().getAxis(0);
- final ReferencingServices referencing = ReferencingServices.getInstance();
- final Map<String,?> csProps = referencing.getProperties(cs, false);
- final Map<String,?> crsProps = (components.length == 2) ? properties : referencing.getProperties(crs, false);
+ final Map<String,?> csProps = IdentifiedObjects.getProperties(cs, CoordinateSystem.IDENTIFIERS_KEY);
+ final Map<String,?> crsProps = (components.length == 2) ? properties
+ : IdentifiedObjects.getProperties(crs, CoordinateReferenceSystem.IDENTIFIERS_KEY);
if (crs instanceof GeodeticCRS) {
initialize(CS | CRS);
cs = csFactory.createEllipsoidalCS(csProps, axes[0], axes[1], axes[2]);
@@ -170,7 +172,8 @@ public class EllipsoidalHeightCombiner {
final ProjectedCRS proj = (ProjectedCRS) crs;
GeographicCRS base = proj.getBaseCRS();
if (base.getCoordinateSystem().getDimension() == 2) {
- base = (GeographicCRS) createCompoundCRS(referencing.getProperties(base, false), base, vertical);
+ base = (GeographicCRS) createCompoundCRS(
+ IdentifiedObjects.getProperties(base, GeographicCRS.IDENTIFIERS_KEY), base, vertical);
}
/*
* In Apache SIS implementation, the Conversion contains the source and target CRS together with
@@ -178,7 +181,7 @@ public class EllipsoidalHeightCombiner {
* for letting SIS create or associate new ones, which will be three-dimensional now.
*/
Conversion fromBase = proj.getConversionFromBase();
- fromBase = opFactory.createDefiningConversion(referencing.getProperties(fromBase, true),
+ fromBase = opFactory.createDefiningConversion(IdentifiedObjects.getProperties(fromBase),
fromBase.getMethod(), fromBase.getParameterValues());
cs = csFactory.createCartesianCS(csProps, axes[0], axes[1], axes[2]);
crs = crsFactory.createProjectedCRS(crsProps, base, fromBase, (CartesianCS) cs);
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
index 09ce3dd..74c24cd 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
@@ -46,7 +46,6 @@ import org.opengis.referencing.operation.Conversion;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.util.CollectionsExt;
-import org.apache.sis.internal.metadata.EllipsoidalHeightCombiner;
import org.apache.sis.internal.referencing.provider.TransverseMercator;
import org.apache.sis.internal.referencing.provider.PolarStereographicA;
import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
index 4fcbb9e..4c5225e 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
@@ -75,7 +75,6 @@ import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.TemporalUtilities;
-import org.apache.sis.util.CharSequences;
import org.apache.sis.util.collection.Containers;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.resources.Errors;
@@ -552,21 +551,6 @@ public final class ServicesForMetadata extends ReferencingServices {
}
/**
- * Returns the properties of the given object.
- *
- * @param object the object from which to get the properties.
- * @param keepId {@code true} for preserving the identifiers, {@code false} for discarding them.
- * @return the properties of the given object.
- *
- * @since 0.6
- */
- @Override
- public Map<String,?> getProperties(final IdentifiedObject object, final boolean keepId) {
- return IdentifiedObjects.getProperties(object, keepId ? CharSequences.EMPTY_ARRAY
- : new String[] {IdentifiedObject.IDENTIFIERS_KEY});
- }
-
- /**
* Returns {@code true} if the {@linkplain AbstractIdentifiedObject#getName() primary name} or an aliases
* of the given object matches the given name.
*
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
index d63628c..3ec0373 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
@@ -58,6 +58,7 @@ import org.opengis.referencing.operation.*;
import org.apache.sis.measure.Units;
import org.apache.sis.measure.UnitFormat;
import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.cs.AbstractCS;
import org.apache.sis.referencing.cs.CoordinateSystems;
import org.apache.sis.referencing.crs.DefaultDerivedCRS;
@@ -77,7 +78,7 @@ import org.apache.sis.internal.metadata.AxisNames;
import org.apache.sis.internal.metadata.VerticalDatumTypes;
import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.metadata.TransformationAccuracy;
-import org.apache.sis.internal.metadata.EllipsoidalHeightCombiner;
+import org.apache.sis.internal.referencing.EllipsoidalHeightCombiner;
import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.util.Constants;
@@ -1947,7 +1948,7 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
if (VerticalDatumType.OTHER_SURFACE.equals(datum.getVerticalDatumType())) {
final VerticalDatumType type = VerticalDatumTypes.guess(datum.getName().getCode(), datum.getAlias(), cs.getAxis(0));
if (!VerticalDatumType.OTHER_SURFACE.equals(type)) {
- datum = datumFactory.createVerticalDatum(referencing.getProperties(datum, true), type);
+ datum = datumFactory.createVerticalDatum(IdentifiedObjects.getProperties(datum), type);
}
}
verticalCRS = crsFactory.createVerticalCRS(properties, datum, (VerticalCS) cs);
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
index efa9c0e..d0bbfd0 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
@@ -59,7 +59,7 @@ import org.apache.sis.measure.Units;
import org.apache.sis.geometry.Envelopes;
import org.apache.sis.geometry.GeneralEnvelope;
import org.apache.sis.internal.metadata.AxisDirections;
-import org.apache.sis.internal.metadata.EllipsoidalHeightCombiner;
+import org.apache.sis.internal.referencing.EllipsoidalHeightCombiner;
import org.apache.sis.internal.referencing.PositionalAccuracyConstant;
import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.ReferencingUtilities;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/EllipsoidalHeightSeparator.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/EllipsoidalHeightSeparator.java
index c2d4ded..668a0b9 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/EllipsoidalHeightSeparator.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/EllipsoidalHeightSeparator.java
@@ -41,12 +41,12 @@ import org.apache.sis.util.Utilities;
/**
* Helper class for separating the ellipsoidal height from the horizontal part of a CRS.
- * This is the converse of {@link org.apache.sis.internal.metadata.EllipsoidalHeightCombiner}.
+ * This is the converse of {@link org.apache.sis.internal.referencing.EllipsoidalHeightCombiner}.
*
* @author Martin Desruisseaux (Geomatys)
* @version 1.0
*
- * @see org.apache.sis.internal.metadata.EllipsoidalHeightCombiner
+ * @see org.apache.sis.internal.referencing.EllipsoidalHeightCombiner
*
* @since 1.0
* @module
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CompoundCRSBuilder.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CompoundCRSBuilder.java
index 12dea31..d9b2062 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CompoundCRSBuilder.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CompoundCRSBuilder.java
@@ -16,7 +16,7 @@
*/
package org.apache.sis.referencing.operation;
-import org.apache.sis.internal.metadata.EllipsoidalHeightCombiner;
+import org.apache.sis.internal.referencing.EllipsoidalHeightCombiner;
import org.opengis.referencing.operation.CoordinateOperationFactory;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/EllipsoidalHeightCombinerTest.java b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombinerTest.java
similarity index 97%
rename from core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/EllipsoidalHeightCombinerTest.java
rename to core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombinerTest.java
index 9cc0196..2666dec 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/EllipsoidalHeightCombinerTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/EllipsoidalHeightCombinerTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.internal.metadata;
+package org.apache.sis.internal.referencing;
import java.util.Map;
import java.util.Collections;
@@ -42,8 +42,7 @@ import static org.apache.sis.test.Assert.*;
/**
- * Tests {@link EllipsoidalHeightCombiner}. This class is defined in {@code sis-metadata} module
- * but tested here because the tests use CRS instances defined in {@code sis-referencing}.
+ * Tests {@link EllipsoidalHeightCombiner}.
*
* @author Martin Desruisseaux (Geomatys)
* @version 0.8
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java b/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
index 451c73b..46cc1a8 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
@@ -272,7 +272,7 @@ import org.junit.BeforeClass;
org.apache.sis.geometry.EnvelopesTest.class,
org.apache.sis.geometry.EnvelopeReducerTest.class,
org.apache.sis.internal.referencing.ServicesForMetadataTest.class,
- org.apache.sis.internal.metadata.EllipsoidalHeightCombinerTest.class,
+ org.apache.sis.internal.referencing.EllipsoidalHeightCombinerTest.class,
org.apache.sis.geometry.CoordinateFormatTest.class,
org.apache.sis.distance.LatLonPointRadiusTest.class, // Pending refactoring in a geometry package.
[sis] 04/10: SIS-463 cleanup: move the WKTKeywords class to sis-referencing and add support for Position and Envelope in WKTFormat.format(…).
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 4f553de26353609448b434d362578c2ecfe8ff01
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jun 21 12:30:24 2019 +0200
SIS-463 cleanup: move the WKTKeywords class to sis-referencing and add support for Position and Envelope in WKTFormat.format(…).
---
.../test/java/org/apache/sis/test/suite/MetadataTestSuite.java | 1 -
.../java/org/apache/sis/geometry/AbstractDirectPosition.java | 2 +-
.../java/org/apache/sis/internal/referencing}/WKTKeywords.java | 2 +-
.../java/org/apache/sis/internal/referencing/WKTUtilities.java | 1 -
.../sis/internal/referencing/provider/GeocentricAffine.java | 2 +-
.../sis/internal/referencing/provider/Geographic3Dto2D.java | 2 +-
.../src/main/java/org/apache/sis/io/wkt/Element.java | 2 +-
.../src/main/java/org/apache/sis/io/wkt/Formatter.java | 10 +++++++++-
.../main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java | 2 +-
.../main/java/org/apache/sis/io/wkt/MathTransformParser.java | 2 +-
.../src/main/java/org/apache/sis/io/wkt/Transliterator.java | 2 +-
.../src/main/java/org/apache/sis/io/wkt/WKTFormat.java | 4 +++-
.../java/org/apache/sis/metadata/iso/ImmutableIdentifier.java | 2 +-
.../org/apache/sis/parameter/AbstractParameterDescriptor.java | 2 +-
.../java/org/apache/sis/parameter/DefaultParameterValue.java | 2 +-
.../src/main/java/org/apache/sis/parameter/TensorValues.java | 2 +-
.../org/apache/sis/referencing/crs/DefaultCompoundCRS.java | 2 +-
.../java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java | 2 +-
.../org/apache/sis/referencing/crs/DefaultEngineeringCRS.java | 2 +-
.../org/apache/sis/referencing/crs/DefaultGeodeticCRS.java | 2 +-
.../java/org/apache/sis/referencing/crs/DefaultImageCRS.java | 2 +-
.../org/apache/sis/referencing/crs/DefaultParametricCRS.java | 2 +-
.../org/apache/sis/referencing/crs/DefaultProjectedCRS.java | 2 +-
.../org/apache/sis/referencing/crs/DefaultTemporalCRS.java | 2 +-
.../org/apache/sis/referencing/crs/DefaultVerticalCRS.java | 2 +-
.../main/java/org/apache/sis/referencing/cs/AbstractCS.java | 2 +-
.../apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java | 2 +-
.../org/apache/sis/referencing/cs/DirectionAlongMeridian.java | 2 +-
.../org/apache/sis/referencing/datum/BursaWolfParameters.java | 2 +-
.../org/apache/sis/referencing/datum/DefaultEllipsoid.java | 2 +-
.../apache/sis/referencing/datum/DefaultEngineeringDatum.java | 2 +-
.../org/apache/sis/referencing/datum/DefaultGeodeticDatum.java | 2 +-
.../org/apache/sis/referencing/datum/DefaultImageDatum.java | 2 +-
.../apache/sis/referencing/datum/DefaultParametricDatum.java | 2 +-
.../org/apache/sis/referencing/datum/DefaultPrimeMeridian.java | 2 +-
.../org/apache/sis/referencing/datum/DefaultTemporalDatum.java | 2 +-
.../org/apache/sis/referencing/datum/DefaultVerticalDatum.java | 2 +-
.../org/apache/sis/referencing/factory/sql/EPSGDataAccess.java | 2 +-
.../java/org/apache/sis/referencing/factory/sql/TableInfo.java | 2 +-
.../sis/referencing/operation/AbstractCoordinateOperation.java | 2 +-
.../org/apache/sis/referencing/operation/DefaultFormula.java | 2 +-
.../sis/referencing/operation/DefaultOperationMethod.java | 2 +-
.../referencing/operation/transform/AbstractMathTransform.java | 2 +-
.../referencing/operation/transform/ConcatenatedTransform.java | 2 +-
.../referencing/operation/transform/ContextualParameters.java | 2 +-
.../referencing/operation/transform/PassThroughTransform.java | 2 +-
.../org/apache/sis/internal/referencing}/WKTKeywordsTest.java | 2 +-
.../org/apache/sis/internal/referencing/WKTUtilitiesTest.java | 1 -
.../org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java | 2 +-
.../java/org/apache/sis/test/suite/ReferencingTestSuite.java | 1 +
.../main/java/org/apache/sis/storage/geotiff/CRSBuilder.java | 2 +-
.../org/apache/sis/internal/storage/wkt/StoreProvider.java | 2 +-
52 files changed, 59 insertions(+), 51 deletions(-)
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java b/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
index 014361a..3d8278e 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
@@ -31,7 +31,6 @@ import org.junit.BeforeClass;
*/
@Suite.SuiteClasses({
org.apache.sis.internal.metadata.AxisNamesTest.class,
- org.apache.sis.internal.metadata.WKTKeywordsTest.class,
org.apache.sis.internal.metadata.NameMeaningTest.class,
org.apache.sis.internal.metadata.MetadataUtilitiesTest.class,
org.apache.sis.internal.metadata.VerticalDatumTypesTest.class,
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
index 2a3b779..da831a5 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
@@ -35,7 +35,7 @@ import org.apache.sis.util.Utilities;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.util.Numerics;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTKeywords.java
similarity index 99%
rename from core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java
rename to core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTKeywords.java
index 67c8e4e..1b4dee2 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTKeywords.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.internal.metadata;
+package org.apache.sis.internal.referencing;
import org.apache.sis.util.Static;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java
index 2ff80be..4b149b0 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java
@@ -48,7 +48,6 @@ import org.apache.sis.referencing.operation.transform.MathTransforms;
import org.apache.sis.internal.referencing.provider.Affine;
import org.apache.sis.parameter.DefaultParameterValue;
import org.apache.sis.parameter.Parameterized;
-import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.io.wkt.ElementKind;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
index 3d131f3..c984401 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
@@ -30,7 +30,7 @@ import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransformFactory;
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.referencing.WKTUtilities;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java
index f1d7b71..880641f 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java
@@ -29,7 +29,7 @@ import org.apache.sis.referencing.operation.transform.MathTransforms;
import org.apache.sis.parameter.Parameterized;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.io.wkt.FormattableObject;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.WKTUtilities;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Element.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Element.java
index e00c386..cf8b747 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Element.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Element.java
@@ -32,7 +32,7 @@ import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.Exceptions;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.resources.Errors;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.internal.util.UnmodifiableArrayList;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
index f93d23e..4a1eb13 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
@@ -54,6 +54,8 @@ import org.opengis.referencing.operation.OperationMethod;
import org.opengis.referencing.operation.CoordinateOperation;
import org.opengis.referencing.operation.ConcatenatedOperation;
import org.opengis.referencing.operation.MathTransform;
+import org.opengis.geometry.coordinate.Position;
+import org.opengis.geometry.Envelope;
import org.apache.sis.measure.Units;
import org.apache.sis.math.DecimalFunctions;
@@ -74,10 +76,12 @@ import org.apache.sis.internal.util.Citations;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.StandardDateFormat;
import org.apache.sis.internal.simple.SimpleExtent;
-import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.internal.metadata.Resources;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.referencing.AbstractIdentifiedObject;
+import org.apache.sis.geometry.AbstractDirectPosition;
+import org.apache.sis.geometry.AbstractEnvelope;
import org.apache.sis.measure.UnitFormat;
import org.apache.sis.measure.Range;
import org.apache.sis.measure.MeasurementRange;
@@ -1560,6 +1564,10 @@ public class Formatter implements Localized {
appendVerticalExtent(Extents.getVerticalRange(new SimpleExtent(null, (VerticalExtent) value, null)));
} else if (value instanceof TemporalExtent) {
appendTemporalExtent(Extents.getTimeRange(new SimpleExtent(null, null, (TemporalExtent) value)));
+ } else if (value instanceof Position) {
+ append(AbstractDirectPosition.castOrCopy(((Position) value).getDirectPosition()));
+ } else if (value instanceof Envelope) {
+ append(AbstractEnvelope.castOrCopy((Envelope) value)); // Non-standard
} else {
return false;
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
index eb20f81..d561fe1 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
@@ -74,11 +74,11 @@ import org.apache.sis.metadata.iso.extent.DefaultVerticalExtent;
import org.apache.sis.metadata.iso.extent.DefaultTemporalExtent;
import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.metadata.AxisNames;
-import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.internal.metadata.VerticalDatumTypes;
import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.metadata.TransformationAccuracy;
import org.apache.sis.internal.metadata.EllipsoidalHeightCombiner;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.internal.util.Strings;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
index da81f4d..ba4defc 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
@@ -38,7 +38,7 @@ import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.NoninvertibleTransformException;
import org.opengis.referencing.operation.OperationMethod;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.math.DecimalFunctions;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Transliterator.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Transliterator.java
index d5f1ad9..85bcb2c 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Transliterator.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Transliterator.java
@@ -27,7 +27,7 @@ import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.cs.AxisDirection;
import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.metadata.AxisNames;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Characters;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/WKTFormat.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
index 1e5f8f4..49c9b59 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
@@ -804,7 +804,9 @@ public class WKTFormat extends CompoundFormat<Object> {
* {@link org.opengis.referencing.operation.MathTransform},
* {@link org.opengis.metadata.extent.GeographicBoundingBox},
* {@link org.opengis.metadata.extent.VerticalExtent},
- * {@link org.opengis.metadata.extent.TemporalExtent}
+ * {@link org.opengis.metadata.extent.TemporalExtent},
+ * {@link org.opengis.geometry.Envelope},
+ * {@link org.opengis.geometry.coordinate.Position}
* and {@link Unit}.
*
* @param object the object to format.
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java b/core/sis-referencing/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
index 5ad09d5..1044954 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
@@ -29,7 +29,7 @@ import org.apache.sis.util.iso.Types;
import org.apache.sis.metadata.TitleProperty;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.internal.metadata.NameMeaning;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.io.wkt.Convention;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java b/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java
index e9cef0e..5801217 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/AbstractParameterDescriptor.java
@@ -27,7 +27,7 @@ import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.opengis.parameter.GeneralParameterDescriptor;
import org.apache.sis.referencing.AbstractIdentifiedObject;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.util.resources.Errors;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java b/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
index 1fe269f..94f7287 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
@@ -45,7 +45,7 @@ import org.apache.sis.internal.jaxb.gml.MeasureList;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.metadata.MetadataUtilities;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.math.DecimalFunctions;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java b/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java
index dfb455d..27b3d22 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java
@@ -35,7 +35,7 @@ import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.operation.matrix.Matrices;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.referencing.WKTUtilities;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.internal.util.UnmodifiableArrayList;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
index 0714ec2..6dac6b1 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
@@ -42,7 +42,7 @@ import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.cs.DefaultCompoundCS;
import org.apache.sis.referencing.AbstractReferenceSystem;
import org.apache.sis.referencing.IdentifiedObjects;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.referencing.ReferencingUtilities;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
index 32c6bcf..e10a321 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
@@ -53,7 +53,7 @@ import org.apache.sis.internal.jaxb.referencing.SC_DerivedCRSType;
import org.apache.sis.internal.jaxb.referencing.CS_CoordinateSystem;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.referencing.WKTUtilities;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.io.wkt.Convention;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
index 6451138..54ea601 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
@@ -27,7 +27,7 @@ import org.opengis.referencing.datum.EngineeringDatum;
import org.apache.sis.referencing.cs.*;
import org.apache.sis.referencing.AbstractReferenceSystem;
import org.apache.sis.internal.metadata.MetadataUtilities;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.io.wkt.Formatter;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
index db9fcda..5aa247a 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
@@ -34,7 +34,7 @@ import org.opengis.referencing.datum.PrimeMeridian;
import org.apache.sis.internal.referencing.Legacy;
import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.metadata.MetadataUtilities;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.referencing.AbstractReferenceSystem;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
index 62ec3ce..e0e51d0 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
@@ -25,7 +25,7 @@ import org.opengis.referencing.cs.AffineCS;
import org.opengis.referencing.crs.ImageCRS;
import org.opengis.referencing.cs.CartesianCS;
import org.opengis.referencing.datum.ImageDatum;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.AbstractReferenceSystem;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultParametricCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultParametricCRS.java
index dd899b1..55fbcdb 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultParametricCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultParametricCRS.java
@@ -22,7 +22,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.opengis.referencing.cs.CoordinateSystem;
import org.apache.sis.internal.metadata.MetadataUtilities;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
index f180068..a8a717d 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
@@ -40,7 +40,7 @@ import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.operation.DefaultOperationMethod;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.metadata.AxisDirections;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.system.Loggers;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
index 03072d9..02f2a5f 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
@@ -34,7 +34,7 @@ import org.opengis.referencing.datum.TemporalDatum;
import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.AbstractReferenceSystem;
import org.apache.sis.internal.metadata.MetadataUtilities;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.measure.Units;
import org.apache.sis.math.Fraction;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
index 3393976..dc198f2 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
@@ -26,7 +26,7 @@ import org.opengis.referencing.crs.VerticalCRS;
import org.opengis.referencing.datum.VerticalDatum;
import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.AbstractReferenceSystem;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
index 20ab633..a612991 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
@@ -40,7 +40,7 @@ import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.CRS;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.metadata.AxisDirections;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.util.Constants;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
index fed9355..b3145ae7 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
@@ -38,7 +38,7 @@ import org.opengis.referencing.cs.CoordinateSystem;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.apache.sis.internal.metadata.AxisNames;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.referencing.AbstractIdentifiedObject;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
index b4889c6..313cee0 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
@@ -24,7 +24,7 @@ import org.apache.sis.measure.Units;
import org.apache.sis.measure.Longitude;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.internal.metadata.AxisDirections;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
index 42b8719..e8328a0 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
@@ -32,7 +32,7 @@ import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.util.Utilities;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.util.DoubleDouble;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.Resources;
import static java.lang.Math.abs;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
index 0a363f6..31f07f4 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
@@ -37,7 +37,7 @@ import org.apache.sis.internal.jaxb.referencing.SecondDefiningParameter;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.referencing.Resources;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.AbstractIdentifiedObject;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
index 5fbfc43..b49da4b 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
@@ -23,7 +23,7 @@ import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
import org.opengis.metadata.Identifier;
import org.opengis.referencing.datum.EngineeringDatum;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
index de4b679..d36fc2c 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
@@ -35,7 +35,7 @@ import org.opengis.referencing.operation.Matrix;
import org.apache.sis.referencing.operation.matrix.Matrices;
import org.apache.sis.referencing.operation.matrix.NoninvertibleMatrixException;
import org.apache.sis.metadata.iso.extent.Extents;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.metadata.NameToIdentifier;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.internal.metadata.ReferencingServices;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
index 5f9a823..b4209ce 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
@@ -26,7 +26,7 @@ import org.opengis.util.InternationalString;
import org.opengis.metadata.Identifier;
import org.opengis.referencing.datum.ImageDatum;
import org.opengis.referencing.datum.PixelInCell;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.io.wkt.Convention;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultParametricDatum.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultParametricDatum.java
index 6bb489f..7a38be0 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultParametricDatum.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultParametricDatum.java
@@ -20,7 +20,7 @@ import java.util.Date;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.io.wkt.Formatter;
// Branch-dependent imports
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
index 1e4c322..86c03b2 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
@@ -33,7 +33,7 @@ import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.metadata.MetadataUtilities;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.jaxb.gml.Measure;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
index 1558c2d..9b0690b 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
@@ -28,7 +28,7 @@ import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
import org.opengis.metadata.Identifier;
import org.opengis.referencing.datum.TemporalDatum;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.jaxb.gml.UniversalTimeAdapter;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.util.ComparisonMode;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
index 1b10704..3e58316 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
@@ -30,7 +30,7 @@ import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.xml.LegacyNamespaces;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.metadata.VerticalDatumTypes;
import org.apache.sis.internal.metadata.MetadataUtilities;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
index f895aff..51b74f5 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
@@ -69,7 +69,7 @@ import org.opengis.referencing.NoSuchAuthorityCodeException;
import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.metadata.TransformationAccuracy;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.metadata.sql.SQLUtilities;
import org.apache.sis.internal.referencing.DeferredCoordinateOperation;
import org.apache.sis.internal.referencing.DeprecatedCode;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/TableInfo.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/TableInfo.java
index 62fc01d..daa232b 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/TableInfo.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/TableInfo.java
@@ -22,7 +22,7 @@ import org.opengis.referencing.crs.*;
import org.opengis.referencing.datum.*;
import org.opengis.referencing.operation.*;
import org.opengis.parameter.ParameterDescriptor;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.util.CharSequences;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
index 691f8ca..e18254f 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
@@ -63,7 +63,7 @@ import org.apache.sis.internal.referencing.CoordinateOperations;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.referencing.WKTUtilities;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.CollectionsExt;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java
index 17e6409..c1b2b0d 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java
@@ -21,7 +21,7 @@ import java.io.Serializable;
import org.opengis.util.InternationalString;
import org.opengis.metadata.citation.Citation;
import org.opengis.referencing.operation.Formula;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.io.wkt.ElementKind;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
index b45d53a..d4cf24c 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
@@ -45,7 +45,7 @@ import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.iso.SimpleInternationalString;
import org.apache.sis.internal.util.Citations;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.jaxb.gco.StringAdapter;
import org.apache.sis.internal.jaxb.referencing.CC_OperationMethod;
import org.apache.sis.internal.referencing.NilReferencingObject;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
index 7099c5e..2f6ec40 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
@@ -36,7 +36,7 @@ import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.referencing.WKTUtilities;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.util.Utilities;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.LenientComparable;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java
index d68f159..2952d61 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java
@@ -34,7 +34,7 @@ import org.opengis.referencing.operation.NoninvertibleTransformException;
import org.apache.sis.parameter.Parameterized;
import org.apache.sis.referencing.operation.matrix.Matrices;
import org.apache.sis.internal.referencing.provider.GeocentricAffine;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.system.Semaphores;
import org.apache.sis.util.Classes;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
index b417614..83da5d7 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
@@ -37,9 +37,9 @@ import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransformFactory;
import org.apache.sis.internal.referencing.ExtendedPrecisionMatrix;
import org.apache.sis.internal.referencing.WKTUtilities;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.referencing.Formulas;
-import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.internal.util.DoubleDouble;
import org.apache.sis.internal.util.UnmodifiableArrayList;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
index c123458..3a47636 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
@@ -29,7 +29,7 @@ import org.opengis.referencing.operation.NoninvertibleTransformException;
import org.apache.sis.referencing.operation.matrix.Matrices;
import org.apache.sis.referencing.operation.matrix.MatrixSIS;
import org.apache.sis.internal.referencing.DirectPositionView;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.geometry.GeneralDirectPosition;
import org.apache.sis.io.wkt.Formatter;
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/WKTKeywordsTest.java b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTKeywordsTest.java
similarity index 98%
rename from core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/WKTKeywordsTest.java
rename to core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTKeywordsTest.java
index 31a9420..e6f296a 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/WKTKeywordsTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTKeywordsTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.internal.metadata;
+package org.apache.sis.internal.referencing;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTUtilitiesTest.java b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTUtilitiesTest.java
index 4e913cb..7108002 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTUtilitiesTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTUtilitiesTest.java
@@ -19,7 +19,6 @@ package org.apache.sis.internal.referencing;
import java.util.function.Function;
import org.opengis.referencing.cs.*;
import org.apache.sis.referencing.crs.HardCodedCRS;
-import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.apache.sis.math.Vector;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java
index 9ae2d01..08209b5 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java
@@ -25,7 +25,7 @@ import org.opengis.referencing.operation.Conversion;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.test.Validators;
import org.apache.sis.io.wkt.Convention;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.referencing.operation.matrix.Matrix3;
import org.apache.sis.referencing.operation.DefaultConversion;
import org.apache.sis.referencing.operation.DefaultConversionTest;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java b/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
index aa46588..451c73b 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
@@ -37,6 +37,7 @@ import org.junit.BeforeClass;
org.apache.sis.internal.referencing.PositionalAccuracyConstantTest.class,
org.apache.sis.internal.referencing.ReferencingUtilitiesTest.class,
org.apache.sis.internal.referencing.WraparoundAdjustmentTest.class,
+ org.apache.sis.internal.referencing.WKTKeywordsTest.class,
org.apache.sis.internal.referencing.WKTUtilitiesTest.class,
org.apache.sis.internal.jaxb.referencing.CodeTest.class,
org.apache.sis.internal.jaxb.referencing.SecondDefiningParameterTest.class,
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
index d282ca5..450ab55 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
@@ -58,7 +58,7 @@ import org.opengis.referencing.NoSuchAuthorityCodeException;
import org.opengis.util.FactoryException;
import org.apache.sis.internal.geotiff.Resources;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.referencing.NilReferencingObject;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.internal.referencing.ReferencingFactoryContainer;
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
index a03abe5..35c236e 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
@@ -26,7 +26,7 @@ import org.apache.sis.storage.ProbeResult;
import org.apache.sis.internal.storage.Capability;
import org.apache.sis.internal.storage.StoreMetadata;
import org.apache.sis.internal.storage.URIDataStore;
-import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.util.Version;
[sis] 05/10: Retrofit internal Citations class into public
Citations class.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 6ab6bbd0178ef7b13e4450a68d961c91218e4f4e
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jun 21 15:28:24 2019 +0200
Retrofit internal Citations class into public Citations class.
---
.../org/apache/sis/gui/dataset/ResourceTree.java | 4 +-
.../apache/sis/internal/metadata/Identifiers.java | 269 +++++++++++
.../sis/internal/metadata/ServicesForUtility.java | 13 +
.../internal/simple/SimpleIdentifiedObject.java | 8 +-
.../sis/internal/simple/SimpleIdentifier.java | 5 +-
.../sis/metadata/iso/citation/Citations.java | 224 ++++++++-
.../iso/identification/DefaultCoupledResource.java | 6 +-
.../apache/sis/metadata/sql/MetadataWriter.java | 4 +-
.../org/apache/sis/util/iso/DefaultNameSpace.java | 3 +-
.../sis/internal/metadata/IdentifiersTest.java | 106 ++++
.../sis/metadata/iso/citation/CitationsTest.java | 23 +-
.../apache/sis/test/suite/MetadataTestSuite.java | 1 +
.../apache/sis/internal/jaxb/referencing/Code.java | 3 +-
.../internal/referencing/DefinitionVerifier.java | 4 +-
.../internal/referencing/ReferencingUtilities.java | 14 -
.../internal/referencing/ServicesForMetadata.java | 3 +-
.../main/java/org/apache/sis/io/wkt/Formatter.java | 2 +-
.../apache/sis/io/wkt/GeodeticObjectParser.java | 4 +-
.../sis/metadata/iso/ImmutableIdentifier.java | 6 +-
.../apache/sis/parameter/ParameterTableRow.java | 2 +-
.../sis/referencing/EPSGFactoryFallback.java | 3 +-
.../apache/sis/referencing/IdentifiedObjects.java | 29 +-
.../sis/referencing/datum/AbstractDatum.java | 3 +-
.../factory/AuthorityFactoryIdentifier.java | 6 +-
.../factory/CommonAuthorityFactory.java | 5 +-
.../factory/GeodeticAuthorityFactory.java | 14 +-
.../factory/IdentifiedObjectFinder.java | 4 +-
.../factory/MultiAuthoritiesFactory.java | 12 +-
.../referencing/factory/sql/EPSGDataAccess.java | 5 +-
.../operation/DefaultOperationMethod.java | 4 +-
.../org/apache/sis/test/ReferencingAssert.java | 5 +-
.../org/apache/sis/internal/util/Citations.java | 536 ---------------------
.../apache/sis/internal/util/CollectionsExt.java | 22 +
.../org/apache/sis/internal/util/Constants.java | 8 +
.../apache/sis/internal/util/MetadataServices.java | 12 +
.../org/apache/sis/io/IdentifiedObjectFormat.java | 7 +-
.../java/org/apache/sis/measure/UnitFormat.java | 3 +-
.../org/apache/sis/internal/util/CitationMock.java | 105 ----
.../apache/sis/internal/util/CitationsTest.java | 123 -----
.../apache/sis/test/suite/UtilityTestSuite.java | 1 -
.../org/apache/sis/storage/geotiff/CRSBuilder.java | 5 +-
.../sis/internal/netcdf/impl/ChannelDecoder.java | 4 +-
.../sis/internal/storage/StoreUtilities.java | 6 +-
43 files changed, 748 insertions(+), 878 deletions(-)
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceTree.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceTree.java
index e45df06..751d256 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceTree.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceTree.java
@@ -35,7 +35,7 @@ import javafx.scene.image.ImageView;
import javafx.scene.text.TextAlignment;
import javafx.util.Callback;
import org.apache.sis.internal.gui.FontGlyphs;
-import org.apache.sis.internal.util.Citations;
+import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.storage.Aggregate;
import org.apache.sis.storage.DataStore;
@@ -129,7 +129,7 @@ public class ResourceTree extends TreeTableView<Resource> {
if (i18n != null) {
id = i18n.toString(); // TODO: use display locale.
} else {
- id = Citations.getIdentifier(identification.getCitation(), false);
+ id = Citations.getIdentifier(identification.getCitation());
}
if (id != null && !(id = id.trim()).isEmpty()) {
if (title == null) {
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Identifiers.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Identifiers.java
new file mode 100644
index 0000000..6678f99
--- /dev/null
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Identifiers.java
@@ -0,0 +1,269 @@
+/*
+ * 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.internal.metadata;
+
+import java.util.Locale;
+import java.util.Iterator;
+import org.opengis.metadata.Identifier;
+import org.opengis.metadata.citation.Citation;
+import org.opengis.util.InternationalString;
+import org.apache.sis.internal.util.Constants;
+import org.apache.sis.internal.util.CollectionsExt;
+import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.util.CharSequences;
+import org.apache.sis.util.Characters;
+import org.apache.sis.util.Deprecable;
+import org.apache.sis.util.Static;
+
+
+/**
+ * Methods working on {@link Identifier} instances.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 1.0
+ * @versio 1.0
+ * @module
+ */
+public final class Identifiers extends Static {
+ /**
+ * Do not allow instantiation of this class.
+ */
+ private Identifiers() {
+ }
+
+ /**
+ * Returns {@code true} if the given code is {@code "EPSG"} while the codespace is {@code "IOGP"} or {@code "OGP"}
+ * (ignoring case). This particular combination of code and codespace is handled in a special way.
+ *
+ * <p>This method can be used for identifying where in Apache SIS source code the relationship between
+ * EPSG authority and IOGP code space is hard-coded.</p>
+ *
+ * @param codeSpace the identifier code space, or {@code null}.
+ * @param code the identifier code, or {@code null}.
+ * @return {@code true} if the given identifier is {@code "IOGP:EPSG"}.
+ *
+ * @see org.apache.sis.metadata.iso.citation.Citations#EPSG
+ */
+ public static boolean isEPSG(final String codeSpace, final String code) {
+ return Constants.EPSG.equalsIgnoreCase(code) &&
+ (Constants.IOGP.equalsIgnoreCase(codeSpace) || "OGP".equalsIgnoreCase(codeSpace) ||
+ Constants.EPSG.equalsIgnoreCase(codeSpace));
+ // "OGP" is a legacy abbreviation that existed before "IOGP".
+ }
+
+ /**
+ * Return {@code true} if the given object is deprecated.
+ */
+ private static boolean isDeprecated(final Object object) {
+ return (object instanceof Deprecable) && ((Deprecable) object).isDeprecated();
+ }
+
+ /**
+ * Returns a "unlocalized" string representation of the given international string, or {@code null} if none
+ * or if the string is deprecated. This method is used by {@link #getIdentifier(Citation, boolean)}, which
+ * is why we don't want the localized string.
+ */
+ private static String toString(final InternationalString title) {
+ return (title != null && !isDeprecated(title))
+ ? CharSequences.trimWhitespaces(title.toString(Locale.ROOT)) : null;
+ }
+
+ /**
+ * Infers an identifier from the given citation, or returns {@code null} if no identifier has been found.
+ * This method removes leading and trailing {@linkplain Character#isWhitespace(int) whitespaces}.
+ * See {@link Citations#getIdentifier(Citation)} for the public documentation of this method.
+ *
+ * <p><b>Which method to use:</b></p>
+ * <ul>
+ * <li>For information purpose (e.g. some {@code toString()} methods), use {@code getIdentifier(…, false)}.</li>
+ * <li>For WKT formatting, use {@code getIdentifier(…, true)} in order to preserve formatting characters.</li>
+ * <li>For assigning a value to a {@code codeSpace} field, use {@link Citations#getUnicodeIdentifier(Citation)}.</li>
+ * </ul>
+ *
+ * Use {@code getUnicodeIdentifier(…)} method when assigning values to be returned by methods like
+ * {@link Identifier#getCodeSpace()}, since those values are likely to be compared without special
+ * care about ignorable identifier characters. But if the intent is to format a more complex string
+ * like WKT or {@code toString()}, then we suggest to use {@code getIdentifier(citation, true)} instead,
+ * which will produce the same result but preserving the ignorable characters, which can be useful
+ * for formatting purpose.
+ *
+ * @param citation the citation for which to get the identifier, or {@code null}.
+ * @param strict {@code true} for returning a non-null value only if the identifier is a valid Unicode identifier.
+ * @return a non-empty identifier for the given citation without leading or trailing whitespaces,
+ * or {@code null} if the given citation is null or does not declare any identifier or title.
+ *
+ * @see <a href="https://issues.apache.org/jira/browse/SIS-201">SIS-201</a>
+ */
+ public static String getIdentifier(final Citation citation, final boolean strict) {
+ if (citation != null) {
+ boolean isUnicode = false; // Whether 'identifier' is a Unicode identifier.
+ String identifier = null; // The best identifier found so far.
+ String codeSpace = null; // Code space of the identifier, or null if none.
+ final Iterator<? extends Identifier> it = CollectionsExt.nonEmptyIterator(citation.getIdentifiers());
+ if (it != null) while (it.hasNext()) {
+ final Identifier id = it.next();
+ if (id != null && !isDeprecated(id)) {
+ final String candidate = CharSequences.trimWhitespaces(id.getCode());
+ if (candidate != null && !candidate.isEmpty()) {
+ /*
+ * For a non-empty identifier, verify if both the code and its codespace are valid
+ * Unicode identifiers. If a codespace exists, then the code does not need to begin
+ * with a "Unicode identifier start" (it may be a "Unicode identifier part").
+ */
+ String cs = CharSequences.trimWhitespaces(id.getCodeSpace());
+ if (cs == null || cs.isEmpty()) {
+ cs = null;
+ isUnicode = CharSequences.isUnicodeIdentifier(candidate);
+ } else {
+ isUnicode = CharSequences.isUnicodeIdentifier(cs);
+ if (isUnicode) for (int i = 0; i < candidate.length();) {
+ final int c = candidate.codePointAt(i);
+ if (!Character.isUnicodeIdentifierPart(c) &&
+ (strict || (c != '.' && c != '-')))
+ {
+ /*
+ * Above special case for '.' and '-' characters is documented
+ * in the public Citations.getIdentifier(Citation) method.
+ */
+ isUnicode = false;
+ break;
+ }
+ i += Character.charCount(c);
+ }
+ }
+ /*
+ * If we found a Unicode identifier, we are done and we can exit the loop.
+ * Otherwise retain the first identifier and continue the search for Unicode identifier.
+ */
+ if (identifier == null || isUnicode) {
+ identifier = candidate;
+ codeSpace = cs;
+ if (isUnicode) break;
+ }
+ }
+ }
+ }
+ /*
+ * If no identifier has been found, fallback on the first title or alternate title.
+ * We search for alternate titles because ISO specification said that those titles
+ * are often used for abbreviations. Again we give preference to Unicode identifiers,
+ * which are typically alternate titles.
+ */
+ if (identifier == null) {
+ identifier = toString(citation.getTitle()); // Whitepaces removed by toString(…).
+ if (identifier != null) {
+ if (identifier.isEmpty()) {
+ identifier = null;
+ } else {
+ isUnicode = CharSequences.isUnicodeIdentifier(identifier);
+ }
+ }
+ if (!isUnicode) {
+ final Iterator<? extends InternationalString> iterator = CollectionsExt.nonEmptyIterator(citation.getAlternateTitles());
+ if (iterator != null) while (iterator.hasNext()) {
+ final String candidate = toString(iterator.next());
+ if (candidate != null && !candidate.isEmpty()) {
+ isUnicode = CharSequences.isUnicodeIdentifier(candidate);
+ if (identifier == null || isUnicode) {
+ identifier = candidate;
+ if (isUnicode) break;
+ }
+ }
+ }
+ }
+ }
+ /*
+ * Finished searching in the identifiers, title and alternate titles. If the identifier that
+ * we found is not a valid Unicode identifier, we will return it only if the caller did not
+ * asked for strictly valid Unicode identifier.
+ */
+ if (isUnicode || !strict) {
+ if (codeSpace != null && !isEPSG(codeSpace, identifier)) {
+ return codeSpace + (strict ? '_' : Constants.DEFAULT_SEPARATOR) + identifier;
+ } else {
+ return identifier;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns {@code true} if the given identifier authority matches the given {@code authority}.
+ * If one of the authority is null, then the comparison fallback on the given {@code codeSpace}.
+ * If the code spaces are also null, then this method conservatively returns {@code false}.
+ *
+ * @param identifier the identifier to compare.
+ * @param authority the desired authority, or {@code null}.
+ * @param codeSpace the desired code space or {@code null}, used as a fallback if an authority is null.
+ * @return {@code true} if the authority or code space (as a fallback only) matches.
+ */
+ private static boolean authorityMatches(final Identifier identifier, final Citation authority, final String codeSpace) {
+ if (authority != null) {
+ final Citation other = identifier.getAuthority();
+ if (other != null) {
+ return Citations.identifierMatches(authority, other);
+ }
+ }
+ if (codeSpace != null) {
+ final String other = identifier.getCodeSpace();
+ if (other != null) {
+ return CharSequences.equalsFiltered(codeSpace, other, Characters.Filter.UNICODE_IDENTIFIER, true);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Determines whether a match or mismatch is found between the two given collections of identifiers.
+ * If any of the given collections is {@code null} or empty, then this method returns {@code null}.
+ *
+ * <p>According ISO 19162 (<cite>Well known text representation of coordinate reference systems</cite>),
+ * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getIdentifiers() identifiers} should have precedence over
+ * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getName() name} for identifying {@code IdentifiedObject}s,
+ * at least in the case of {@linkplain org.apache.sis.referencing.operation.DefaultOperationMethod operation methods} and
+ * {@linkplain org.apache.sis.parameter.AbstractParameterDescriptor parameters}.</p>
+ *
+ * @param id1 the first collection of identifiers, or {@code null}.
+ * @param id2 the second collection of identifiers, or {@code null}.
+ * @return {@code TRUE} or {@code FALSE} on match or mismatch respectively, or {@code null} if this method
+ * can not determine if there is a match or mismatch.
+ */
+ public static Boolean hasCommonIdentifier(final Iterable<? extends Identifier> id1,
+ final Iterable<? extends Identifier> id2)
+ {
+ if (id1 != null && id2 != null) {
+ boolean hasFound = false;
+ for (final Identifier identifier : id1) {
+ final Citation authority = identifier.getAuthority();
+ final String codeSpace = identifier.getCodeSpace();
+ for (final Identifier other : id2) {
+ if (authorityMatches(identifier, authority, codeSpace)) {
+ if (CharSequences.equalsFiltered(identifier.getCode(), other.getCode(), Characters.Filter.UNICODE_IDENTIFIER, true)) {
+ return Boolean.TRUE;
+ }
+ hasFound = true;
+ }
+ }
+ }
+ if (hasFound) {
+ return Boolean.FALSE;
+ }
+ }
+ return null;
+ }
+}
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
index 21d6a1b..891b375 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
@@ -21,6 +21,7 @@ import java.util.Locale;
import java.util.TimeZone;
import javax.sql.DataSource;
import org.opengis.util.ControlledVocabulary;
+import org.opengis.metadata.citation.Citation;
import org.apache.sis.internal.util.MetadataServices;
import org.apache.sis.internal.metadata.sql.Initializer;
import org.apache.sis.internal.system.Loggers;
@@ -73,6 +74,18 @@ public final class ServicesForUtility extends MetadataServices {
}
/**
+ * Infers an identifier from the given citation, or returns {@code null} if no identifier has been found.
+ * This method returns a non-null value only if the identifier is a valid Unicode identifier.
+ *
+ * @param citation the citation for which to get the identifier, or {@code null}.
+ * @return a non-empty identifier without leading or trailing whitespaces, or {@code null}.
+ */
+ @Override
+ public String getUnicodeIdentifier(final Citation citation) {
+ return Identifiers.getIdentifier(citation, true);
+ }
+
+ /**
* Returns information about the Apache SIS configuration.
* See super-class for a list of keys.
*
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
index eadcf33..17d2b7b 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
@@ -27,8 +27,8 @@ import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.extent.Extent;
import org.opengis.referencing.IdentifiedObject;
-import org.apache.sis.internal.util.Citations;
-import org.apache.sis.util.iso.DefaultNameSpace;
+import org.apache.sis.internal.metadata.Identifiers;
+import org.apache.sis.internal.util.Constants;
import org.apache.sis.util.LenientComparable;
import org.apache.sis.util.ComparisonMode;
@@ -245,10 +245,10 @@ public class SimpleIdentifiedObject implements IdentifiedObject, LenientComparab
}
final StringBuilder buffer = new StringBuilder("IdentifiedObject[\"");
if (codespace != null) {
- buffer.append(codespace).append(DefaultNameSpace.DEFAULT_SEPARATOR);
+ buffer.append(codespace).append(Constants.DEFAULT_SEPARATOR);
}
buffer.append(code).append('"');
- final String identifier = Citations.getIdentifier(authority, true);
+ final String identifier = Identifiers.getIdentifier(authority, true);
if (identifier != null) {
buffer.append(", Id[\"").append(identifier).append("\"]"); // "Id" should be consistent with WKTKeywords.Id.
}
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java
index a264a9d..8ee20eb 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java
@@ -21,12 +21,11 @@ import java.io.Serializable;
import org.opengis.util.InternationalString;
import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
+import org.apache.sis.internal.util.Constants;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Classes;
import org.apache.sis.util.Deprecable;
-import static org.apache.sis.util.iso.DefaultNameSpace.DEFAULT_SEPARATOR;
-
/**
* An implementation of {@link Identifier} as a wrapper around a {@link Citation}.
@@ -215,7 +214,7 @@ public class SimpleIdentifier implements Identifier, Deprecable, Serializable {
open = true;
}
if (code != null) {
- buffer.append(open ? DEFAULT_SEPARATOR : '“').append(code);
+ buffer.append(open ? Constants.DEFAULT_SEPARATOR : '“').append(code);
open = true;
}
if (open) {
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
index 1a2ee0d..4bea3e6 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
@@ -18,13 +18,21 @@ package org.apache.sis.metadata.iso.citation;
import java.util.List;
import java.util.Arrays;
+import java.util.Objects;
+import java.util.Iterator;
+import java.util.Collection;
+import java.util.Locale;
+import org.opengis.util.InternationalString;
+import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
import org.opengis.referencing.IdentifiedObject; // For javadoc
import org.apache.sis.util.Static;
+import org.apache.sis.util.Characters;
import org.apache.sis.util.CharSequences;
import org.apache.sis.xml.IdentifierSpace;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.UnmodifiableArrayList;
+import org.apache.sis.internal.metadata.Identifiers;
import org.apache.sis.internal.simple.SimpleCitation;
import org.apache.sis.internal.simple.CitationConstant;
import org.apache.sis.internal.jaxb.NonMarshalledAuthority;
@@ -32,7 +40,7 @@ import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.system.SystemListener;
import org.apache.sis.metadata.iso.DefaultIdentifier; // For javadoc
-import static org.apache.sis.internal.util.Citations.equalsFiltered;
+import static org.apache.sis.internal.util.CollectionsExt.nonEmptyIterator;
/**
@@ -512,6 +520,19 @@ public final class Citations extends Static {
}
/**
+ * The method to be used consistently for comparing titles or identifiers in all {@code fooMathes(…)}
+ * methods declared in this class.
+ *
+ * @param s1 the first characters sequence to compare, or {@code null}.
+ * @param s2 the second characters sequence to compare, or {@code null}.
+ * @return {@code true} if both arguments are {@code null} or if the two given texts are equal,
+ * ignoring case and any characters other than digits and letters.
+ */
+ private static boolean equalsFiltered(final CharSequence s1, final CharSequence s2) {
+ return CharSequences.equalsFiltered(s1, s2, Characters.Filter.LETTERS_AND_DIGITS, true);
+ }
+
+ /**
* Returns {@code true} if at least one {@linkplain DefaultCitation#getTitle() title} or
* {@linkplain DefaultCitation#getAlternateTitles() alternate title} in {@code c1} is leniently
* equal to a title or alternate title in {@code c2}. The comparison is case-insensitive
@@ -523,7 +544,34 @@ public final class Citations extends Static {
* @return {@code true} if both arguments are non-null, and at least one title or alternate title matches.
*/
public static boolean titleMatches(final Citation c1, final Citation c2) {
- return org.apache.sis.internal.util.Citations.titleMatches(c1, c2);
+ if (c1 != null && c2 != null) {
+ if (c1 == c2) {
+ return true; // Optimisation for a common case.
+ }
+ InternationalString candidate = c2.getTitle();
+ Iterator<? extends InternationalString> iterator = null;
+ do {
+ if (candidate != null) {
+ final String unlocalized = candidate.toString(Locale.ROOT);
+ if (titleMatches(c1, unlocalized)) {
+ return true;
+ }
+ final String localized = candidate.toString();
+ if (!Objects.equals(localized, unlocalized) // Slight optimization for a common case.
+ && titleMatches(c1, localized))
+ {
+ return true;
+ }
+ }
+ if (iterator == null) {
+ iterator = nonEmptyIterator(c2.getAlternateTitles());
+ if (iterator == null) break;
+ }
+ if (!iterator.hasNext()) break;
+ candidate = iterator.next();
+ } while (true);
+ }
+ return false;
}
/**
@@ -538,7 +586,31 @@ public final class Citations extends Static {
* title matches the given string.
*/
public static boolean titleMatches(final Citation citation, final String title) {
- return org.apache.sis.internal.util.Citations.titleMatches(citation, title);
+ if (citation != null && title != null) {
+ InternationalString candidate = citation.getTitle();
+ Iterator<? extends InternationalString> iterator = null;
+ do {
+ if (candidate != null) {
+ final String unlocalized = candidate.toString(Locale.ROOT);
+ if (equalsFiltered(unlocalized, title)) {
+ return true;
+ }
+ final String localized = candidate.toString();
+ if (!Objects.equals(localized, unlocalized) // Slight optimization for a common case.
+ && equalsFiltered(localized, title))
+ {
+ return true;
+ }
+ }
+ if (iterator == null) {
+ iterator = nonEmptyIterator(citation.getAlternateTitles());
+ if (iterator == null) break;
+ }
+ if (!iterator.hasNext()) break;
+ candidate = iterator.next();
+ } while (true);
+ }
+ return false;
}
/**
@@ -558,8 +630,33 @@ public final class Citations extends Static {
* @param c2 the second citation to compare, or {@code null}.
* @return {@code true} if both arguments are non-null, and at least one identifier matches.
*/
- public static boolean identifierMatches(final Citation c1, final Citation c2) {
- return org.apache.sis.internal.util.Citations.identifierMatches(c1, c2);
+ public static boolean identifierMatches(Citation c1, final Citation c2) {
+ if (c1 != null && c2 != null) {
+ if (c1 == c2) {
+ return true; // Optimisation for a common case.
+ }
+ /*
+ * If there is no identifier in both citations, fallback on title comparisons.
+ * If there is identifiers in only one citation, make sure that this citation
+ * is the second one (c2) in order to allow at least one call to
+ * 'identifierMatches(c1, String)'.
+ */
+ Iterator<? extends Identifier> iterator = nonEmptyIterator(c2.getIdentifiers());
+ if (iterator == null) {
+ iterator = nonEmptyIterator(c1.getIdentifiers());
+ if (iterator == null) {
+ return titleMatches(c1, c2);
+ }
+ c1 = c2;
+ }
+ do {
+ final Identifier id = iterator.next();
+ if (id != null && identifierMatches(c1, id, id.getCode())) {
+ return true;
+ }
+ } while (iterator.hasNext());
+ }
+ return false;
}
/**
@@ -580,7 +677,66 @@ public final class Citations extends Static {
* @return {@code true} if both arguments are non-null, and an identifier matches the given string.
*/
public static boolean identifierMatches(final Citation citation, final String identifier) {
- return org.apache.sis.internal.util.Citations.identifierMatches(citation, null, identifier);
+ return identifierMatches(citation, null, identifier);
+ }
+
+ /**
+ * Returns {@code true} if the given citation has at least one identifier equals to the given string,
+ * ignoring case and non-alphanumeric characters. If and <em>only</em> if the citation does not contain
+ * any identifier, then this method fallback on titles comparison.
+ *
+ * @param citation the citation to check for, or {@code null}.
+ * @param identifier the identifier to compare, or {@code null} if unknown.
+ * @param code value of {@code identifier.getCode()}, or {@code null}.
+ * @return {@code true} if both arguments are non-null, and an identifier matches the given string.
+ */
+ static boolean identifierMatches(final Citation citation, final Identifier identifier, final String code) {
+ if (citation != null && code != null) {
+ final Collection<? extends Identifier> citIds = citation.getIdentifiers();
+ Iterator<? extends Identifier> it = nonEmptyIterator(citIds);
+ if (it == null) {
+ return titleMatches(citation, code);
+ }
+ while (it.hasNext()) {
+ final Identifier citId = it.next();
+ if (citId != null && equalsFiltered(code, citId.getCode())) {
+ /*
+ * Found a possible match. We will take the code space in account only if it is defined
+ * by both identifiers. If a code space is undefined, we consider that we have a match.
+ */
+ if (identifier != null) {
+ final String codeSpace = identifier.getCodeSpace();
+ if (codeSpace != null) {
+ final String cs = citId.getCodeSpace();
+ if (cs != null && !equalsFiltered(codeSpace, cs)) {
+ continue; // Check other identifiers.
+ }
+ }
+ }
+ return true;
+ }
+ }
+ /*
+ * Before to give up, maybe the given code argument is actually written using a "codeSpace:code" syntax.
+ * Try to parse that syntax only if no Identifier argument were specified (otherwise we require the code
+ * and code space to be splitted as defined in the identifier).
+ */
+ if (identifier == null) {
+ int s = 0;
+ final int length = code.length();
+ while ((s = CharSequences.indexOf(code, Constants.DEFAULT_SEPARATOR, s, length)) >= 0) {
+ final CharSequence codeSpace = code.subSequence(0, s);
+ final CharSequence localPart = code.subSequence(++s, length);
+ for (it = citIds.iterator(); it.hasNext();) {
+ final Identifier id = it.next();
+ if (equalsFiltered(codeSpace, id.getCodeSpace()) && equalsFiltered(localPart, id.getCode())) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
}
/**
@@ -641,7 +797,7 @@ public final class Citations extends Static {
* or {@code null} if the given citation is null or does not declare any identifier or title.
*/
public static String getIdentifier(final Citation citation) {
- return org.apache.sis.internal.util.Citations.getIdentifier(citation, false);
+ return Identifiers.getIdentifier(citation, false);
}
/**
@@ -662,8 +818,7 @@ public final class Citations extends Static {
*/
@Deprecated
public static String getUnicodeIdentifier(final Citation citation) {
- return org.apache.sis.internal.util.Citations.removeIgnorableCharacters(
- org.apache.sis.internal.util.Citations.getIdentifier(citation, true));
+ return removeIgnorableCharacters(Identifiers.getIdentifier(citation, true));
}
/**
@@ -711,8 +866,7 @@ public final class Citations extends Static {
if (citation instanceof IdentifierSpace<?>) {
return ((IdentifierSpace<?>) citation).getName();
} else {
- return org.apache.sis.internal.util.Citations.removeIgnorableCharacters(
- org.apache.sis.internal.util.Citations.getIdentifier(citation, true));
+ return removeIgnorableCharacters(Identifiers.getIdentifier(citation, true));
}
}
@@ -726,4 +880,52 @@ public final class Citations extends Static {
public static String getCodeSpace(final Citation citation) {
return toCodeSpace(citation);
}
+
+ /**
+ * Removes characters that are ignorable according Unicode specification.
+ *
+ * @param identifier the character sequence from which to remove ignorable characters, or {@code null}.
+ * @return a character sequence with ignorable character removed. May be the same instance than the given argument.
+ */
+ private static String removeIgnorableCharacters(final String identifier) {
+ if (identifier != null) {
+ /*
+ * First perform a quick check to see if there is any ignorable characters.
+ * We make this check because those characters are valid according Unicode
+ * but not according XML. However there is usually no such characters, so
+ * we will avoid the StringBuilder creation in the vast majority of times.
+ *
+ * Note that 'µ' and its friends are not ignorable, so we do not remove them.
+ * This method is aimed for "getUnicodeIdentifier", not "getXmlIdentifier".
+ */
+ final int length = identifier.length();
+ for (int i=0; i<length;) {
+ int c = identifier.codePointAt(i);
+ int n = Character.charCount(c);
+ if (Character.isIdentifierIgnorable(c)) {
+ /*
+ * Found an ignorable character. Create the buffer and copy non-ignorable characters.
+ * Following algorithm is inefficient, since we fill the buffer character-by-character
+ * (a more efficient approach would be to perform bulk appends). However we presume
+ * that this block will be rarely executed, so it is not worth to optimize it.
+ */
+ final StringBuilder buffer = new StringBuilder(length - n).append(identifier, 0, i);
+ while ((i += n) < length) {
+ c = identifier.codePointAt(i);
+ n = Character.charCount(c);
+ if (!Character.isIdentifierIgnorable(c)) {
+ buffer.appendCodePoint(c);
+ }
+ }
+ /*
+ * No need to verify if the buffer is empty, because ignorable
+ * characters are not legal Unicode identifier start.
+ */
+ return buffer.toString();
+ }
+ i += n;
+ }
+ }
+ return identifier;
+ }
}
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java
index 7e48e70..58c9404 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResource.java
@@ -32,7 +32,7 @@ import org.apache.sis.internal.jaxb.metadata.SV_OperationMetadata;
import org.apache.sis.internal.jaxb.FilterByVersion;
import org.apache.sis.internal.xml.LegacyNamespaces;
import org.apache.sis.internal.jaxb.gco.GO_GenericName;
-import org.apache.sis.util.iso.DefaultNameSpace;
+import org.apache.sis.internal.util.Constants;
import org.apache.sis.util.iso.Names;
import org.apache.sis.xml.Namespaces;
@@ -330,8 +330,8 @@ public class DefaultCoupledResource extends ISOMetadata implements CoupledResour
* If the given name does not have a namespace, add an arbitrary namespace
* in order to get an instanceof ScopedName instead of LocalName after parsing.
*/
- if (value.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR) < 0) {
- value = "global" + DefaultNameSpace.DEFAULT_SEPARATOR + value;
+ if (value.indexOf(Constants.DEFAULT_SEPARATOR) < 0) {
+ value = "global" + Constants.DEFAULT_SEPARATOR + value;
}
setScopedName((ScopedName) Names.parseGenericName(null, null, value));
}
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java
index 582edbb..990423f 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java
@@ -41,7 +41,6 @@ import org.apache.sis.util.Exceptions;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Messages;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.iso.Types;
import org.apache.sis.util.collection.Containers;
import org.apache.sis.metadata.MetadataStandard;
@@ -52,6 +51,7 @@ import org.apache.sis.metadata.TitleProperty;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.internal.metadata.sql.SQLBuilder;
import org.apache.sis.internal.metadata.sql.Reflection;
+import org.apache.sis.internal.util.Constants;
import org.apache.sis.xml.IdentifiedObject;
// Branch-dependent imports
@@ -708,7 +708,7 @@ public class MetadataWriter extends MetadataSource {
if (identifier != null) {
final String cs = nonEmpty(id.getCodeSpace());
if (cs != null) {
- identifier = cs + DefaultNameSpace.DEFAULT_SEPARATOR + identifier;
+ identifier = cs + Constants.DEFAULT_SEPARATOR + identifier;
}
break;
}
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
index 7d8cd60..c274dbc 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
@@ -23,6 +23,7 @@ import java.util.Locale;
import java.util.Objects;
import java.io.Serializable;
import java.io.ObjectStreamException;
+import org.apache.sis.internal.util.Constants;
import org.opengis.util.NameSpace;
import org.opengis.util.LocalName;
import org.opengis.util.ScopedName;
@@ -71,7 +72,7 @@ public class DefaultNameSpace implements NameSpace, Serializable {
* The default separator, which is {@code ':'}. The separator is inserted between
* the namespace and any {@linkplain GenericName generic name} in that namespace.
*/
- public static final char DEFAULT_SEPARATOR = org.apache.sis.internal.util.Citations.DEFAULT_SEPARATOR;
+ public static final char DEFAULT_SEPARATOR = Constants.DEFAULT_SEPARATOR;
/**
* {@link #DEFAULT_SEPARATOR} as a {@link String}.
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/IdentifiersTest.java b/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/IdentifiersTest.java
new file mode 100644
index 0000000..38dfb93
--- /dev/null
+++ b/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/IdentifiersTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.internal.metadata;
+
+import java.util.List;
+import java.util.Arrays;
+import java.util.ArrayList;
+import org.opengis.metadata.Identifier;
+import org.apache.sis.metadata.iso.DefaultIdentifier;
+import org.apache.sis.metadata.iso.citation.DefaultCitation;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests {@link Identifiers}.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 1.0
+ * @versio 1.0
+ * @module
+ */
+public final strictfp class IdentifiersTest extends TestCase {
+ /**
+ * Creates a citation with the given title and the given identifiers.
+ */
+ private static DefaultCitation citation(final String title, final Identifier... identifiers) {
+ DefaultCitation cit = new DefaultCitation(title);
+ cit.setIdentifiers(Arrays.asList(identifiers));
+ return cit;
+ }
+
+ /**
+ * Creates an identifier with a code space.
+ */
+ private static Identifier identifier(final String codeSpace, final String code) {
+ return new DefaultIdentifier(codeSpace, code, null);
+ }
+
+ /**
+ * Tests {@link Identifiers#hasCommonIdentifier(Iterable, Iterable)}.
+ */
+ @Test
+ public void testHasCommonIdentifier() {
+ final List<Identifier> id1 = new ArrayList<>(3);
+ final List<Identifier> id2 = new ArrayList<>(2);
+ assertNull(Identifiers.hasCommonIdentifier(id1, id2));
+ /*
+ * Add codes for two Operation Methods which are implemented in Apache SIS by the same class:
+ *
+ * - EPSG:9804 — "Mercator (variant A)" (formerly known as "Mercator (1SP)").
+ * - EPSG:1026 — "Mercator (Spherical)"
+ * - GeoTIFF:7 — "CT_Mercator"
+ */
+ id1.add(identifier("EPSG", "9804"));
+ id1.add(identifier("EPSG", "1026"));
+ id1.add(identifier("GeoTIFF", "7"));
+ assertNull(Identifiers.hasCommonIdentifier(id1, id2));
+ /*
+ * EPSG:9841 is a legacy (now deprecated) code for "Mercator (1SP)".
+ * We could have declared it as a deprecated code in the above list,
+ * but for the sake of this test we do not.
+ */
+ id2.add(identifier("EPSG", "9841"));
+ assertEquals(Boolean.FALSE, Identifiers.hasCommonIdentifier(id1, id2));
+ id2.add(identifier("EPSG", "9804"));
+ assertEquals(Boolean.TRUE, Identifiers.hasCommonIdentifier(id1, id2));
+ }
+
+ /**
+ * Tests {@link Identifiers#getIdentifier(Citation, boolean)}.
+ */
+ @Test
+ public void testGetIdentifier() {
+ DefaultCitation citation = new DefaultCitation(" Not an identifier ");
+ assertEquals("Not an identifier", Identifiers.getIdentifier(citation, false));
+ assertNull(Identifiers.getIdentifier(citation, true));
+
+ citation = new DefaultCitation(" ValidIdentifier ");
+ assertEquals("ValidIdentifier", Identifiers.getIdentifier(citation, false));
+ assertEquals("ValidIdentifier", Identifiers.getIdentifier(citation, true));
+ /*
+ * Following test uses '-' in the first identifier, which is an invalid Unicode identifier part.
+ * Consequently the identifier that we get depends on whether we ask for strict Unicode or not.
+ */
+ citation = citation("Web Map Server", identifier("OGC", "06-042"), identifier("ISO", "19128"));
+ assertEquals("OGC:06-042", Identifiers.getIdentifier(citation, false));
+ assertEquals("ISO_19128", Identifiers.getIdentifier(citation, true));
+ }
+}
diff --git 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
index 2699b8e..513862c 100644
--- 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
@@ -18,13 +18,15 @@ package org.apache.sis.metadata.iso.citation;
import java.util.Set;
import java.util.List;
+import java.util.Arrays;
import java.util.Locale;
+import java.util.Collection;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.lang.reflect.Field;
-import java.util.Collection;
import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
+import org.apache.sis.metadata.iso.DefaultIdentifier;
import org.apache.sis.internal.simple.CitationConstant;
import org.apache.sis.internal.simple.SimpleCitation;
import org.apache.sis.internal.util.Constants;
@@ -278,4 +280,23 @@ public final strictfp class CitationsTest extends TestCase {
}
}
}
+
+ /**
+ * Tests {@link Citations#identifierMatches(Citation, Identifier, String)}.
+ */
+ @Test
+ public void testIdentifierMatches() {
+ final Identifier ogc = new DefaultIdentifier("OGC", "06-042", null);
+ final Identifier iso = new DefaultIdentifier("ISO", "19128", null);
+ final DefaultCitation citation = new DefaultCitation("Web Map Server");
+ citation.setIdentifiers(Arrays.asList(ogc, iso, new DefaultIdentifier("Foo", "06-042", null)));
+ assertTrue ("With full identifier", Citations.identifierMatches(citation, ogc, ogc.getCode()));
+ assertTrue ("With full identifier", Citations.identifierMatches(citation, iso, iso.getCode()));
+ assertFalse("With wrong code", Citations.identifierMatches(citation, new DefaultIdentifier("ISO", "19115", null), "19115"));
+ assertFalse("With wrong code space", Citations.identifierMatches(citation, new DefaultIdentifier("Foo", "19128", null), "19128"));
+ assertFalse("With wrong code", Citations.identifierMatches(citation, "Foo"));
+ assertTrue ("Without identifier", Citations.identifierMatches(citation, "19128"));
+ assertTrue ("With parsing", Citations.identifierMatches(citation, "ISO:19128"));
+ assertFalse("With wrong code space", Citations.identifierMatches(citation, "Foo:19128"));
+ }
}
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java b/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
index 3d8278e..8c049bc 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
@@ -30,6 +30,7 @@ import org.junit.BeforeClass;
* @module
*/
@Suite.SuiteClasses({
+ org.apache.sis.internal.metadata.IdentifiersTest.class,
org.apache.sis.internal.metadata.AxisNamesTest.class,
org.apache.sis.internal.metadata.NameMeaningTest.class,
org.apache.sis.internal.metadata.MetadataUtilitiesTest.class,
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
index 96b0cd0..45dd1db 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
@@ -25,6 +25,7 @@ import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.DefinitionURI;
import org.apache.sis.internal.metadata.NameMeaning;
import org.apache.sis.referencing.NamedIdentifier;
+import org.apache.sis.internal.metadata.Identifiers;
import org.apache.sis.metadata.iso.citation.Citations;
import static org.apache.sis.metadata.iso.citation.Citations.toCodeSpace;
@@ -125,7 +126,7 @@ public final class Code {
*
* A symmetrical special handling for EPSG is done in the 'forIdentifiedObject(…)' method of this class.
*/
- if (org.apache.sis.internal.util.Citations.isEPSG(cs, parsed.authority)) {
+ if (Identifiers.isEPSG(cs, parsed.authority)) {
authority = Citations.EPSG;
} else {
authority = Citations.fromName(cs); // May be null.
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java
index baee026..07cf2cf 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java
@@ -36,7 +36,7 @@ import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.factory.GeodeticAuthorityFactory;
import org.apache.sis.referencing.factory.IdentifiedObjectFinder;
-import org.apache.sis.internal.util.Citations;
+import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.Utilities;
@@ -169,7 +169,7 @@ public final class DefinitionVerifier {
if (factory instanceof GeodeticAuthorityFactory) {
finder = ((GeodeticAuthorityFactory) factory).newIdentifiedObjectFinder();
} else {
- finder = IdentifiedObjects.newFinder(Citations.getIdentifier(authority, false));
+ finder = IdentifiedObjects.newFinder(Citations.getIdentifier(authority));
}
finder.setIgnoringAxes(true);
final IdentifiedObject ref = finder.findSingleton(crs);
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
index 667426f..b5438d2 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
@@ -133,8 +133,6 @@ public final class ReferencingUtilities extends Static {
*
* @param crs the CRS from which to get the number of dimensions, or {@code null}.
* @return the number of dimensions, or 0 if the given CRS or its coordinate system is null.
- *
- * @since 0.6
*/
public static int getDimension(final CoordinateReferenceSystem crs) {
if (crs != null) {
@@ -205,8 +203,6 @@ public final class ReferencingUtilities extends Static {
* @return {@code true} if the given datum is non null and of ellipsoidal type.
*
* @see org.apache.sis.internal.metadata.VerticalDatumTypes#ELLIPSOIDAL
- *
- * @since 0.8
*/
public static boolean isEllipsoidalHeight(final VerticalDatum datum) {
if (datum != null) {
@@ -266,8 +262,6 @@ public final class ReferencingUtilities extends Static {
*
* @param crs the coordinate reference system for which to get the ellipsoid.
* @return the ellipsoid in the given CRS, or {@code null} if none.
- *
- * @since 0.6
*/
public static Ellipsoid getEllipsoidOfGeographicCRS(CoordinateReferenceSystem crs) {
while (!(crs instanceof GeodeticCRS)) {
@@ -379,8 +373,6 @@ public final class ReferencingUtilities extends Static {
* @return a view of the identified object properties.
*
* @see IdentifiedObjects#getProperties(IdentifiedObject, String...)
- *
- * @since 0.7
*/
public static Map<String,?> getPropertiesForModifiedCRS(final IdentifiedObject object) {
final Map<String,?> properties = IdentifiedObjects.getProperties(object, IdentifiedObject.IDENTIFIERS_KEY);
@@ -426,8 +418,6 @@ public final class ReferencingUtilities extends Static {
* @return the XML property name for the given class or interface, or {@code null} if none.
*
* @see WKTUtilities#toType(Class, Class)
- *
- * @since 0.6
*/
public static StringBuilder toPropertyName(final Class<?> base, final Class<?> type) {
final UML uml = type.getAnnotation(UML.class);
@@ -462,8 +452,6 @@ public final class ReferencingUtilities extends Static {
* @param targetCRS the CRS from which to get the target coordinate system and ellipsoid.
* @param context a pre-allocated context, or {@code null} for creating a new one.
* @return the given context if it was non-null, or a new context otherwise.
- *
- * @since 0.7
*/
public static Context createTransformContext(final CoordinateReferenceSystem sourceCRS,
final CoordinateReferenceSystem targetCRS, Context context)
@@ -498,8 +486,6 @@ public final class ReferencingUtilities extends Static {
* @return mapping from parameter identifiers to parameter names defined by the given authority.
* @throws NumberFormatException if a parameter identifier of the given authority is not numeric.
* @throws IllegalArgumentException if the same identifier is used for two or more parameters.
- *
- * @since 0.8
*/
public static Map<Integer,String> identifierToName(final ParameterDescriptorGroup parameters, final Citation authority) {
final Map<Integer,String> mapping = new HashMap<>();
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
index 8b6ea4c..4fcbb9e 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
@@ -82,7 +82,6 @@ import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.Exceptions;
import org.apache.sis.util.Utilities;
-import org.apache.sis.util.iso.DefaultNameSpace;
/**
@@ -469,7 +468,7 @@ public final class ServicesForMetadata extends ReferencingServices {
public String getPreferredIdentifier(final IdentifiedObject object) throws FactoryException {
final Integer code = IdentifiedObjects.lookupEPSG(object);
if (code != null) {
- return Constants.EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + code;
+ return Constants.EPSG + Constants.DEFAULT_SEPARATOR + code;
}
/*
* If above code did not found an EPSG code, discard EPSG codes that
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
index 4a1eb13..d117981 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
@@ -70,9 +70,9 @@ import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.collection.IntegerList;
+import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.internal.util.X364;
import org.apache.sis.internal.util.Numerics;
-import org.apache.sis.internal.util.Citations;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.StandardDateFormat;
import org.apache.sis.internal.simple.SimpleExtent;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
index d561fe1..d63628c 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
@@ -80,11 +80,11 @@ import org.apache.sis.internal.metadata.TransformationAccuracy;
import org.apache.sis.internal.metadata.EllipsoidalHeightCombiner;
import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.internal.util.Strings;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.iso.Types;
import static java.util.Collections.singletonMap;
@@ -1309,7 +1309,7 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
FactoryException suppressed = null;
if (id != null) try {
// CodeSpace is a mandatory attribute in ID[…] elements, so we do not test for null values.
- return opFactory.getOperationMethod(id.getCodeSpace() + DefaultNameSpace.DEFAULT_SEPARATOR + id.getCode());
+ return opFactory.getOperationMethod(id.getCodeSpace() + Constants.DEFAULT_SEPARATOR + id.getCode());
} catch (FactoryException e) {
suppressed = e;
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java b/core/sis-referencing/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
index 1044954..bb92d69 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
@@ -28,6 +28,7 @@ import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.iso.Types;
import org.apache.sis.metadata.TitleProperty;
import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.internal.metadata.Identifiers;
import org.apache.sis.internal.metadata.NameMeaning;
import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.io.wkt.FormattableObject;
@@ -471,8 +472,7 @@ public class ImmutableIdentifier extends FormattableObject implements Identifier
if (code != null) {
final String codeSpace = getCodeSpace();
final Citation authority = getAuthority();
- final String cs = (codeSpace != null) ? codeSpace :
- org.apache.sis.internal.util.Citations.getIdentifier(authority, true);
+ final String cs = (codeSpace != null) ? codeSpace : Identifiers.getIdentifier(authority, true);
if (cs != null) {
final Convention convention = formatter.getConvention();
if (convention.majorVersion() == 1) {
@@ -503,7 +503,7 @@ public class ImmutableIdentifier extends FormattableObject implements Identifier
final FormattableObject enclosing = formatter.getEnclosingElement(1);
final boolean isRoot = formatter.getEnclosingElement(2) == null;
if (isRoot || !(enclosing instanceof ParameterValue<?>)) {
- final String citation = org.apache.sis.internal.util.Citations.getIdentifier(authority, false);
+ final String citation = Identifiers.getIdentifier(authority, false);
if (citation != null && !citation.equals(cs)) {
formatter.append(new Cite(citation));
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java b/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java
index 462667c..3b0e965 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java
@@ -45,7 +45,7 @@ import org.apache.sis.internal.util.X364;
import static org.apache.sis.internal.util.X364.*;
import static org.apache.sis.util.CharSequences.spaces;
-import static org.apache.sis.util.iso.DefaultNameSpace.DEFAULT_SEPARATOR;
+import static org.apache.sis.internal.util.Constants.DEFAULT_SEPARATOR;
/**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
index 014924b..5366ead 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
@@ -49,7 +49,6 @@ import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.referencing.Fallback;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.util.resources.Vocabulary;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Debug;
import org.apache.sis.measure.Latitude;
@@ -285,7 +284,7 @@ final class EPSGFactoryFallback extends GeodeticAuthorityFactory
* is used directly (not through MultiAuthoritiesFactory), which should be rare. The main case is
* when using the factory returned by AuthorityFactories.fallback(…).
*/
- code = CharSequences.trimWhitespaces(code, code.lastIndexOf(DefaultNameSpace.DEFAULT_SEPARATOR) + 1, code.length()).toString();
+ code = CharSequences.trimWhitespaces(code, code.lastIndexOf(Constants.DEFAULT_SEPARATOR) + 1, code.length()).toString();
final short n = Short.parseShort(code);
if ((kind & (ELLIPSOID | DATUM | CRS)) != 0) {
for (final CommonCRS crs : CommonCRS.values()) {
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
index 33faa56..117c21d 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
@@ -37,10 +37,10 @@ import org.apache.sis.util.Static;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.logging.Logging;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.DefinitionURI;
import org.apache.sis.internal.system.Modules;
+import org.apache.sis.internal.metadata.Identifiers;
import org.apache.sis.internal.metadata.NameMeaning;
import org.apache.sis.internal.metadata.NameToIdentifier;
import org.apache.sis.metadata.iso.citation.Citations;
@@ -48,8 +48,7 @@ import org.apache.sis.referencing.factory.IdentifiedObjectFinder;
import org.apache.sis.referencing.factory.GeodeticAuthorityFactory;
import org.apache.sis.referencing.factory.NoSuchAuthorityFactoryException;
-import static org.apache.sis.internal.util.Citations.iterator;
-import static org.apache.sis.internal.util.Citations.identifierMatches;
+import static org.apache.sis.internal.util.CollectionsExt.iterator;
/**
@@ -200,7 +199,7 @@ public final class IdentifiedObjects extends Static {
}
}
final Iterator<GenericName> it = iterator(object.getAlias());
- if (it != null) while (it.hasNext()) {
+ while (it.hasNext()) {
final GenericName alias = it.next();
if (alias != null) {
final String name = (alias instanceof Identifier) ?
@@ -215,7 +214,7 @@ public final class IdentifiedObjects extends Static {
}
} else {
if (identifier != null) {
- if (identifierMatches(authority, identifier.getAuthority())) {
+ if (Citations.identifierMatches(authority, identifier.getAuthority())) {
final String name = identifier.getCode();
if (name != null) {
if (addTo == null) {
@@ -226,12 +225,12 @@ public final class IdentifiedObjects extends Static {
}
}
final Iterator<GenericName> it = iterator(object.getAlias());
- if (it != null) while (it.hasNext()) {
+ while (it.hasNext()) {
final GenericName alias = it.next();
if (alias != null) {
if (alias instanceof Identifier) {
identifier = (Identifier) alias;
- if (identifierMatches(authority, identifier.getAuthority())) {
+ if (Citations.identifierMatches(authority, identifier.getAuthority())) {
final String name = identifier.getCode();
if (name != null) {
if (addTo == null) {
@@ -245,7 +244,7 @@ public final class IdentifiedObjects extends Static {
if (ns != null) {
final GenericName scope = ns.name();
if (scope != null) {
- if (identifierMatches(authority, null, scope.toString())) {
+ if (Citations.identifierMatches(authority, scope.toString())) {
final String name = alias.toString();
if (name != null) {
if (addTo == null) {
@@ -281,10 +280,10 @@ public final class IdentifiedObjects extends Static {
public static Identifier getIdentifier(final IdentifiedObject object, final Citation authority) {
if (object != null) {
final Iterator<? extends Identifier> it = iterator(object.getIdentifiers());
- if (it != null) while (it.hasNext()) {
+ while (it.hasNext()) {
final Identifier identifier = it.next();
if (identifier != null) { // Paranoiac check.
- if (authority == null || identifierMatches(authority, identifier.getAuthority())) {
+ if (authority == null || Citations.identifierMatches(authority, identifier.getAuthority())) {
return identifier;
}
}
@@ -317,7 +316,7 @@ public final class IdentifiedObjects extends Static {
public static String getIdentifierOrName(final IdentifiedObject object) {
if (object != null) {
final Iterator<? extends Identifier> it = iterator(object.getIdentifiers());
- if (it != null) while (it.hasNext()) {
+ while (it.hasNext()) {
final String code = toString(it.next());
if (code != null) { // Paranoiac check.
return code;
@@ -361,7 +360,7 @@ public final class IdentifiedObjects extends Static {
}
}
final Iterator<GenericName> it = iterator(object.getAlias());
- if (it != null) while (it.hasNext()) {
+ while (it.hasNext()) {
GenericName alias = it.next();
if (alias != null && (alias = alias.tip()) != null) {
final String code = alias.toString();
@@ -371,7 +370,7 @@ public final class IdentifiedObjects extends Static {
}
}
final Iterator<? extends Identifier> id = iterator(object.getIdentifiers());
- if (id != null) while (id.hasNext()) {
+ while (id.hasNext()) {
identifier = id.next();
if (identifier != null) { // Paranoiac check.
final String code = identifier.getCode();
@@ -733,7 +732,7 @@ public final class IdentifiedObjects extends Static {
}
String cs = identifier.getCodeSpace();
if (cs == null || cs.isEmpty()) {
- cs = org.apache.sis.internal.util.Citations.getIdentifier(identifier.getAuthority(), true);
+ cs = Identifiers.getIdentifier(identifier.getAuthority(), true);
}
return NameMeaning.toURN(type, cs, identifier.getVersion(), identifier.getCode());
}
@@ -777,7 +776,7 @@ public final class IdentifiedObjects extends Static {
cs = Citations.toCodeSpace(identifier.getAuthority());
}
if (cs != null) {
- return cs + DefaultNameSpace.DEFAULT_SEPARATOR + code;
+ return cs + Constants.DEFAULT_SEPARATOR + code;
}
return code;
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
index 1763448..38ba50e 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
@@ -34,6 +34,7 @@ import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.util.iso.Types;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.internal.metadata.Identifiers;
import org.apache.sis.internal.metadata.NameToIdentifier;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.metadata.iso.citation.Citations;
@@ -426,7 +427,7 @@ public class AbstractDatum extends AbstractIdentifiedObject implements Datum {
* and parameters. We extend this rule to datum as well.
*/
final Datum that = (Datum) object;
- final Boolean match = org.apache.sis.internal.util.Citations.hasCommonIdentifier(getIdentifiers(), that.getIdentifiers());
+ final Boolean match = Identifiers.hasCommonIdentifier(getIdentifiers(), that.getIdentifiers());
if (match != null) {
return match;
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/AuthorityFactoryIdentifier.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/AuthorityFactoryIdentifier.java
index 7c7ee5e..60eba6d 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/AuthorityFactoryIdentifier.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/AuthorityFactoryIdentifier.java
@@ -27,10 +27,10 @@ import org.opengis.referencing.crs.CRSAuthorityFactory;
import org.opengis.referencing.datum.DatumAuthorityFactory;
import org.opengis.referencing.operation.CoordinateOperationAuthorityFactory;
import org.apache.sis.util.Classes;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.metadata.NameMeaning;
import org.apache.sis.internal.referencing.Resources;
@@ -292,9 +292,9 @@ final class AuthorityFactoryIdentifier {
@Override
public String toString() {
final StringBuilder buffer = new StringBuilder();
- buffer.append(Classes.getShortName(TYPES[type])).append(DefaultNameSpace.DEFAULT_SEPARATOR).append(authority);
+ buffer.append(Classes.getShortName(TYPES[type])).append(Constants.DEFAULT_SEPARATOR).append(authority);
if (version != null) {
- buffer.append(DefaultNameSpace.DEFAULT_SEPARATOR).append(version);
+ buffer.append(Constants.DEFAULT_SEPARATOR).append(version);
}
return buffer.toString();
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
index baddac0..01b001f 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
@@ -58,7 +58,6 @@ import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.iso.SimpleInternationalString;
@@ -309,7 +308,7 @@ public class CommonAuthorityFactory extends GeodeticAuthorityFactory implements
*/
private static int skipNamespace(final String code) throws NoSuchAuthorityCodeException {
int isLegacy = 0;
- int s = code.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR);
+ int s = code.indexOf(Constants.DEFAULT_SEPARATOR);
if (s >= 0) {
final int end = CharSequences.skipTrailingWhitespaces(code, 0, s);
final int start = CharSequences.skipLeadingWhitespaces (code, 0, end);
@@ -390,7 +389,7 @@ public class CommonAuthorityFactory extends GeodeticAuthorityFactory implements
* Formats the given code with a {@code "CRS:"} or {@code "AUTO2:"} prefix.
*/
private static String format(final int code) {
- return ((code >= FIRST_PROJECTION_CODE) ? AUTO2 : Constants.CRS) + DefaultNameSpace.DEFAULT_SEPARATOR + code;
+ return ((code >= FIRST_PROJECTION_CODE) ? AUTO2 : Constants.CRS) + Constants.DEFAULT_SEPARATOR + code;
}
/**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
index 19c2e1a..5422ff4 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
@@ -30,11 +30,11 @@ import org.opengis.metadata.citation.Citation;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.util.FactoryException;
import org.opengis.util.InternationalString;
-import org.apache.sis.internal.util.Citations;
+import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.referencing.AbstractIdentifiedObject;
import org.apache.sis.util.iso.SimpleInternationalString;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.iso.AbstractFactory;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.CharSequences;
@@ -138,7 +138,7 @@ public abstract class GeodeticAuthorityFactory extends AbstractFactory implement
* @return the namespaces recognized by this factory, or an empty set if none.
*/
public Set<String> getCodeSpaces() {
- final String authority = org.apache.sis.metadata.iso.citation.Citations.toCodeSpace(getAuthority());
+ final String authority = Citations.toCodeSpace(getAuthority());
return (authority != null) ? Collections.singleton(authority) : Collections.emptySet();
}
@@ -1241,13 +1241,13 @@ public abstract class GeodeticAuthorityFactory extends AbstractFactory implement
* @since 0.8
*/
protected final String trimNamespace(final String code) {
- int s = code.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR);
+ int s = code.indexOf(Constants.DEFAULT_SEPARATOR);
if (s >= 0) {
final int end = CharSequences.skipTrailingWhitespaces(code, 0, s);
final int start = CharSequences.skipLeadingWhitespaces (code, 0, end);
for (final String codespace : getCodeSpaces()) {
if (regionMatches(codespace, code, start, end)) {
- final int n = code.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR, s + 1);
+ final int n = code.indexOf(Constants.DEFAULT_SEPARATOR, s + 1);
if (n >= 0) {
/*
* The separator sometime appears twice, as in "EPSG::4326" or "EPSG:8.9:4326".
@@ -1293,7 +1293,7 @@ public abstract class GeodeticAuthorityFactory extends AbstractFactory implement
final Identifier id = object.getName();
final Citation authority = (id != null) ? id.getAuthority() : getAuthority();
throw new NoSuchAuthorityCodeException(Errors.format(Errors.Keys.UnexpectedTypeForReference_3, code, type, actual),
- Citations.getIdentifier(authority, false), trimNamespace(code), code);
+ Citations.getIdentifier(authority), trimNamespace(code), code);
}
/**
@@ -1305,7 +1305,7 @@ public abstract class GeodeticAuthorityFactory extends AbstractFactory implement
@Override
public String toString() {
final StringBuilder buffer = new StringBuilder(Classes.getShortClassName(this))
- .append("[“").append(Citations.getIdentifier(getAuthority(), false)).append('”');
+ .append("[“").append(Citations.getIdentifier(getAuthority())).append('”');
appendStringTo(buffer);
return buffer.append(']').toString();
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
index 07602e9..d7e603b 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
@@ -29,9 +29,9 @@ import org.opengis.referencing.AuthorityFactory;
import org.opengis.referencing.NoSuchAuthorityCodeException;
import org.apache.sis.referencing.AbstractIdentifiedObject;
import org.apache.sis.referencing.IdentifiedObjects;
+import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.util.collection.BackingStoreException;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.ComparisonMode;
@@ -404,7 +404,7 @@ public class IdentifiedObjectFinder {
* because calling factory.getAuthorityCodes() or factory.getCodeSpaces() may be costly for
* some implementations.
*/
- if (code.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR) >= 0) {
+ if (code.indexOf(Constants.DEFAULT_SEPARATOR) >= 0) {
final IdentifiedObject candidate;
try {
candidate = create(code);
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
index e19fe4c..2252d85 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
@@ -46,6 +46,7 @@ import org.opengis.parameter.ParameterDescriptor;
import org.opengis.util.FactoryException;
import org.opengis.util.InternationalString;
import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.AbstractIterator;
import org.apache.sis.internal.util.DefinitionURI;
import org.apache.sis.internal.util.CollectionsExt;
@@ -62,7 +63,6 @@ import org.apache.sis.util.CharSequences;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.collection.BackingStoreException;
@@ -365,8 +365,8 @@ public class MultiAuthoritiesFactory extends GeodeticAuthorityFactory implements
/** Returns the next element, with namespace inserted before the code if needed. */
@Override public String next() {
String code = super.next();
- if (prefix != null && code.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR) < 0) {
- code = prefix + DefaultNameSpace.DEFAULT_SEPARATOR + code;
+ if (prefix != null && code.indexOf(Constants.DEFAULT_SEPARATOR) < 0) {
+ code = prefix + Constants.DEFAULT_SEPARATOR + code;
}
return code;
}
@@ -814,7 +814,7 @@ public class MultiAuthoritiesFactory extends GeodeticAuthorityFactory implements
* an exception will be thrown. Note that the CharSequences.skipLeading/TrailingWhitespaces(…)
* methods are robust to negative index, so the code will work even if code.indexOf(…) returned -1.
*/
- int afterAuthority = code.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR);
+ int afterAuthority = code.indexOf(Constants.DEFAULT_SEPARATOR);
int end = CharSequences.skipTrailingWhitespaces(code, 0, afterAuthority);
int start = CharSequences.skipLeadingWhitespaces(code, 0, end);
if (start >= end) {
@@ -827,7 +827,7 @@ public class MultiAuthoritiesFactory extends GeodeticAuthorityFactory implements
* equals to an empty string or to the "0" string, it will be considered as no version. Usage of 0 as
* a pseudo-version is a practice commonly found in other software products.
*/
- int afterVersion = code.indexOf(DefaultNameSpace.DEFAULT_SEPARATOR, ++afterAuthority);
+ int afterVersion = code.indexOf(Constants.DEFAULT_SEPARATOR, ++afterAuthority);
start = CharSequences.skipLeadingWhitespaces(code, afterAuthority, afterVersion);
end = CharSequences.skipTrailingWhitespaces(code, start, afterVersion);
version = (start < end && !code.regionMatches(start, DefinitionURI.NO_VERSION, 0,
@@ -850,7 +850,7 @@ public class MultiAuthoritiesFactory extends GeodeticAuthorityFactory implements
*/
if (parameters != null || code.indexOf(CommonAuthorityFactory.SEPARATOR) >= 0) {
final StringBuilder buffer = new StringBuilder(authority.length() + code.length() + 1)
- .append(authority).append(DefaultNameSpace.DEFAULT_SEPARATOR).append(code);
+ .append(authority).append(Constants.DEFAULT_SEPARATOR).append(code);
if (parameters != null) {
for (final String p : parameters) {
buffer.append(CommonAuthorityFactory.SEPARATOR).append(p);
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
index 51b74f5..e5f34e4 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
@@ -102,7 +102,6 @@ import org.apache.sis.referencing.factory.FactoryDataException;
import org.apache.sis.referencing.factory.GeodeticAuthorityFactory;
import org.apache.sis.referencing.factory.IdentifiedObjectFinder;
import org.apache.sis.util.iso.SimpleInternationalString;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.logging.Logging;
@@ -1067,7 +1066,7 @@ codes: for (int i=0; i<codes.length; i++) {
}
if (!quiet) {
LogRecord record = Resources.forLocale(locale).getLogRecord(Level.WARNING, Resources.Keys.DeprecatedCode_3,
- Constants.EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + code, replacedBy, reason);
+ Constants.EPSG + Constants.DEFAULT_SEPARATOR + code, replacedBy, reason);
record.setLoggerName(Loggers.CRS_FACTORY);
Logging.log(EPSGDataAccess.class, method, record);
}
@@ -1936,7 +1935,7 @@ codes: for (int i=0; i<codes.length; i++) {
// Both 'inverseFlattening' and 'semiMinorAxis' are defined.
// Log a warning and create the ellipsoid using the inverse flattening.
final LogRecord record = resources().getLogRecord(Level.WARNING,
- Resources.Keys.AmbiguousEllipsoid_1, Constants.EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + code);
+ Resources.Keys.AmbiguousEllipsoid_1, Constants.EPSG + Constants.DEFAULT_SEPARATOR + code);
record.setLoggerName(Loggers.CRS_FACTORY);
Logging.log(EPSGDataAccess.class, "createEllipsoid", record);
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
index d4cf24c..b36588c 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
@@ -44,12 +44,12 @@ import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.iso.SimpleInternationalString;
-import org.apache.sis.internal.util.Citations;
import org.apache.sis.internal.referencing.WKTKeywords;
import org.apache.sis.internal.jaxb.gco.StringAdapter;
import org.apache.sis.internal.jaxb.referencing.CC_OperationMethod;
import org.apache.sis.internal.referencing.NilReferencingObject;
import org.apache.sis.internal.referencing.Resources;
+import org.apache.sis.internal.metadata.Identifiers;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.parameter.DefaultParameterDescriptorGroup;
import org.apache.sis.parameter.Parameterized;
@@ -653,7 +653,7 @@ public class DefaultOperationMethod extends AbstractIdentifiedObject implements
* and parameters.
*/
final OperationMethod that = (OperationMethod) object;
- final Boolean match = Citations.hasCommonIdentifier(getIdentifiers(), that.getIdentifiers());
+ final Boolean match = Identifiers.hasCommonIdentifier(getIdentifiers(), that.getIdentifiers());
if (match != null) {
if (!match) {
return false;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java b/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
index 007a2e3..b4f61f0 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
@@ -44,7 +44,6 @@ import org.apache.sis.geometry.GeneralDirectPosition;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.operation.transform.LinearTransform;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.internal.util.Constants;
import static java.lang.StrictMath.*;
@@ -93,7 +92,7 @@ public strictfp class ReferencingAssert extends MetadataAssert {
assertEquals("code", expected, actual.getCode());
assertEquals("codeSpace", Constants.OGC, actual.getCodeSpace());
assertSame ("authority", Citations.OGC, actual.getAuthority());
- assertEquals("identifier", Constants.OGC + DefaultNameSpace.DEFAULT_SEPARATOR + expected,
+ assertEquals("identifier", Constants.OGC + Constants.DEFAULT_SEPARATOR + expected,
IdentifiedObjects.toString(actual));
}
@@ -111,7 +110,7 @@ public strictfp class ReferencingAssert extends MetadataAssert {
assertEquals("code", expected, actual.getCode());
assertEquals("codeSpace", Constants.EPSG, actual.getCodeSpace());
assertEquals("authority", Constants.EPSG, Citations.toCodeSpace(actual.getAuthority()));
- assertEquals("identifier", Constants.EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + expected,
+ assertEquals("identifier", Constants.EPSG + Constants.DEFAULT_SEPARATOR + expected,
IdentifiedObjects.toString(actual));
}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
deleted file mode 100644
index b756bd9..0000000
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- * 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.internal.util;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Objects;
-import org.opengis.metadata.Identifier;
-import org.opengis.metadata.citation.Citation;
-import org.opengis.util.InternationalString;
-import org.apache.sis.util.CharSequences;
-import org.apache.sis.util.Characters;
-import org.apache.sis.util.Deprecable;
-import org.apache.sis.util.Static;
-
-
-/**
- * Utility methods working on {@link Citation} objects. The public facade of those methods is
- * defined in the {@link org.apache.sis.metadata.iso.citation.Citations} class, but the actual
- * implementation is defined here since it is needed by some utility methods.
- *
- * @author Martin Desruisseaux (Geomatys)
- * @version 1.0
- * @since 0.3
- * @module
- */
-public final class Citations extends Static {
- /**
- * Do not allows instantiation of this class.
- */
- private Citations() {
- }
-
- /**
- * The default separator, which is {@code ':'}. The separator is inserted between
- * the code space and the code in identifiers.
- *
- * @see org.apache.sis.util.iso.DefaultNameSpace#DEFAULT_SEPARATOR
- */
- public static final char DEFAULT_SEPARATOR = ':';
-
- /**
- * Returns {@code true} if the given code is {@code "EPSG"} while the codespace is {@code "IOGP"} or {@code "OGP"}
- * (ignoring case). This particular combination of code and codespace is handled in a special way.
- *
- * <p>This method can be used for identifying where in Apache SIS source code the relationship between
- * EPSG authority and IOGP code space is hard-coded.</p>
- *
- * @param codeSpace the identifier code space, or {@code null}.
- * @param code the identifier code, or {@code null}.
- * @return {@code true} if the given identifier is {@code "IOGP:EPSG"}.
- *
- * @see org.apache.sis.metadata.iso.citation.Citations#EPSG
- */
- public static boolean isEPSG(final String codeSpace, final String code) {
- return Constants.EPSG.equalsIgnoreCase(code) &&
- (Constants.IOGP.equalsIgnoreCase(codeSpace) || "OGP".equalsIgnoreCase(codeSpace) ||
- Constants.EPSG.equalsIgnoreCase(codeSpace));
- // "OGP" is a legacy abbreviation that existed before "IOGP".
- }
-
- /**
- * Returns the collection iterator, or {@code null} if the given collection is null
- * or empty. We use this method as a paranoiac safety against broken implementations.
- *
- * @param <E> the type of elements in the collection.
- * @param collection the collection from which to get the iterator, or {@code null}.
- * @return the iterator over the given collection elements, or {@code null}.
- */
- public static <E> Iterator<E> iterator(final Collection<E> collection) {
- return (collection != null && !collection.isEmpty()) ? collection.iterator() : null;
- }
-
- /**
- * Return {@code true} if the given object is deprecated.
- */
- private static boolean isDeprecated(final Object object) {
- return (object instanceof Deprecable) && ((Deprecable) object).isDeprecated();
- }
-
- /**
- * Returns a "unlocalized" string representation of the given international string, or {@code null} if none
- * or if the string is deprecated. This method is used by {@link #getIdentifier(Citation, boolean)}, which
- * is why we don't want the localized string.
- */
- private static String toString(final InternationalString title) {
- return (title != null && !isDeprecated(title))
- ? CharSequences.trimWhitespaces(title.toString(Locale.ROOT)) : null;
- }
-
- /**
- * The method to be used consistently for comparing titles or identifiers in all {@code fooMathes(…)}
- * methods declared in this class.
- *
- * @param s1 the first characters sequence to compare, or {@code null}.
- * @param s2 the second characters sequence to compare, or {@code null}.
- * @return {@code true} if both arguments are {@code null} or if the two given texts are equal,
- * ignoring case and any characters other than digits and letters.
- *
- * @since 0.6
- */
- public static boolean equalsFiltered(final CharSequence s1, final CharSequence s2) {
- return CharSequences.equalsFiltered(s1, s2, Characters.Filter.LETTERS_AND_DIGITS, true);
- }
-
- /**
- * Returns {@code true} if the two citations have at least one title in common,
- * ignoring case and non-alphanumeric characters.
- * See {@link org.apache.sis.metadata.iso.citation.Citations#titleMatches(Citation, Citation)}
- * for the public documentation of this method.
- *
- * @param c1 the first citation to compare, or {@code null}.
- * @param c2 the second citation to compare, or {@code null}.
- * @return {@code true} if both arguments are non-null, and at least one title or alternate title matches.
- */
- public static boolean titleMatches(final Citation c1, final Citation c2) {
- if (c1 != null && c2 != null) {
- if (c1 == c2) {
- return true; // Optimisation for a common case.
- }
- InternationalString candidate = c2.getTitle();
- Iterator<? extends InternationalString> iterator = null;
- do {
- if (candidate != null) {
- final String unlocalized = candidate.toString(Locale.ROOT);
- if (titleMatches(c1, unlocalized)) {
- return true;
- }
- final String localized = candidate.toString();
- if (!Objects.equals(localized, unlocalized) // Slight optimization for a common case.
- && titleMatches(c1, localized))
- {
- return true;
- }
- }
- if (iterator == null) {
- iterator = iterator(c2.getAlternateTitles());
- if (iterator == null) break;
- }
- if (!iterator.hasNext()) break;
- candidate = iterator.next();
- } while (true);
- }
- return false;
- }
-
- /**
- * Returns {@code true} if the given citation has at least one title equals to the given string,
- * ignoring case and non-alphanumeric characters.
- * See {@link org.apache.sis.metadata.iso.citation.Citations#titleMatches(Citation, String)}
- * for the public documentation of this method.
- *
- * @param citation the citation to check for, or {@code null}.
- * @param title the title or alternate title to compare, or {@code null}.
- * @return {@code true} if both arguments are non-null, and the title or an alternate
- * title matches the given string.
- */
- public static boolean titleMatches(final Citation citation, final CharSequence title) {
- if (citation != null && title != null) {
- InternationalString candidate = citation.getTitle();
- Iterator<? extends InternationalString> iterator = null;
- do {
- if (candidate != null) {
- final String unlocalized = candidate.toString(Locale.ROOT);
- if (equalsFiltered(unlocalized, title)) {
- return true;
- }
- final String localized = candidate.toString();
- if (!Objects.equals(localized, unlocalized) // Slight optimization for a common case.
- && equalsFiltered(localized, title))
- {
- return true;
- }
- }
- if (iterator == null) {
- iterator = iterator(citation.getAlternateTitles());
- if (iterator == null) break;
- }
- if (!iterator.hasNext()) break;
- candidate = iterator.next();
- } while (true);
- }
- return false;
- }
-
- /**
- * Returns {@code true} if the two citations have at least one identifier in common,
- * ignoring case and non-alphanumeric characters. If and <em>only</em> if the citations
- * do not contain any identifier, then this method fallback on titles comparison.
- * See {@link org.apache.sis.metadata.iso.citation.Citations#identifierMatches(Citation, Citation)}
- * for the public documentation of this method.
- *
- * @param c1 the first citation to compare, or {@code null}.
- * @param c2 the second citation to compare, or {@code null}.
- * @return {@code true} if both arguments are non-null, and at least one identifier matches.
- */
- public static boolean identifierMatches(Citation c1, Citation c2) {
- if (c1 != null && c2 != null) {
- if (c1 == c2) {
- return true; // Optimisation for a common case.
- }
- /*
- * If there is no identifier in both citations, fallback on title comparisons.
- * If there is identifiers in only one citation, make sure that this citation
- * is the second one (c2) in order to allow at least one call to
- * 'identifierMatches(c1, String)'.
- */
- Iterator<? extends Identifier> iterator = iterator(c2.getIdentifiers());
- if (iterator == null) {
- iterator = iterator(c1.getIdentifiers());
- if (iterator == null) {
- return titleMatches(c1, c2);
- }
- c1 = c2;
- }
- do {
- final Identifier id = iterator.next();
- if (id != null && identifierMatches(c1, id, id.getCode())) {
- return true;
- }
- } while (iterator.hasNext());
- }
- return false;
- }
-
- /**
- * Returns {@code true} if the given citation has at least one identifier equals to the given string,
- * ignoring case and non-alphanumeric characters. If and <em>only</em> if the citation does not contain
- * any identifier, then this method fallback on titles comparison.
- * See {@link org.apache.sis.metadata.iso.citation.Citations#identifierMatches(Citation, String)}
- * for the public documentation of this method.
- *
- * @param citation the citation to check for, or {@code null}.
- * @param identifier the identifier to compare, or {@code null} if unknown.
- * @param code value of {@code identifier.getCode()}, or {@code null}.
- * @return {@code true} if both arguments are non-null, and an identifier matches the given string.
- */
- public static boolean identifierMatches(final Citation citation, final Identifier identifier, final CharSequence code) {
- if (citation != null && code != null) {
- final Collection<? extends Identifier> citIds = citation.getIdentifiers();
- Iterator<? extends Identifier> it = iterator(citIds);
- if (it == null) {
- return titleMatches(citation, code);
- }
- while (it.hasNext()) {
- final Identifier citId = it.next();
- if (citId != null && equalsFiltered(code, citId.getCode())) {
- /*
- * Found a possible match. We will take the code space in account only if it is defined
- * by both identifiers. If a code space is undefined, we consider that we have a match.
- */
- if (identifier != null) {
- final String codeSpace = identifier.getCodeSpace();
- if (codeSpace != null) {
- final String cs = citId.getCodeSpace();
- if (cs != null && !equalsFiltered(codeSpace, cs)) {
- continue; // Check other identifiers.
- }
- }
- }
- return true;
- }
- }
- /*
- * Before to give up, maybe the given code argument is actually written using a "codeSpace:code" syntax.
- * Try to parse that syntax only if no Identifier argument were specified (otherwise we require the code
- * and code space to be splitted as defined in the identifier).
- */
- if (identifier == null) {
- int s = 0;
- final int length = code.length();
- while ((s = CharSequences.indexOf(code, DEFAULT_SEPARATOR, s, length)) >= 0) {
- final CharSequence codeSpace = code.subSequence(0, s);
- final CharSequence localPart = code.subSequence(++s, length);
- for (it = citIds.iterator(); it.hasNext();) {
- final Identifier id = it.next();
- if (equalsFiltered(codeSpace, id.getCodeSpace()) && equalsFiltered(localPart, id.getCode())) {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Returns {@code true} if the given identifier authority matches the given {@code authority}.
- * If one of the authority is null, then the comparison fallback on the given {@code codeSpace}.
- * If the code spaces are also null, then this method conservatively returns {@code false}.
- *
- * @param identifier the identifier to compare.
- * @param authority the desired authority, or {@code null}.
- * @param codeSpace the desired code space or {@code null}, used as a fallback if an authority is null.
- * @return {@code true} if the authority or code space (as a fallback only) matches.
- */
- private static boolean authorityMatches(final Identifier identifier, final Citation authority, final String codeSpace) {
- if (authority != null) {
- final Citation other = identifier.getAuthority();
- if (other != null) {
- return identifierMatches(authority, other);
- }
- }
- if (codeSpace != null) {
- final String other = identifier.getCodeSpace();
- if (other != null) {
- return CharSequences.equalsFiltered(codeSpace, other, Characters.Filter.UNICODE_IDENTIFIER, true);
- }
- }
- return false;
- }
-
- /**
- * Determines whether a match or mismatch is found between the two given collections of identifiers.
- * If any of the given collections is {@code null} or empty, then this method returns {@code null}.
- *
- * <p>According ISO 19162 (<cite>Well known text representation of coordinate reference systems</cite>),
- * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getIdentifiers() identifiers} should have precedence over
- * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getName() name} for identifying {@code IdentifiedObject}s,
- * at least in the case of {@linkplain org.apache.sis.referencing.operation.DefaultOperationMethod operation methods} and
- * {@linkplain org.apache.sis.parameter.AbstractParameterDescriptor parameters}.</p>
- *
- * @param id1 the first collection of identifiers, or {@code null}.
- * @param id2 the second collection of identifiers, or {@code null}.
- * @return {@code TRUE} or {@code FALSE} on match or mismatch respectively, or {@code null} if this method
- * can not determine if there is a match or mismatch.
- */
- public static Boolean hasCommonIdentifier(final Iterable<? extends Identifier> id1,
- final Iterable<? extends Identifier> id2)
- {
- if (id1 != null && id2 != null) {
- boolean hasFound = false;
- for (final Identifier identifier : id1) {
- final Citation authority = identifier.getAuthority();
- final String codeSpace = identifier.getCodeSpace();
- for (final Identifier other : id2) {
- if (authorityMatches(identifier, authority, codeSpace)) {
- if (CharSequences.equalsFiltered(identifier.getCode(), other.getCode(), Characters.Filter.UNICODE_IDENTIFIER, true)) {
- return Boolean.TRUE;
- }
- hasFound = true;
- }
- }
- }
- if (hasFound) {
- return Boolean.FALSE;
- }
- }
- return null;
- }
-
- /**
- * Infers an identifier from the given citation, or returns {@code null} if no identifier has been found.
- * This method removes leading and trailing {@linkplain Character#isWhitespace(int) whitespaces}.
- * See {@link org.apache.sis.metadata.iso.citation.Citations#getIdentifier(Citation)}
- * for the public documentation of this method.
- *
- * <p><b>Which method to use:</b></p>
- * <ul>
- * <li>For information purpose (e.g. some {@code toString()} methods), use {@code getIdentifier(…, false)}.</li>
- * <li>For WKT formatting, use {@code getIdentifier(…, true)} in order to preserve formatting characters.</li>
- * <li>For assigning a value to a {@code codeSpace} field, use
- * {@link org.apache.sis.metadata.iso.citation.Citations#getUnicodeIdentifier(Citation)}.</li>
- * </ul>
- *
- * Use {@code getUnicodeIdentifier(…)} method when assigning values to be returned by methods like
- * {@link Identifier#getCodeSpace()}, since those values are likely to be compared without special
- * care about ignorable identifier characters. But if the intent is to format a more complex string
- * like WKT or {@code toString()}, then we suggest to use {@code getIdentifier(citation, true)} instead,
- * which will produce the same result but preserving the ignorable characters, which can be useful
- * for formatting purpose.
- *
- * @param citation the citation for which to get the identifier, or {@code null}.
- * @param strict {@code true} for returning a non-null value only if the identifier is a valid Unicode identifier.
- * @return a non-empty identifier for the given citation without leading or trailing whitespaces,
- * or {@code null} if the given citation is null or does not declare any identifier or title.
- *
- * @see <a href="https://issues.apache.org/jira/browse/SIS-201">SIS-201</a>
- */
- public static String getIdentifier(final Citation citation, final boolean strict) {
- if (citation != null) {
- boolean isUnicode = false; // Whether 'identifier' is a Unicode identifier.
- String identifier = null; // The best identifier found so far.
- String codeSpace = null; // Code space of the identifier, or null if none.
- final Iterator<? extends Identifier> it = iterator(citation.getIdentifiers());
- if (it != null) while (it.hasNext()) {
- final Identifier id = it.next();
- if (id != null && !isDeprecated(id)) {
- final String candidate = CharSequences.trimWhitespaces(id.getCode());
- if (candidate != null && !candidate.isEmpty()) {
- /*
- * For a non-empty identifier, verify if both the code and its codespace are valid
- * Unicode identifiers. If a codespace exists, then the code does not need to begin
- * with a "Unicode identifier start" (it may be a "Unicode identifier part").
- */
- String cs = CharSequences.trimWhitespaces(id.getCodeSpace());
- if (cs == null || cs.isEmpty()) {
- cs = null;
- isUnicode = CharSequences.isUnicodeIdentifier(candidate);
- } else {
- isUnicode = CharSequences.isUnicodeIdentifier(cs);
- if (isUnicode) for (int i = 0; i < candidate.length();) {
- final int c = candidate.codePointAt(i);
- if (!Character.isUnicodeIdentifierPart(c) &&
- (strict || (c != '.' && c != '-')))
- {
- /*
- * Above special case for '.' and '-' characters is documented
- * in the public Citations.getIdentifier(Citation) method.
- */
- isUnicode = false;
- break;
- }
- i += Character.charCount(c);
- }
- }
- /*
- * If we found a Unicode identifier, we are done and we can exit the loop.
- * Otherwise retain the first identifier and continue the search for Unicode identifier.
- */
- if (identifier == null || isUnicode) {
- identifier = candidate;
- codeSpace = cs;
- if (isUnicode) break;
- }
- }
- }
- }
- /*
- * If no identifier has been found, fallback on the first title or alternate title.
- * We search for alternate titles because ISO specification said that those titles
- * are often used for abbreviations. Again we give preference to Unicode identifiers,
- * which are typically alternate titles.
- */
- if (identifier == null) {
- identifier = toString(citation.getTitle()); // Whitepaces removed by toString(…).
- if (identifier != null) {
- if (identifier.isEmpty()) {
- identifier = null;
- } else {
- isUnicode = CharSequences.isUnicodeIdentifier(identifier);
- }
- }
- if (!isUnicode) {
- final Iterator<? extends InternationalString> iterator = iterator(citation.getAlternateTitles());
- if (iterator != null) while (iterator.hasNext()) {
- final String candidate = toString(iterator.next());
- if (candidate != null && !candidate.isEmpty()) {
- isUnicode = CharSequences.isUnicodeIdentifier(candidate);
- if (identifier == null || isUnicode) {
- identifier = candidate;
- if (isUnicode) break;
- }
- }
- }
- }
- }
- /*
- * Finished searching in the identifiers, title and alternate titles. If the identifier that
- * we found is not a valid Unicode identifier, we will return it only if the caller did not
- * asked for strictly valid Unicode identifier.
- */
- if (isUnicode || !strict) {
- if (codeSpace != null && !isEPSG(codeSpace, identifier)) {
- return codeSpace + (strict ? '_' : DEFAULT_SEPARATOR) + identifier;
- } else {
- return identifier;
- }
- }
- }
- return null;
- }
-
- /**
- * Removes characters that are ignorable according Unicode specification.
- *
- * @param identifier the character sequence from which to remove ignorable characters, or {@code null}.
- * @return a character sequence with ignorable character removed. May be the same instance than the given argument.
- */
- public static String removeIgnorableCharacters(final String identifier) {
- if (identifier != null) {
- /*
- * First perform a quick check to see if there is any ignorable characters.
- * We make this check because those characters are valid according Unicode
- * but not according XML. However there is usually no such characters, so
- * we will avoid the StringBuilder creation in the vast majority of times.
- *
- * Note that 'µ' and its friends are not ignorable, so we do not remove them.
- * This method is aimed for "getUnicodeIdentifier", not "getXmlIdentifier".
- */
- final int length = identifier.length();
- for (int i=0; i<length;) {
- int c = identifier.codePointAt(i);
- int n = Character.charCount(c);
- if (Character.isIdentifierIgnorable(c)) {
- /*
- * Found an ignorable character. Create the buffer and copy non-ignorable characters.
- * Following algorithm is inefficient, since we fill the buffer character-by-character
- * (a more efficient approach would be to perform bulk appends). However we presume
- * that this block will be rarely executed, so it is not worth to optimize it.
- */
- final StringBuilder buffer = new StringBuilder(length - n).append(identifier, 0, i);
- while ((i += n) < length) {
- c = identifier.codePointAt(i);
- n = Character.charCount(c);
- if (!Character.isIdentifierIgnorable(c)) {
- buffer.appendCodePoint(c);
- }
- }
- /*
- * No need to verify if the buffer is empty, because ignorable
- * characters are not legal Unicode identifier start.
- */
- return buffer.toString();
- }
- i += n;
- }
- }
- return identifier;
- }
-}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
index 1738251..04fc7b2 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
@@ -123,6 +123,28 @@ public final class CollectionsExt extends Static {
}
/**
+ * Returns the collection iterator, or {@code null} if the given collection is null or empty.
+ *
+ * @param <E> the type of elements in the collection.
+ * @param collection the collection from which to get the iterator, or {@code null}.
+ * @return the iterator over the given collection elements, or {@code null}.
+ */
+ public static <E> Iterator<E> nonEmptyIterator(final Collection<E> collection) {
+ return (collection != null && !collection.isEmpty()) ? collection.iterator() : null;
+ }
+
+ /**
+ * Returns the collection iterator. This is a null-safe method used as a safety against broken implementations.
+ *
+ * @param <E> the type of elements in the collection.
+ * @param collection the collection from which to get the iterator, or {@code null}.
+ * @return the iterator over the given collection elements, never {@code null}.
+ */
+ public static <E> Iterator<E> iterator(final Collection<E> collection) {
+ return (collection != null) ? collection.iterator() : Collections.emptyIterator();
+ }
+
+ /**
* Returns the first element of the given iterable, or {@code null} if none.
* This method does not emit warning if more than one element is found.
* Consequently, this method should be used only when multi-occurrence is not ambiguous.
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
index 4f78385..dd31509 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
@@ -37,6 +37,14 @@ import org.apache.sis.util.Static;
*/
public final class Constants extends Static {
/**
+ * The default separator, which is {@code ':'}.
+ * The separator is inserted between the code space and the code in identifiers.
+ *
+ * @see org.apache.sis.util.iso.DefaultNameSpace#DEFAULT_SEPARATOR
+ */
+ public static final char DEFAULT_SEPARATOR = ':';
+
+ /**
* The default indentation value to use in various text formats (both WKT and XML).
* We use a small value (2 instead of 4) because OGC's XML are very verbose.
*
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
index 03915ae..8baeb26 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
@@ -22,6 +22,7 @@ import java.util.TimeZone;
import java.util.ResourceBundle;
import java.util.MissingResourceException;
import org.opengis.annotation.UML;
+import org.opengis.metadata.citation.Citation;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.system.OptionalDependency;
import org.apache.sis.util.CharSequences;
@@ -135,6 +136,17 @@ public class MetadataServices extends OptionalDependency {
}
/**
+ * Infers an identifier from the given citation, or returns {@code null} if no identifier has been found.
+ * This method returns a non-null value only if the identifier is a valid Unicode identifier.
+ *
+ * @param citation the citation for which to get the identifier, or {@code null}.
+ * @return a non-empty identifier without leading or trailing whitespaces, or {@code null}.
+ */
+ public String getUnicodeIdentifier(Citation citation) {
+ return null;
+ }
+
+ /**
* Returns information about the Apache SIS configuration to be reported in {@link org.apache.sis.setup.About}.
* This method is invoked only for aspects that depends on other modules than {@code sis-utility}.
*
diff --git a/core/sis-utility/src/main/java/org/apache/sis/io/IdentifiedObjectFormat.java b/core/sis-utility/src/main/java/org/apache/sis/io/IdentifiedObjectFormat.java
index db40657..cc139f7 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/io/IdentifiedObjectFormat.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/io/IdentifiedObjectFormat.java
@@ -23,8 +23,9 @@ import java.text.ParsePosition;
import org.opengis.util.GenericName;
import org.opengis.metadata.Identifier;
import org.opengis.referencing.IdentifiedObject;
-import org.apache.sis.internal.util.Citations;
import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.internal.util.Constants;
+import org.apache.sis.internal.util.MetadataServices;
/**
@@ -70,10 +71,10 @@ final class IdentifiedObjectFormat extends Format {
final String code = identifier.getCode();
String cs = identifier.getCodeSpace();
if (cs == null || cs.isEmpty()) {
- cs = Citations.getIdentifier(identifier.getAuthority(), true);
+ cs = MetadataServices.getInstance().getUnicodeIdentifier(identifier.getAuthority());
}
if (cs != null) {
- toAppendTo.append(cs).append(Citations.DEFAULT_SEPARATOR);
+ toAppendTo.append(cs).append(Constants.DEFAULT_SEPARATOR);
}
return toAppendTo.append(code);
}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java b/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java
index 0f1ec56..c8903ae 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java
@@ -35,7 +35,6 @@ import javax.measure.Dimension;
import javax.measure.Unit;
import javax.measure.format.ParserException;
import org.apache.sis.internal.system.Loggers;
-import org.apache.sis.internal.util.Citations;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.DefinitionURI;
import org.apache.sis.internal.util.FinalFieldSetter;
@@ -1134,7 +1133,7 @@ appPow: if (unit == null) {
failure = e;
}
throw (ParserException) new ParserException(Errors.format(Errors.Keys.UnknownUnit_1,
- Constants.EPSG + Citations.DEFAULT_SEPARATOR + code),
+ Constants.EPSG + Constants.DEFAULT_SEPARATOR + code),
symbols, start + Math.max(0, uom.lastIndexOf(code))).initCause(failure);
}
/*
diff --git a/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationMock.java b/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationMock.java
deleted file mode 100644
index 4a31d4a..0000000
--- a/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationMock.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.internal.util;
-
-import java.util.Date;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.opengis.metadata.Identifier;
-import org.opengis.metadata.citation.Citation;
-import org.opengis.metadata.citation.CitationDate;
-import org.opengis.metadata.citation.OnlineResource;
-import org.opengis.metadata.citation.PresentationForm;
-import org.opengis.metadata.citation.Responsibility;
-import org.opengis.metadata.citation.Series;
-import org.opengis.metadata.identification.BrowseGraphic;
-import org.opengis.util.InternationalString;
-import org.apache.sis.util.iso.SimpleInternationalString;
-
-
-/**
- * A trivial implementation of {@link Citation} containing only a title.
- * Opportunistically implements also the identifier interface.
- *
- * @author Martin Desruisseaux (Geomatys)
- * @version 1.0
- * @since 1.0
- * @module
- */
-@SuppressWarnings("ReturnOfCollectionOrArrayField")
-final strictfp class CitationMock implements Citation, Identifier {
- /**
- * The title to be returned by {@link #getTitle()}.
- */
- private final String title;
-
- /**
- * Alphanumeric value identifying an instance in the namespace.
- */
- private final String codeSpace, code;
-
- /**
- * The identifiers, built from the given code and code space by default.
- */
- List<Identifier> identifiers;
-
- /**
- * Creates a new object for the given title.
- *
- * @param title the title to be returned by {@link #getTitle()}.
- * @param code alphanumeric value identifying an instance in the namespace.
- * @param codeSpace space in which the code is valid.
- */
- @SuppressWarnings("ThisEscapedInObjectConstruction")
- public CitationMock(final String title, final String codeSpace, final String code) {
- this.title = title;
- this.codeSpace = codeSpace;
- this.code = code;
- identifiers = (code != null) ? Collections.singletonList(this) : Collections.emptyList();
- }
-
- @Override public Citation getAuthority() {return this;}
- @Override public InternationalString getTitle() {return new SimpleInternationalString(title);}
- @Override public Collection<InternationalString> getAlternateTitles() {return Collections.emptyList();}
- @Override public Collection<CitationDate> getDates() {return Collections.emptyList();}
- @Override public InternationalString getEdition() {return null;}
- @Override public Date getEditionDate() {return null;}
- @Override public Collection<Identifier> getIdentifiers() {return identifiers;}
- @Override public String getCode() {return code;}
- @Override public String getCodeSpace() {return codeSpace;}
- @Override public String getVersion() {return null;}
- @Override public InternationalString getDescription() {return null;}
- @Override public Collection<Responsibility> getCitedResponsibleParties() {return Collections.emptyList();}
- @Override public Collection<PresentationForm> getPresentationForms() {return Collections.emptyList();}
- @Override public Series getSeries() {return null;}
- @Override public Collection<InternationalString> getOtherCitationDetails() {return Collections.emptyList();}
- @Override public Collection<OnlineResource> getOnlineResources() {return Collections.emptyList();}
- @Override public Collection<BrowseGraphic> getGraphics() {return Collections.emptyList();}
- @Override public String getISBN() {return null;}
- @Override public String getISSN() {return null;}
- @Deprecated
- @Override public InternationalString getCollectiveTitle() {return null;}
-
- /**
- * Returns a string representation of this citation for debugging purpose.
- */
- @Override
- public String toString() {
- return Strings.bracket("Citation", title);
- }
-}
diff --git a/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java b/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java
deleted file mode 100644
index 30ba976..0000000
--- a/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.internal.util;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Arrays;
-import org.opengis.metadata.Identifier;
-import org.opengis.metadata.citation.Citation;
-import org.apache.sis.test.TestCase;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-
-/**
- * Tests the internal {@link Citations} class.
- *
- * @author Martin Desruisseaux (Geomatys)
- * @version 1.0
- * @since 0.6
- * @module
- */
-public final strictfp class CitationsTest extends TestCase {
- /**
- * Creates a citation with the given title and the given identifiers.
- */
- private static CitationMock citation(final String title, final Identifier... identifiers) {
- CitationMock cit = new CitationMock(title, null, null);
- cit.identifiers = Arrays.asList(identifiers);
- return cit;
- }
-
- /**
- * Creates an identifier with a code space.
- */
- private static Identifier identifier(final String codeSpace, final String code) {
- return new CitationMock(null, codeSpace, code);
- }
-
- /**
- * Tests {@link Citations#hasCommonIdentifier(Iterable, Iterable)}.
- */
- @Test
- public void testHasCommonIdentifier() {
- final List<Identifier> id1 = new ArrayList<>(3);
- final List<Identifier> id2 = new ArrayList<>(2);
- assertNull(Citations.hasCommonIdentifier(id1, id2));
- /*
- * Add codes for two Operation Methods which are implemented in Apache SIS by the same class:
- *
- * - EPSG:9804 — "Mercator (variant A)" (formerly known as "Mercator (1SP)").
- * - EPSG:1026 — "Mercator (Spherical)"
- * - GeoTIFF:7 — "CT_Mercator"
- */
- id1.add(identifier("EPSG", "9804"));
- id1.add(identifier("EPSG", "1026"));
- id1.add(identifier("GeoTIFF", "7"));
- assertNull(Citations.hasCommonIdentifier(id1, id2));
- /*
- * EPSG:9841 is a legacy (now deprecated) code for "Mercator (1SP)".
- * We could have declared it as a deprecated code in the above list,
- * but for the sake of this test we do not.
- */
- id2.add(identifier("EPSG", "9841"));
- assertEquals(Boolean.FALSE, Citations.hasCommonIdentifier(id1, id2));
- id2.add(identifier("EPSG", "9804"));
- assertEquals(Boolean.TRUE, Citations.hasCommonIdentifier(id1, id2));
- }
-
- /**
- * Tests {@link Citations#getIdentifier(Citation, boolean)}.
- */
- @Test
- public void testGetIdentifier() {
- CitationMock citation = new CitationMock(" Not an identifier ", null, null);
- assertEquals("Not an identifier", Citations.getIdentifier(citation, false));
- assertNull(Citations.getIdentifier(citation, true));
-
- citation = new CitationMock(" ValidIdentifier ", null, null);
- assertEquals("ValidIdentifier", Citations.getIdentifier(citation, false));
- assertEquals("ValidIdentifier", Citations.getIdentifier(citation, true));
- /*
- * Following test uses '-' in the first identifier, which is an invalid Unicode identifier part.
- * Consequently the identifier that we get depends on whether we ask for strict Unicode or not.
- */
- citation = citation("Web Map Server", identifier("OGC", "06-042"), identifier("ISO", "19128"));
- assertEquals("OGC:06-042", Citations.getIdentifier(citation, false));
- assertEquals("ISO_19128", Citations.getIdentifier(citation, true));
- }
-
- /**
- * Tests {@link Citations#identifierMatches(Citation, Identifier, CharSequence)}.
- */
- @Test
- public void testIdentifierMatches() {
- final Identifier ogc = identifier("OGC", "06-042");
- final Identifier iso = identifier("ISO", "19128");
- final Citation citation = citation("Web Map Server", ogc, iso, identifier("Foo", "06-042"));
- assertTrue ("With full identifier", Citations.identifierMatches(citation, ogc, ogc.getCode()));
- assertTrue ("With full identifier", Citations.identifierMatches(citation, iso, iso.getCode()));
- assertFalse("With wrong code", Citations.identifierMatches(citation, identifier("ISO", "19115"), "19115"));
- assertFalse("With wrong code space", Citations.identifierMatches(citation, identifier("Foo", "19128"), "19128"));
- assertFalse("With wrong code", Citations.identifierMatches(citation, null, "Foo"));
- assertTrue ("Without identifier", Citations.identifierMatches(citation, null, "19128"));
- assertTrue ("With parsing", Citations.identifierMatches(citation, null, "ISO:19128"));
- assertFalse("With wrong code space", Citations.identifierMatches(citation, null, "Foo:19128"));
- }
-}
diff --git a/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java b/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
index 81a2737..7da3477 100644
--- a/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
+++ b/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
@@ -90,7 +90,6 @@ import org.junit.BeforeClass;
// GeoAPI most basic types.
org.apache.sis.internal.util.DefinitionURITest.class,
org.apache.sis.internal.util.XPathsTest.class,
- org.apache.sis.internal.util.CitationsTest.class,
org.apache.sis.util.iso.SimpleInternationalStringTest.class,
org.apache.sis.util.iso.DefaultInternationalStringTest.class,
org.apache.sis.internal.util.LocalizedParseExceptionTest.class,
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
index 450ab55..125df3d 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
@@ -74,7 +74,6 @@ import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.cs.CoordinateSystems;
import org.apache.sis.referencing.crs.DefaultGeographicCRS;
import org.apache.sis.io.TableAppender;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Characters;
@@ -469,8 +468,8 @@ final class CRSBuilder extends ReferencingFactoryContainer {
}
if (code != expected) {
warning(Resources.Keys.NotTheEpsgValue_5, IdentifiedObjects.getIdentifierOrName(parent),
- Constants.EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + expected, GeoKeys.name(key),
- Constants.EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + code, "");
+ Constants.EPSG + Constants.DEFAULT_SEPARATOR + expected, GeoKeys.name(key),
+ Constants.EPSG + Constants.DEFAULT_SEPARATOR + code, "");
}
}
}
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
index 38a7804..d3551e9 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
@@ -51,12 +51,12 @@ import org.apache.sis.internal.netcdf.NamedElement;
import org.apache.sis.internal.netcdf.DiscreteSampling;
import org.apache.sis.internal.netcdf.Resources;
import org.apache.sis.internal.storage.io.ChannelDataInput;
+import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.internal.util.StandardDateFormat;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.DataStoreContentException;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Vocabulary;
@@ -374,7 +374,7 @@ public final class ChannelDecoder extends Decoder {
* Returns the name of a tag to show in error message. The returned name include the filename.
*/
private String tagPath(final String name) {
- return getFilename() + DefaultNameSpace.DEFAULT_SEPARATOR + name;
+ return getFilename() + Constants.DEFAULT_SEPARATOR + name;
}
/**
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
index 42fe106..c48cb66 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
@@ -39,7 +39,7 @@ import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.WritableFeatureSet;
import org.apache.sis.storage.UnsupportedStorageException;
import org.apache.sis.geometry.GeneralEnvelope;
-import org.apache.sis.internal.util.Citations;
+import org.apache.sis.internal.metadata.Identifiers;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Classes;
@@ -99,13 +99,13 @@ public final class StoreUtilities extends Static {
* @return a data identifier, or {@code null} if none.
*
* @see DataStore#getIdentifier()
- * @see Citations#removeIgnorableCharacters(String)
+ * @see org.apache.sis.metadata.iso.citation.Citations#removeIgnorableCharacters(String)
*/
private static String getAnyIdentifier(final Metadata metadata, final boolean unicode) {
String fallback = null;
if (metadata != null) {
for (final Identification md : metadata.getIdentificationInfo()) {
- String id = Citations.getIdentifier(md.getCitation(), unicode);
+ String id = Identifiers.getIdentifier(md.getCitation(), unicode);
if (id != null) {
if (md instanceof DataIdentification) {
return id;
[sis] 03/10: First round of simplication allowed by SIS-463: delete
ReferencingServices methods which were used for GeodeticObjectParser
implementation. Instead,
GeodeticObjectParser can now access directly the sis-referencing classes
that it needs.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 7c21a98bdc468791895411fa277feb387acdd3a5
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jun 21 12:10:28 2019 +0200
First round of simplication allowed by SIS-463: delete ReferencingServices methods which were used for GeodeticObjectParser implementation. Instead, GeodeticObjectParser can now access directly the sis-referencing classes that it needs.
---
.../sis/internal/metadata/ReferencingServices.java | 161 --------------
.../internal/referencing/ServicesForMetadata.java | 233 +--------------------
.../sis/internal/referencing/WKTUtilities.java | 37 ++++
.../main/java/org/apache/sis/io/wkt/Formatter.java | 8 +-
.../apache/sis/io/wkt/GeodeticObjectParser.java | 49 +++--
5 files changed, 78 insertions(+), 410 deletions(-)
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
index 2653d77..ef7a0ed 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
@@ -21,29 +21,17 @@ import java.util.Collections;
import java.util.Locale;
import java.util.TimeZone;
import java.text.Format;
-import javax.measure.Unit;
-import javax.measure.quantity.Length;
import org.opengis.geometry.Envelope;
import org.opengis.geometry.DirectPosition;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.referencing.IdentifiedObject;
import org.opengis.referencing.crs.CRSFactory;
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.opengis.referencing.crs.SingleCRS;
-import org.opengis.referencing.crs.DerivedCRS;
-import org.opengis.referencing.crs.VerticalCRS;
-import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CSFactory;
-import org.opengis.referencing.cs.CartesianCS;
-import org.opengis.referencing.cs.CoordinateSystem;
-import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.datum.DatumFactory;
-import org.opengis.referencing.datum.PrimeMeridian;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.CoordinateOperationFactory;
import org.opengis.referencing.operation.OperationMethod;
-import org.opengis.referencing.operation.SingleOperation;
import org.opengis.referencing.operation.TransformException;
import org.opengis.util.FactoryException;
import org.apache.sis.metadata.iso.extent.DefaultExtent;
@@ -331,101 +319,6 @@ public class ReferencingServices extends OptionalDependency {
throw moduleNotFound();
}
-
-
-
- ///////////////////////////////////////////////////////////////////////////////////////
- //// ////
- //// SERVICES FOR WKT PARSING ////
- //// ////
- ///////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Returns a coordinate reference system for heights above the mean seal level.
- *
- * @return the "Mean Seal Level (MSL) height" coordinate reference system, or {@code null}.
- *
- * @since 0.6
- */
- public VerticalCRS getMSLH() {
- throw moduleNotFound();
- }
-
- /**
- * Returns the Greenwich prime meridian.
- *
- * @return the Greenwich prime meridian.
- *
- * @since 0.6
- */
- public PrimeMeridian getGreenwich() {
- throw moduleNotFound();
- }
-
- /**
- * Returns the coordinate system of a geocentric CRS using axes in the given unit of measurement.
- *
- * @param unit the unit of measurement for the geocentric CRS axes.
- * @return the coordinate system for a geocentric CRS with axes using the given unit of measurement.
- *
- * @since 0.6
- */
- public CartesianCS getGeocentricCS(final Unit<Length> unit) {
- throw moduleNotFound();
- }
-
- /**
- * Converts a geocentric coordinate system from the legacy WKT 1 to the current ISO 19111 standard.
- * This method replaces the (Other, East, North) directions by (Geocentric X, Geocentric Y, Geocentric Z).
- *
- * @param cs the geocentric coordinate system to upgrade.
- * @return the upgraded coordinate system, or {@code cs} if this method can not upgrade the given CS.
- *
- * @since 0.6
- */
- public CartesianCS upgradeGeocentricCS(final CartesianCS cs) {
- return cs;
- }
-
- /**
- * Creates a coordinate system of unknown type. This method is used during parsing of WKT version 1,
- * since that legacy format did not specified any information about the coordinate system in use.
- * This method should not need to be invoked for parsing WKT version 2.
- *
- * @param properties the coordinate system name, and optionally other properties.
- * @param axes the axes of the unknown coordinate system.
- * @return an "abstract" coordinate system using the given axes.
- *
- * @since 0.6
- */
- public CoordinateSystem createAbstractCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
- throw moduleNotFound();
- }
-
- /**
- * Creates a derived CRS from the information found in a WKT 1 {@code FITTED_CS} element.
- * This coordinate system can not be easily constructed from the information provided by the WKT 1 format.
- * Note that this method is needed only for WKT 1 parsing, since WKT provides enough information for using
- * the standard factories.
- *
- * @param properties the properties to be given to the {@code DerivedCRS} and {@code Conversion} objects.
- * @param baseCRS coordinate reference system to base the derived CRS on.
- * @param method the coordinate operation method (mandatory in all cases).
- * @param baseToDerived transform from positions in the base CRS to positions in this target CRS.
- * @param derivedCS the coordinate system for the derived CRS.
- * @return the newly created derived CRS, potentially implementing an additional CRS interface.
- *
- * @since 0.6
- */
- public DerivedCRS createDerivedCRS(final Map<String,?> properties,
- final SingleCRS baseCRS,
- final OperationMethod method,
- final MathTransform baseToDerived,
- final CoordinateSystem derivedCS)
- {
- throw moduleNotFound();
- }
-
/**
* Creates a format for {@link DirectPosition} instances.
*
@@ -440,60 +333,6 @@ public class ReferencingServices extends OptionalDependency {
}
/**
- * Returns an axis direction from a pole along a meridian.
- * The given meridian is usually, but not necessarily, relative to the Greenwich meridian.
- *
- * @param baseDirection the base direction, which must be {@link AxisDirection#NORTH} or {@link AxisDirection#SOUTH}.
- * @param meridian the meridian in degrees, relative to a unspecified (usually Greenwich) prime meridian.
- * Meridians in the East hemisphere are positive and meridians in the West hemisphere are negative.
- * @return the axis direction along the given meridian.
- *
- * @since 0.6
- */
- public AxisDirection directionAlongMeridian(final AxisDirection baseDirection, final double meridian) {
- throw moduleNotFound();
- }
-
- /**
- * Creates the {@code TOWGS84} element during parsing of a WKT version 1. This is an optional operation:
- * this method is allowed to return {@code null} if the "sis-referencing" module is not in the classpath.
- *
- * @param values the 7 Bursa-Wolf parameter values.
- * @return the {@link org.apache.sis.referencing.datum.BursaWolfParameters}, or {@code null}.
- *
- * @since 0.6
- */
- public Object createToWGS84(final double[] values) {
- return null;
- }
-
- /**
- * Creates a single operation from the given properties.
- * This method is provided here because not yet available in GeoAPI interfaces.
- *
- * @param properties the properties to be given to the identified object.
- * @param sourceCRS the source CRS.
- * @param targetCRS the target CRS.
- * @param interpolationCRS the CRS of additional coordinates needed for the operation, or {@code null} if none.
- * @param method the coordinate operation method (mandatory in all cases).
- * @param factory the factory to use.
- * @return the coordinate operation created from the given arguments.
- * @throws FactoryException if the object creation failed.
- *
- * @since 0.6
- */
- public SingleOperation createSingleOperation(
- final Map<String,?> properties,
- final CoordinateReferenceSystem sourceCRS,
- final CoordinateReferenceSystem targetCRS,
- final CoordinateReferenceSystem interpolationCRS,
- final OperationMethod method,
- final CoordinateOperationFactory factory) throws FactoryException
- {
- throw moduleNotFound();
- }
-
- /**
* Returns the coordinate operation factory to use for the given properties and math transform factory.
* If the given properties are empty and the {@code mtFactory} is the system default, then this method
* returns the system default {@code CoordinateOperationFactory} instead of creating a new one.
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
index d44c5f1..8b6ea4c 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
@@ -24,33 +24,21 @@ import java.util.Collections;
import java.util.Locale;
import java.util.TimeZone;
import java.text.Format;
-import javax.measure.Unit;
-import javax.measure.quantity.Length;
import org.opengis.util.FactoryException;
import org.opengis.util.InternationalString;
import org.opengis.parameter.ParameterDescriptor;
-import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.IdentifiedObject;
import org.opengis.referencing.crs.SingleCRS;
-import org.opengis.referencing.crs.DerivedCRS;
import org.opengis.referencing.crs.TemporalCRS;
import org.opengis.referencing.crs.VerticalCRS;
import org.opengis.referencing.crs.GeographicCRS;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.crs.CRSFactory;
import org.opengis.referencing.cs.CSFactory;
-import org.opengis.referencing.cs.AxisDirection;
-import org.opengis.referencing.cs.CartesianCS;
import org.opengis.referencing.cs.CoordinateSystem;
-import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.opengis.referencing.datum.PrimeMeridian;
-import org.opengis.referencing.operation.Matrix;
-import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.TransformException;
-import org.opengis.referencing.operation.OperationMethod;
-import org.opengis.referencing.operation.SingleOperation;
import org.opengis.referencing.operation.CoordinateOperation;
import org.opengis.referencing.operation.CoordinateOperationFactory;
import org.opengis.metadata.Identifier;
@@ -71,18 +59,9 @@ import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.AbstractIdentifiedObject;
-import org.apache.sis.referencing.cs.AbstractCS;
-import org.apache.sis.referencing.cs.CoordinateSystems;
-import org.apache.sis.referencing.crs.DefaultDerivedCRS;
import org.apache.sis.referencing.crs.DefaultTemporalCRS;
-import org.apache.sis.referencing.datum.BursaWolfParameters;
-import org.apache.sis.referencing.operation.transform.MathTransforms;
import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
import org.apache.sis.parameter.DefaultParameterDescriptor;
-import org.apache.sis.parameter.Parameterized;
-import org.apache.sis.io.wkt.Formatter;
-import org.apache.sis.io.wkt.FormattableObject;
-import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.metadata.iso.extent.DefaultExtent;
import org.apache.sis.metadata.iso.extent.DefaultVerticalExtent;
import org.apache.sis.metadata.iso.extent.DefaultTemporalExtent;
@@ -92,7 +71,6 @@ import org.apache.sis.measure.Latitude;
import org.apache.sis.measure.Longitude;
import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.metadata.ReferencingServices;
-import org.apache.sis.internal.referencing.provider.Affine;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.util.Constants;
@@ -510,7 +488,7 @@ public final class ServicesForMetadata extends ReferencingServices {
///////////////////////////////////////////////////////////////////////////////////////
//// ////
- //// SERVICES FOR WKT FORMATTING ////
+ //// SERVICES FOR WKT PARSING AND FORMATTING ////
//// ////
///////////////////////////////////////////////////////////////////////////////////////
@@ -526,151 +504,6 @@ public final class ServicesForMetadata extends ReferencingServices {
}
/**
- * Converts the given object in a {@code FormattableObject} instance.
- *
- * @param object the object to wrap.
- * @return the given object converted to a {@code FormattableObject} instance.
- */
- public static FormattableObject toFormattableObject(final IdentifiedObject object) {
- return AbstractIdentifiedObject.castOrCopy(object);
- }
-
- /**
- * Converts the given object in a {@code FormattableObject} instance. Callers should verify that the given
- * object is not already an instance of {@code FormattableObject} before to invoke this method. This method
- * returns {@code null} if it can not convert the object.
- *
- * @param object the object to wrap.
- * @param internal {@code true} if the formatting convention is {@code Convention.INTERNAL}.
- * @return the given object converted to a {@code FormattableObject} instance, or {@code null}.
- *
- * @since 0.6
- */
- public static FormattableObject toFormattableObject(final MathTransform object, boolean internal) {
- Matrix matrix;
- final ParameterValueGroup parameters;
- if (internal && (matrix = MathTransforms.getMatrix(object)) != null) {
- parameters = Affine.parameters(matrix);
- } else if (object instanceof Parameterized) {
- parameters = ((Parameterized) object).getParameterValues();
- } else {
- matrix = MathTransforms.getMatrix(object);
- if (matrix == null) {
- return null;
- }
- parameters = Affine.parameters(matrix);
- }
- return new FormattableObject() {
- @Override
- protected String formatTo(final Formatter formatter) {
- WKTUtilities.appendParamMT(parameters, formatter);
- return WKTKeywords.Param_MT;
- }
- };
- }
-
-
-
-
- ///////////////////////////////////////////////////////////////////////////////////////
- //// ////
- //// SERVICES FOR WKT PARSING ////
- //// ////
- ///////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Returns a coordinate reference system for heights above the mean seal level.
- *
- * @return the "Mean Seal Level (MSL) height" coordinate reference system.
- *
- * @since 0.6
- */
- @Override
- public VerticalCRS getMSLH() {
- return CommonCRS.Vertical.MEAN_SEA_LEVEL.crs();
- }
-
- /**
- * Returns the Greenwich prime meridian.
- *
- * @return the Greenwich prime meridian.
- *
- * @since 0.6
- */
- @Override
- public PrimeMeridian getGreenwich() {
- return CommonCRS.WGS84.primeMeridian();
- }
-
- /**
- * Returns the coordinate system of a geocentric CRS using axes in the given unit of measurement.
- *
- * @param linearUnit the unit of measurement for the geocentric CRS axes.
- * @return the coordinate system for a geocentric CRS with axes using the given unit of measurement.
- *
- * @since 0.6
- */
- @Override
- public CartesianCS getGeocentricCS(final Unit<Length> linearUnit) {
- return Legacy.standard(linearUnit);
- }
-
- /**
- * Converts a geocentric coordinate system from the legacy WKT 1 to the current ISO 19111 standard.
- * This method replaces the (Other, East, North) directions by (Geocentric X, Geocentric Y, Geocentric Z).
- *
- * @param cs the geocentric coordinate system to upgrade.
- * @return the upgraded coordinate system, or {@code cs} if there is no change to apply.
- *
- * @since 0.6
- */
- @Override
- public CartesianCS upgradeGeocentricCS(final CartesianCS cs) {
- return Legacy.forGeocentricCRS(cs, false);
- }
-
- /**
- * Creates a coordinate system of unknown type. This method is used during parsing of WKT version 1,
- * since that legacy format did not specified any information about the coordinate system in use.
- * This method should not need to be invoked for parsing WKT version 2.
- *
- * @param properties the coordinate system name, and optionally other properties.
- * @param axes the axes of the unknown coordinate system.
- * @return an "abstract" coordinate system using the given axes.
- *
- * @since 0.6
- */
- @Override
- public CoordinateSystem createAbstractCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
- return new AbstractCS(properties, axes);
- }
-
- /**
- * Creates a derived CRS from the information found in a WKT 1 {@code FITTED_CS} element.
- * This coordinate system can not be easily constructed from the information provided by the WKT 1 format.
- * Note that this method is needed only for WKT 1 parsing, since WKT provides enough information for using
- * the standard factories.
- *
- * @param properties the properties to be given to the {@code DerivedCRS} and {@code Conversion} objects.
- * @param baseCRS coordinate reference system to base the derived CRS on.
- * @param method the coordinate operation method (mandatory in all cases).
- * @param baseToDerived transform from positions in the base CRS to positions in this target CRS.
- * @param derivedCS the coordinate system for the derived CRS.
- * @return the newly created derived CRS, potentially implementing an additional CRS interface.
- *
- * @since 0.6
- */
- @Override
- public DerivedCRS createDerivedCRS(final Map<String,?> properties,
- final SingleCRS baseCRS,
- final OperationMethod method,
- final MathTransform baseToDerived,
- final CoordinateSystem derivedCS)
- {
- return DefaultDerivedCRS.create(properties, baseCRS, null, method, baseToDerived, derivedCS);
- }
-
- /**
* Creates a format for {@link DirectPosition} instances.
*
* @param locale the locale for the new {@code Format}, or {@code null} for {@code Locale.ROOT}.
@@ -685,70 +518,6 @@ public final class ServicesForMetadata extends ReferencingServices {
}
/**
- * Returns an axis direction from a pole along a meridian.
- * The given meridian is usually, but not necessarily, relative to the Greenwich meridian.
- *
- * @param baseDirection the base direction, which must be {@link AxisDirection#NORTH} or {@link AxisDirection#SOUTH}.
- * @param meridian the meridian in degrees, relative to a unspecified (usually Greenwich) prime meridian.
- * Meridians in the East hemisphere are positive and meridians in the West hemisphere are negative.
- * @return the axis direction along the given meridian.
- *
- * @since 0.6
- */
- @Override
- public AxisDirection directionAlongMeridian(final AxisDirection baseDirection, final double meridian) {
- return CoordinateSystems.directionAlongMeridian(baseDirection, meridian);
- }
-
- /**
- * Creates the {@code TOWGS84} element during parsing of a WKT version 1.
- *
- * @param values the 7 Bursa-Wolf parameter values.
- * @return the {@link BursaWolfParameters}.
- *
- * @since 0.6
- */
- @Override
- public Object createToWGS84(final double[] values) {
- final BursaWolfParameters info = new BursaWolfParameters(CommonCRS.WGS84.datum(), null);
- info.setValues(values);
- return info;
- }
-
- /**
- * Creates a single operation from the given properties.
- * This method is provided here because not yet available in GeoAPI interfaces.
- *
- * @param properties the properties to be given to the identified object.
- * @param sourceCRS the source CRS.
- * @param targetCRS the target CRS.
- * @param interpolationCRS the CRS of additional coordinates needed for the operation, or {@code null} if none.
- * @param method the coordinate operation method (mandatory in all cases).
- * @param factory the factory to use.
- * @return the coordinate operation created from the given arguments.
- * @throws FactoryException if the object creation failed.
- *
- * @since 0.6
- */
- @Override
- public SingleOperation createSingleOperation(
- final Map<String,?> properties,
- final CoordinateReferenceSystem sourceCRS,
- final CoordinateReferenceSystem targetCRS,
- final CoordinateReferenceSystem interpolationCRS,
- final OperationMethod method,
- final CoordinateOperationFactory factory) throws FactoryException
- {
- final DefaultCoordinateOperationFactory df;
- if (factory instanceof DefaultCoordinateOperationFactory) {
- df = (DefaultCoordinateOperationFactory) factory;
- } else {
- df = CoordinateOperations.factory();
- }
- return df.createSingleOperation(properties, sourceCRS, targetCRS, interpolationCRS, method, null);
- }
-
- /**
* Returns the coordinate operation factory to use for the given properties and math transform factory.
* If the given properties are empty and the {@code mtFactory} is the system default, then this method
* returns the system default {@code CoordinateOperationFactory} instead of creating a new one.
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java
index 5b41ec8..2ff80be 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java
@@ -34,6 +34,8 @@ import org.opengis.referencing.datum.Datum;
import org.opengis.referencing.datum.GeodeticDatum;
import org.opengis.referencing.datum.PrimeMeridian;
import org.opengis.referencing.datum.Ellipsoid;
+import org.opengis.referencing.operation.Matrix;
+import org.opengis.referencing.operation.MathTransform;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.crs.AbstractCRS;
import org.apache.sis.referencing.cs.AbstractCS;
@@ -42,7 +44,11 @@ import org.apache.sis.referencing.datum.AbstractDatum;
import org.apache.sis.referencing.datum.DefaultGeodeticDatum;
import org.apache.sis.referencing.datum.DefaultPrimeMeridian;
import org.apache.sis.referencing.datum.DefaultEllipsoid;
+import org.apache.sis.referencing.operation.transform.MathTransforms;
+import org.apache.sis.internal.referencing.provider.Affine;
import org.apache.sis.parameter.DefaultParameterValue;
+import org.apache.sis.parameter.Parameterized;
+import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.io.wkt.ElementKind;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
@@ -208,6 +214,37 @@ public final class WKTUtilities extends Static {
}
/**
+ * Converts the given object in a {@code FormattableObject} instance. Callers should verify that the
+ * given object is not already an instance of {@code FormattableObject} before to invoke this method.
+ * This method returns {@code null} if it can not convert the object.
+ *
+ * @param object the object to wrap.
+ * @param internal {@code true} if the formatting convention is {@code Convention.INTERNAL}.
+ * @return the given object converted to a {@code FormattableObject} instance, or {@code null}.
+ */
+ public static FormattableObject toFormattable(final MathTransform object, boolean internal) {
+ Matrix matrix;
+ final ParameterValueGroup parameters;
+ if (internal && (matrix = MathTransforms.getMatrix(object)) != null) {
+ parameters = Affine.parameters(matrix);
+ } else if (object instanceof Parameterized) {
+ parameters = ((Parameterized) object).getParameterValues();
+ } else {
+ matrix = MathTransforms.getMatrix(object);
+ if (matrix == null) {
+ return null;
+ }
+ parameters = Affine.parameters(matrix);
+ }
+ return new FormattableObject() {
+ @Override protected String formatTo(final Formatter formatter) {
+ WKTUtilities.appendParamMT(parameters, formatter);
+ return WKTKeywords.Param_MT;
+ }
+ };
+ }
+
+ /**
* If the given unit is one of the unit that can not be formatted without ambiguity in WKT format,
* return a proposed replacement. Otherwise returns {@code unit} unchanged.
*
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
index b924553..f93d23e 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
@@ -75,8 +75,9 @@ import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.StandardDateFormat;
import org.apache.sis.internal.simple.SimpleExtent;
import org.apache.sis.internal.metadata.WKTKeywords;
-import org.apache.sis.internal.referencing.ServicesForMetadata;
import org.apache.sis.internal.metadata.Resources;
+import org.apache.sis.internal.referencing.WKTUtilities;
+import org.apache.sis.referencing.AbstractIdentifiedObject;
import org.apache.sis.measure.UnitFormat;
import org.apache.sis.measure.Range;
import org.apache.sis.measure.MeasurementRange;
@@ -984,8 +985,7 @@ public class Formatter implements Localized {
if (transform instanceof FormattableObject) {
append((FormattableObject) transform);
} else {
- final FormattableObject object = ServicesForMetadata
- .toFormattableObject(transform, convention == Convention.INTERNAL);
+ final FormattableObject object = WKTUtilities.toFormattable(transform, convention == Convention.INTERNAL);
if (object != null) {
append(object);
} else {
@@ -1549,7 +1549,7 @@ public class Formatter implements Localized {
if (value instanceof FormattableObject) {
append((FormattableObject) value);
} else if (value instanceof IdentifiedObject) {
- append(ServicesForMetadata.toFormattableObject((IdentifiedObject) value));
+ append(AbstractIdentifiedObject.castOrCopy((IdentifiedObject) value));
} else if (value instanceof MathTransform) {
append((MathTransform) value);
} else if (value instanceof Unit<?>) {
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
index ebf45df..eb20f81 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
@@ -57,6 +57,14 @@ import org.opengis.referencing.operation.*;
import org.apache.sis.measure.Units;
import org.apache.sis.measure.UnitFormat;
+import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.referencing.cs.AbstractCS;
+import org.apache.sis.referencing.cs.CoordinateSystems;
+import org.apache.sis.referencing.crs.DefaultDerivedCRS;
+import org.apache.sis.referencing.datum.BursaWolfParameters;
+import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
+import org.apache.sis.internal.referencing.CoordinateOperations;
+import org.apache.sis.internal.referencing.Legacy;
import org.apache.sis.metadata.iso.ImmutableIdentifier;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.metadata.iso.extent.DefaultExtent;
@@ -293,7 +301,7 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
if (verticalElements != null) {
Exception ex = null;
try {
- verticalElements = verticalElements.resolve(referencing.getMSLH()); // Optional operation.
+ verticalElements = verticalElements.resolve(CommonCRS.Vertical.MEAN_SEA_LEVEL.crs()); // Optional operation.
} catch (UnsupportedOperationException e) {
ex = e;
}
@@ -811,7 +819,7 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
throw parent.missingComponent(WKTKeywords.LengthUnit);
}
if (is3D) { // If dimension can not be 2, then CRS can not be Projected.
- return referencing.getGeocentricCS(defaultUnit.asType(Length.class));
+ return Legacy.standard(defaultUnit.asType(Length.class));
}
nx = AxisNames.EASTING; x = "E";
ny = AxisNames.NORTHING; y = "N";
@@ -934,7 +942,12 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
csProperties.put(CoordinateSystem.NAME_KEY, name);
}
if (type == null) {
- return referencing.createAbstractCS(csProperties, axes);
+ /*
+ * Creates a coordinate system of unknown type. This block is executed during parsing of WKT version 1,
+ * since that legacy format did not specified any information about the coordinate system in use.
+ * This block should not be executed during parsing of WKT version 2.
+ */
+ return new AbstractCS(csProperties, axes);
}
/*
* Finally, delegate to the factory method corresponding to the CS type and the number of axes.
@@ -994,7 +1007,7 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
}
default: {
warning(parent, WKTKeywords.CS, Errors.formatInternational(Errors.Keys.UnknownType_1, type), null);
- return referencing.createAbstractCS(csProperties, axes);
+ return new AbstractCS(csProperties, axes);
}
}
throw new UnparsableObjectException(errorLocale, (axes.length > dimension)
@@ -1056,7 +1069,7 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
if (m != null) {
angle = m.getConverterTo(Units.DEGREE).convert(angle);
}
- direction = referencing.directionAlongMeridian(direction, angle);
+ direction = CoordinateSystems.directionAlongMeridian(direction, angle);
}
/*
* According ISO 19162, the abbreviation should be inserted between parenthesis in the name.
@@ -1214,7 +1227,9 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
}
}
element.close(ignoredElements);
- return referencing.createToWGS84(values);
+ final BursaWolfParameters info = new BursaWolfParameters(CommonCRS.WGS84.datum(), null);
+ info.setValues(values);
+ return info;
}
/**
@@ -1410,7 +1425,7 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
final Object toWGS84 = parseToWGS84(OPTIONAL, element);
final Map<String,Object> properties = parseAnchorAndClose(element, name);
if (meridian == null) {
- meridian = referencing.getGreenwich();
+ meridian = CommonCRS.WGS84.primeMeridian();
}
if (toWGS84 != null) {
properties.put(ReferencingServices.BURSA_WOLF_KEY, toWGS84);
@@ -1848,7 +1863,7 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
}
if (cs instanceof CartesianCS) { // The second most frequent case.
return crsFactory.createGeocentricCRS(properties, datum,
- referencing.upgradeGeocentricCS((CartesianCS) cs));
+ Legacy.forGeocentricCRS((CartesianCS) cs, false));
}
if (cs instanceof SphericalCS) { // Not very common case.
return crsFactory.createGeocentricCRS(properties, datum, (SphericalCS) cs);
@@ -2235,14 +2250,16 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
number, AxisDirection.OTHER, Units.UNITY);
}
final Map<String,Object> properties = parseMetadataAndClose(element, name, baseCRS);
- final CoordinateSystem derivedCS = referencing.createAbstractCS(
+ final CoordinateSystem derivedCS = new AbstractCS(
singletonMap(CoordinateSystem.NAME_KEY, AxisDirections.appendTo(new StringBuilder("CS"), axes)), axes);
/*
- * We do not know which name to give to the conversion method.
- * For now, use the CRS name.
+ * Creates a derived CRS from the information found in a WKT 1 {@code FITTED_CS} element.
+ * This coordinate system can not be easily constructed from the information provided by
+ * the WKT 1 format, which block us from using the standard Coordinate System factory.
+ * Note that we do not know which name to give to the conversion method; for now we use the CRS name.
*/
properties.put("conversion.name", name);
- return referencing.createDerivedCRS(properties, (SingleCRS) baseCRS, method, toBase.inverse(), derivedCS);
+ return DefaultDerivedCRS.create(properties, (SingleCRS) baseCRS, null, method, toBase.inverse(), derivedCS);
} catch (FactoryException | NoninvertibleTransformException exception) {
throw element.parseFailed(exception);
}
@@ -2278,7 +2295,13 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
accuracy.close(ignoredElements);
}
try {
- return referencing.createSingleOperation(properties, sourceCRS, targetCRS, interpolationCRS, method, opFactory);
+ final DefaultCoordinateOperationFactory df;
+ if (opFactory instanceof DefaultCoordinateOperationFactory) {
+ df = (DefaultCoordinateOperationFactory) opFactory;
+ } else {
+ df = CoordinateOperations.factory();
+ }
+ return df.createSingleOperation(properties, sourceCRS, targetCRS, interpolationCRS, method, null);
} catch (FactoryException e) {
throw element.parseFailed(e);
}
[sis] 01/10: Avoid the use of ImmutableIdentifier in anticipation
for its migration to sis-referencing module.
Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 450ad14759d6743c3197d5af871536471356e224
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jun 21 10:36:45 2019 +0200
Avoid the use of ImmutableIdentifier in anticipation for its migration to sis-referencing module.
---
.../apache/sis/internal/profile/fra/DirectReferenceSystemTest.java | 4 ++--
.../test/java/org/apache/sis/profile/france/FrenchProfileTest.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java b/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java
index 93e943c..e0ca6e1 100644
--- a/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java
+++ b/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java
@@ -20,7 +20,7 @@ import java.util.Collection;
import javax.xml.bind.JAXBException;
import org.opengis.metadata.citation.Responsibility;
import org.apache.sis.metadata.iso.DefaultMetadata;
-import org.apache.sis.metadata.iso.ImmutableIdentifier;
+import org.apache.sis.metadata.iso.DefaultIdentifier;
import org.apache.sis.metadata.iso.citation.DefaultCitation;
import org.apache.sis.metadata.iso.citation.DefaultResponsibleParty;
import org.apache.sis.metadata.iso.citation.HardCodedCitations;
@@ -63,7 +63,7 @@ public final strictfp class DirectReferenceSystemTest extends TestCase {
r = singleton(new DefaultResponsibleParty(TestUtilities.getSingleton(r)));
}
citation.setCitedResponsibleParties(r);
- final DirectReferenceSystem refSys = new DirectReferenceSystem(new ImmutableIdentifier(citation, null, "4326"));
+ final DirectReferenceSystem refSys = new DirectReferenceSystem(new DefaultIdentifier(citation, "4326"));
metadata.setReferenceSystemInfo(singleton(refSys));
return metadata;
}
diff --git a/profiles/sis-french-profile/src/test/java/org/apache/sis/profile/france/FrenchProfileTest.java b/profiles/sis-french-profile/src/test/java/org/apache/sis/profile/france/FrenchProfileTest.java
index 633db90..90a5d6e 100644
--- a/profiles/sis-french-profile/src/test/java/org/apache/sis/profile/france/FrenchProfileTest.java
+++ b/profiles/sis-french-profile/src/test/java/org/apache/sis/profile/france/FrenchProfileTest.java
@@ -26,7 +26,7 @@ import org.apache.sis.metadata.iso.constraint.DefaultSecurityConstraints;
import org.apache.sis.internal.jaxb.metadata.replace.ReferenceSystemMetadata;
import org.apache.sis.internal.profile.fra.IndirectReferenceSystem;
import org.apache.sis.internal.profile.fra.DirectReferenceSystem;
-import org.apache.sis.metadata.iso.ImmutableIdentifier;
+import org.apache.sis.metadata.iso.DefaultIdentifier;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -77,7 +77,7 @@ public final strictfp class FrenchProfileTest extends TestCase {
public void testReferenceSystemToAFNOR() {
ReferenceSystem std, fra;
- std = new ReferenceSystemMetadata(new ImmutableIdentifier(null, "EPSG", "4326"));
+ std = new ReferenceSystemMetadata(new DefaultIdentifier("EPSG", "4326", null));
fra = FrenchProfile.toAFNOR(std, false);
assertInstanceOf("Expected AFNOR instance.", DirectReferenceSystem.class, fra);
assertSame("Already an AFNOR instance.", fra, FrenchProfile.toAFNOR(fra));