sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 01/02: Add axis names for extra-terrestial planets.
Date Fri, 10 Jan 2020 15:47:40 GMT
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 3b73a0822347463daabf29601853dca249ad238a
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Fri Jan 10 14:33:53 2020 +0100

    Add axis names for extra-terrestial planets.
---
 .../org/apache/sis/internal/metadata/AxisNames.java   | 19 ++++++++++++++++++-
 .../java/org/apache/sis/io/wkt/Transliterator.java    | 14 +++++++++++---
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
index cebcfe2..2adcf16 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
@@ -25,9 +25,10 @@ import org.apache.sis.internal.system.Modules;
 
 /**
  * Constants for axis names specified by ISO 19111 and ISO 19162.
+ * Contains also some extensions used in astronomy.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   0.6
  * @module
  */
@@ -53,11 +54,24 @@ public final class AxisNames {
     public static final String GEODETIC_LATITUDE = "Geodetic latitude";
 
     /**
+     * The <cite>"planetodetic longitude"</cite> name used in astronomy.
+     */
+    public static final String PLANETODETIC_LONGITUDE = "Planetodetic longitude";
+
+    /**
+     * The <cite>"planetodetic latitude"</cite> name used in astronomy.
+     */
+    public static final String PLANETODETIC_LATITUDE = "Planetodetic latitude";
+
+    /**
      * The ISO 19111 <cite>"spherical longitude"</cite> name, also called <cite>"azimuthal
angle"</cite>.
      * Abbreviation used by SIS is "θ" (theta) for consistency with ISO 19111 and ISO 19162
      * <cite>Axis name and abbreviation</cite> section, but some other conventions
use φ or Ω instead.
      * Direction in the EPSG database is "East", but "counterClockwise" may also be used.
      *
+     * <p>Axis name <cite>"Geocentric longitude"</cite> can also be used.
+     * In astronomy, <cite>"Planetocentric longitude"</cite> is sometime used.</p>
+     *
      * @see <a href="http://en.wikipedia.org/wiki/Spherical_coordinate_system">Spherical
coordinate system on Wikipedia</a>
      * @see <a href="http://mathworld.wolfram.com/SphericalCoordinates.html">Spherical
coordinate system on MathWorld</a>
      */
@@ -69,6 +83,9 @@ public final class AxisNames {
      * <cite>Axis name and abbreviation</cite> section, but some other conventions
use θ, Ω or Ψ instead.
      * Direction in the EPSG database is "North", but the "Up" direction may also be used
with a similar
      * axis named "elevation".
+     *
+     * <p>Axis name <cite>"Geocentric latitude"</cite> can also be used.
+     * In astronomy, <cite>"Planetocentric latitude"</cite> is sometime used.</p>
      */
     public static final String SPHERICAL_LATITUDE = "Spherical latitude";
 
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 2b197a9..79073ac 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
@@ -89,7 +89,7 @@ import org.apache.sis.util.Characters;
  * methods are responsible for doing the transliteration at formatting and parsing time,
respectively.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
  *
  * @see org.apache.sis.util.Characters#isValidWKT(int)
  * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#39">WKT 2
specification §7.5.3</a>
@@ -217,8 +217,16 @@ public abstract class Transliterator implements Serializable {
      * @see org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#formatTo(Formatter)
      */
     public String toShortAxisName(final CoordinateSystem cs, final AxisDirection direction,
final String name) {
-        if (name.equalsIgnoreCase(AxisNames.GEODETIC_LATITUDE )) return AxisNames.LATITUDE;
 // ISO 19162:2015 §7.5.3(ii)
-        if (name.equalsIgnoreCase(AxisNames.GEODETIC_LONGITUDE)) return AxisNames.LONGITUDE;
+        if (name.equalsIgnoreCase(AxisNames.GEODETIC_LATITUDE) ||               // ISO 19162:2015
§7.5.3(ii)
+            name.equalsIgnoreCase(AxisNames.PLANETODETIC_LATITUDE))
+        {
+            return AxisNames.LATITUDE;
+        }
+        if (name.equalsIgnoreCase(AxisNames.GEODETIC_LONGITUDE) ||
+            name.equalsIgnoreCase(AxisNames.PLANETODETIC_LONGITUDE))
+        {
+            return AxisNames.LONGITUDE;
+        }
         if (AxisDirections.isGeocentric(direction) && CharSequences.equalsFiltered(
                 name, direction.name(), Characters.Filter.LETTERS_AND_DIGITS, true))
         {


Mime
View raw message