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 e50774dce650829b69e63c0df728fd03269433fd Author: Martin Desruisseaux <[email protected]> AuthorDate: Sat Jun 25 14:53:44 2022 +0200 Add a `Coder.getReferenceSystem()` method. --- .../sis/referencing/gazetteer/GeohashReferenceSystem.java | 12 ++++++++++++ .../referencing/gazetteer/MilitaryGridReferenceSystem.java | 5 ++++- .../sis/referencing/gazetteer/ReferencingByIdentifiers.java | 7 +++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java index e031987af4..7340a140cc 100644 --- a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java +++ b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/GeohashReferenceSystem.java @@ -250,6 +250,18 @@ public class GeohashReferenceSystem extends ReferencingByIdentifiers { coordinates = denormalize.getMathTransform().isIdentity() ? null : new double[8]; } + /** + * Returns the reference system for which GeoHash identifiers will be encoded or decoded. + * + * @return the enclosing reference system. + * + * @since 1.3 + */ + @Override + public final GeohashReferenceSystem getReferenceSystem() { + return GeohashReferenceSystem.this; + } + /** * Returns the length of geohashes strings to be encoded by the {@link #encode(DirectPosition)} method. * The default value for {@link Format#BASE32} is 12. diff --git a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java index 11f6704277..1d62ed8acd 100644 --- a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java +++ b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java @@ -440,8 +440,11 @@ public class MilitaryGridReferenceSystem extends ReferencingByIdentifiers { * Returns the reference system for which MGRS references will be encoded or decoded. * * @return the enclosing reference system. + * + * @since 1.3 */ - final MilitaryGridReferenceSystem getReferenceSystem() { + @Override + public final MilitaryGridReferenceSystem getReferenceSystem() { return MilitaryGridReferenceSystem.this; } diff --git a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java index 2142c996cb..1cebee5ba7 100644 --- a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java +++ b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java @@ -281,6 +281,13 @@ public abstract class ReferencingByIdentifiers extends AbstractReferenceSystem i protected Coder() { } + /** + * Returns the reference system for which this coder is reading or writing identifiers. + * + * @return the enclosing reference system. + */ + public abstract ReferencingByIdentifiers getReferenceSystem(); + /** * Returns approximate precision of the identifiers formatted by this coder at the given location. * The returned value is typically a length in linear unit (e.g. metres).
