sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1531739 - in /sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis: internal/referencing/ referencing/ referencing/datum/
Date Sun, 13 Oct 2013 20:16:04 GMT
Author: desruisseaux
Date: Sun Oct 13 20:16:04 2013
New Revision: 1531739

URL: http://svn.apache.org/r1531739
Log:
Minor refactoring: put the code that actualy create the Greenwich prime meridian closer to
where it is invoked.

Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardObjects.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java?rev=1531739&r1=1531738&r2=1531739&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
[UTF-8] Sun Oct 13 20:16:04 2013
@@ -16,16 +16,7 @@
  */
 package org.apache.sis.internal.referencing;
 
-import java.util.Map;
-import java.util.HashMap;
-import javax.measure.unit.NonSI;
 import org.apache.sis.util.Static;
-import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.referencing.NamedIdentifier;
-import org.apache.sis.referencing.datum.DefaultPrimeMeridian;
-
-import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
-import static org.opengis.referencing.IdentifiedObject.IDENTIFIERS_KEY;
 
 
 /**
@@ -42,24 +33,10 @@ import static org.opengis.referencing.Id
  */
 public final class ReferencingUtilities extends Static {
     /**
-     * The EPSG code for Greenwich meridian.
-     */
-    public static final String GREENWICH_CODE = "8901";
-
-    /**
-     * The Greenwich meridian (EPSG:8901), with angular measurements in decimal degrees.
-     */
-    public static final DefaultPrimeMeridian GREENWICH;
-    static {
-        final Map<String,Object> properties = new HashMap<>(4);
-        properties.put(NAME_KEY, new NamedIdentifier(Citations.EPSG, "Greenwich")); // Name
is fixed by ISO 19111.
-        properties.put(IDENTIFIERS_KEY, new NamedIdentifier(Citations.EPSG, GREENWICH_CODE));
-        GREENWICH = new DefaultPrimeMeridian(properties, 0, NonSI.DEGREE_ANGLE);
-    }
-
-    /**
      * Do not allow instantiation of this class.
      */
     private ReferencingUtilities() {
     }
+
+    // TODO: methods to be ported from Geotk later.
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java?rev=1531739&r1=1531738&r2=1531739&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
[UTF-8] Sun Oct 13 20:16:04 2013
@@ -20,11 +20,14 @@ import java.util.Map;
 import java.util.HashMap;
 import javax.measure.unit.SI;
 import javax.measure.unit.Unit;
+import javax.measure.unit.NonSI;
 import javax.measure.quantity.Length;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.datum.Ellipsoid;
+import org.opengis.referencing.datum.PrimeMeridian;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.referencing.datum.DefaultEllipsoid;
+import org.apache.sis.referencing.datum.DefaultPrimeMeridian;
 
 import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
 import static org.opengis.referencing.IdentifiedObject.ALIAS_KEY;
@@ -42,12 +45,28 @@ import static org.opengis.referencing.Id
  */
 final class StandardDefinitions {
     /**
+     * The EPSG code for Greenwich meridian.
+     */
+    static final String GREENWICH = "8901";
+
+    /**
      * Do not allow instantiation of this class.
      */
     private StandardDefinitions() {
     }
 
     /**
+     * Creates the Greenwich prime meridian. This is the only prime meridian supported by
SIS convenience shortcuts.
+     * If an other prime meridian is desired, the EPSG database shall be used.
+     */
+    static PrimeMeridian primeMeridian() {
+        final Map<String,Object> properties = new HashMap<>(4);
+        properties.put(NAME_KEY, new NamedIdentifier(Citations.EPSG, "Greenwich")); // Name
is fixed by ISO 19111.
+        properties.put(IDENTIFIERS_KEY, new NamedIdentifier(Citations.EPSG, GREENWICH));
+        return new DefaultPrimeMeridian(properties, 0, NonSI.DEGREE_ANGLE);
+    }
+
+    /**
      * Creates an ellipsoid from hard-coded values for the given code.
      *
      * @param  code The EPSG or SIS code.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardObjects.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardObjects.java?rev=1531739&r1=1531738&r2=1531739&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardObjects.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardObjects.java
[UTF-8] Sun Oct 13 20:16:04 2013
@@ -28,7 +28,6 @@ import org.opengis.referencing.datum.Ell
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.datum.DatumAuthorityFactory;
-import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.system.SystemListener;
 import org.apache.sis.util.logging.Logging;
@@ -354,7 +353,7 @@ public abstract class StandardObjects im
          * together with a constant that can be used for fetching that prime meridian:
          *
          * <blockquote><table class="sis">
-         *   <tr><th>Name or alias</th> <th>Constant</th> 
     <th>EPSG</th></tr>
+         *   <tr><th>Name or alias</th> <th>Field</th>    
     <th>EPSG</th></tr>
          *   <tr><td>Greenwich</td>     <td>{@link #WGS84}</td>
<td>8901</td></tr>
          * </table></blockquote>
          *
@@ -374,12 +373,12 @@ public abstract class StandardObjects im
                         } else {
                             final DatumAuthorityFactory factory = datumFactory();
                             if (factory != null) try {
-                                cached = object = factory.createPrimeMeridian(ReferencingUtilities.GREENWICH_CODE);
+                                cached = object = factory.createPrimeMeridian(StandardDefinitions.GREENWICH);
                                 return object;
                             } catch (FactoryException e) {
                                 failure("primeMeridian", e);
                             }
-                            object = ReferencingUtilities.GREENWICH;
+                            object = StandardDefinitions.primeMeridian();
                         }
                         cached = object;
                     }
@@ -394,7 +393,7 @@ public abstract class StandardObjects im
          * together with a constant that can be used for fetching that ellipsoid:
          *
          * <blockquote><table class="sis">
-         *   <tr><th>Name or alias</th>                    <th>Constant</th>
       <th>EPSG</th></tr>
+         *   <tr><th>Name or alias</th>                    <th>Field</th>
          <th>EPSG</th></tr>
          *   <tr><td>Clarke 1866</td>                      <td>{@link
#NAD27}</td>  <td>7008</td></tr>
          *   <tr><td>International 1924</td>               <td>{@link
#ED50}</td>   <td>7022</td></tr>
          *   <tr><td>International 1979 / GRS 1980</td>    <td>{@link
#ETRS89}</td> <td>7019</td></tr>

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java?rev=1531739&r1=1531738&r2=1531739&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
[UTF-8] Sun Oct 13 20:16:04 2013
@@ -33,7 +33,6 @@ import org.apache.sis.util.Immutable;
 
 import static org.apache.sis.util.ArgumentChecks.ensureFinite;
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
-import static org.apache.sis.internal.referencing.ReferencingUtilities.GREENWICH;
 
 // Related to JDK7
 import java.util.Objects;
@@ -98,15 +97,6 @@ public class DefaultPrimeMeridian extend
     private final Unit<Angle> angularUnit;
 
     /**
-     * Constructs a new object in which every attributes are set to a default value.
-     * <strong>This is not a valid object.</strong> This constructor is strictly
-     * reserved to JAXB, which will assign values to the fields using reflexion.
-     */
-    private DefaultPrimeMeridian() {
-        this(GREENWICH);
-    }
-
-    /**
      * Constructs a new prime meridian with the same values than the specified one.
      * This copy constructor provides a way to convert an arbitrary implementation into a
SIS one
      * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific
API.



Mime
View raw message