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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new c17092f  Rename `COORDINATE_REFERENCE_SYSTEM` as `DEFAULT_CRS` for 
clarity.
c17092f is described below

commit c17092f1fe5892242c9bad0d54ef10edc0ca2f5e
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Thu Mar 31 21:26:59 2022 +0200

    Rename `COORDINATE_REFERENCE_SYSTEM` as `DEFAULT_CRS` for clarity.
---
 .../main/java/org/apache/sis/setup/OptionKey.java  |  6 +++---
 .../apache/sis/internal/storage/PRJDataStore.java  | 25 +++++++++++-----------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java 
b/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
index 788645e..54911c6 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
@@ -193,15 +193,15 @@ public class OptionKey<T> implements Serializable {
     public static final OptionKey<GeometryLibrary> GEOMETRY_LIBRARY = new 
OptionKey<>("GEOMETRY_LIBRARY", GeometryLibrary.class);
 
     /**
-     * The coordinate reference system (CRS) of data.
+     * The coordinate reference system (CRS) of data to use if not explicitly 
defined.
      * This option can be used when the file to read does not describe itself 
the data CRS.
      * For example this option can be used when reading ASCII Grid without CRS 
information,
      * but is ignored if the ASCII Grid file is accompanied by a {@code *.prj} 
file giving the CRS.
      *
      * @since 1.2
      */
-    public static final OptionKey<CoordinateReferenceSystem> 
COORDINATE_REFERENCE_SYSTEM =
-            new OptionKey<>("COORDINATE_REFERENCE_SYSTEM", 
CoordinateReferenceSystem.class);
+    public static final OptionKey<CoordinateReferenceSystem> DEFAULT_CRS =
+            new OptionKey<>("DEFAULT_CRS", CoordinateReferenceSystem.class);
 
     /**
      * The number of spaces to use for indentation when formatting text files 
in WKT or XML formats.
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/PRJDataStore.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/PRJDataStore.java
index 3889e26..f339599 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/PRJDataStore.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/PRJDataStore.java
@@ -51,7 +51,7 @@ import org.apache.sis.util.ArraysExt;
 
 /**
  * A data store for a file or URI accompanied by an auxiliary file of the same 
name with {@code .prj} extension.
- * If the auxiliary file is absent, {@link 
OptionKey#COORDINATE_REFERENCE_SYSTEM} is used as a fallback.
+ * If the auxiliary file is absent, {@link OptionKey#DEFAULT_CRS} is used as a 
fallback.
  * The WKT 1 variant used for parsing the {@code "*.prj"} file is the variant 
used by "World Files" and GDAL;
  * this is not the standard specified by OGC 01-009 (they differ in there 
interpretation of units of measurement).
  *
@@ -92,9 +92,8 @@ public abstract class PRJDataStore extends URIDataStore {
     private final TimeZone timezone;
 
     /**
-     * The coordinate reference system. This is initialized on the value 
provided
-     * by {@link OptionKey#COORDINATE_REFERENCE_SYSTEM} at construction time, 
and
-     * is modified later if a {@code "*.prj"} file is found.
+     * The coordinate reference system. This is initialized on the value 
provided by {@link OptionKey#DEFAULT_CRS}
+     * at construction time, and is modified later if a {@code "*.prj"} file 
is found.
      */
     protected CoordinateReferenceSystem crs;
 
@@ -102,7 +101,7 @@ public abstract class PRJDataStore extends URIDataStore {
      * Creates a new data store. The following options are recognized:
      *
      * <ul>
-     *   <li>{@link OptionKey#COORDINATE_REFERENCE_SYSTEM}: default CRS if no 
auxiliary {@code "*.prj"} file is found.</li>
+     *   <li>{@link OptionKey#DEFAULT_CRS}: default CRS if no auxiliary {@code 
"*.prj"} file is found.</li>
      *   <li>{@link OptionKey#ENCODING}: encoding of the {@code "*.prj"} file. 
Default is the JVM default.</li>
      *   <li>{@link OptionKey#TIMEZONE}: timezone of dates in the {@code 
"*.prj"} file. Default is UTC.</li>
      *   <li>{@link OptionKey#LOCALE}: locale for texts in the {@code "*.prj"} 
file. Default is English.</li>
@@ -114,7 +113,7 @@ public abstract class PRJDataStore extends URIDataStore {
      */
     protected PRJDataStore(final DataStoreProvider provider, final 
StorageConnector connector) throws DataStoreException {
         super(provider, connector);
-        crs      = connector.getOption(OptionKey.COORDINATE_REFERENCE_SYSTEM);
+        crs      = connector.getOption(OptionKey.DEFAULT_CRS);
         encoding = connector.getOption(OptionKey.ENCODING);
         locale   = connector.getOption(OptionKey.LOCALE);       // For 
`InternationalString`, not for numbers.
         timezone = connector.getOption(OptionKey.TIMEZONE);
@@ -253,17 +252,17 @@ public abstract class PRJDataStore extends URIDataStore {
      */
     public abstract static class Provider extends URIDataStore.Provider {
         /**
-         * Name of the {@link #COORDINATE_REFERENCE_SYSTEM} parameter.
+         * Name of the {@link #DEFAULT_CRS} parameter.
          */
-        static final String CRS_NAME = "crs";
+        static final String CRS_NAME = "defaultCRS";
 
         /**
          * Description of the optional parameter for the default coordinate 
reference system.
          */
-        public static final ParameterDescriptor<CoordinateReferenceSystem> 
COORDINATE_REFERENCE_SYSTEM;
+        public static final ParameterDescriptor<CoordinateReferenceSystem> 
DEFAULT_CRS;
         static {
             final ParameterBuilder builder = new ParameterBuilder();
-            COORDINATE_REFERENCE_SYSTEM = 
builder.addName(CRS_NAME).setDescription(
+            DEFAULT_CRS = builder.addName(CRS_NAME).setDescription(
                     
Vocabulary.formatInternational(Vocabulary.Keys.CoordinateRefSys))
                     .create(CoordinateReferenceSystem.class, null);
         }
@@ -277,7 +276,7 @@ public abstract class PRJDataStore extends URIDataStore {
         /**
          * Invoked by {@link #getOpenParameters()} the first time that a 
parameter descriptor needs to be created.
          * When invoked, the parameter group name is set to a name derived 
from the {@link #getShortName()} value.
-         * The default implementation creates a group containing {@link 
#LOCATION_PARAM} and {@link #COORDINATE_REFERENCE_SYSTEM}.
+         * The default implementation creates a group containing {@link 
#LOCATION_PARAM} and {@link #DEFAULT_CRS}.
          * Subclasses can override if they need to create a group with more 
parameters.
          *
          * @param  builder  the builder to use for creating parameter 
descriptor. The group name is already set.
@@ -285,7 +284,7 @@ public abstract class PRJDataStore extends URIDataStore {
          */
         @Override
         protected ParameterDescriptorGroup build(final ParameterBuilder 
builder) {
-            return builder.createGroup(LOCATION_PARAM, 
COORDINATE_REFERENCE_SYSTEM);
+            return builder.createGroup(LOCATION_PARAM, DEFAULT_CRS);
         }
 
         /**
@@ -299,7 +298,7 @@ public abstract class PRJDataStore extends URIDataStore {
             ArgumentChecks.ensureNonNull("parameter", parameters);
             final StorageConnector connector = connector(this, parameters);
             final Parameters pg = Parameters.castOrWrap(parameters);
-            connector.setOption(OptionKey.COORDINATE_REFERENCE_SYSTEM, 
pg.getValue(COORDINATE_REFERENCE_SYSTEM));
+            connector.setOption(OptionKey.DEFAULT_CRS, 
pg.getValue(DEFAULT_CRS));
             return open(connector);
         }
     }

Reply via email to