sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1543487 - /sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
Date Tue, 19 Nov 2013 16:42:05 GMT
Author: desruisseaux
Date: Tue Nov 19 16:42:04 2013
New Revision: 1543487

URL: http://svn.apache.org/r1543487
Log:
Moved 'ellipsoid()' method before 'primeMeridian()'. There is no change of functionality in
this commit.
The intend is only to declare the methods that are more likely to be of user interest before
the other methods.

Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java?rev=1543487&r1=1543486&r2=1543487&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
[UTF-8] Tue Nov 19 16:42:04 2013
@@ -255,37 +255,42 @@ public enum GeodeticObjects {
     }
 
     /**
-     * Returns the prime meridian associated to this geodetic object.
-     * The following table summarizes the prime meridians known to this class,
-     * together with an enumeration value that can be used for fetching that prime meridian:
+     * Returns the ellipsoid associated to this geodetic object.
+     * The following table summarizes the ellipsoids known to this class,
+     * together with an enumeration value that can be used for fetching that ellipsoid:
      *
      * <blockquote><table class="sis">
-     *   <tr><th>Name or alias</th> <th>Enum</th>         
 <th>EPSG</th></tr>
-     *   <tr><td>Greenwich</td>     <td>{@link #WGS84}</td>
<td>8901</td></tr>
+     *   <tr><th>Name or alias</th>                    <th>Enum</th>
           <th>EPSG</th></tr>
+     *   <tr><td>Clarke 1866</td>                      <td>{@link
#NAD27}</td>  <td>7008</td></tr>
+     *   <tr><td>GRS 1980 Authalic Sphere</td>         <td>{@link
#SPHERE}</td> <td>7048</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>
+     *   <tr><td>World Geodetic System (WGS) 1972</td> <td>{@link
#WGS72}</td>  <td>7043</td></tr>
+     *   <tr><td>World Geodetic System (WGS) 1984</td> <td>{@link
#WGS84}</td>  <td>7030</td></tr>
      * </table></blockquote>
      *
-     * @return The prime meridian associated to this constant.
+     * @return The ellipsoid associated to this constant.
      *
-     * @see org.apache.sis.referencing.datum.DefaultPrimeMeridian
-     * @see DatumAuthorityFactory#createPrimeMeridian(String)
+     * @see org.apache.sis.referencing.datum.DefaultEllipsoid
+     * @see DatumAuthorityFactory#createEllipsoid(String)
      */
-    public PrimeMeridian primeMeridian() {
-        PrimeMeridian object = primeMeridian(cached);
+    public Ellipsoid ellipsoid() {
+        Ellipsoid object = ellipsoid(cached);
         if (object == null) {
             synchronized (this) {
-                object = primeMeridian(cached);
+                object = ellipsoid(cached);
                 if (object == null) {
-                    if (this != WGS84) {
-                        object = WGS84.primeMeridian(); // Share the same instance for all
constants.
+                    if (this == NAD83) {
+                        object = ETRS89.ellipsoid(); // Share the same instance for NAD83
and ETRS89.
                     } else {
                         final DatumAuthorityFactory factory = StandardObjects.datumFactory();
                         if (factory != null) try {
-                            cached = object = factory.createPrimeMeridian(StandardDefinitions.GREENWICH);
+                            cached = object = factory.createEllipsoid(String.valueOf(ellipsoid));
                             return object;
                         } catch (FactoryException e) {
-                            StandardObjects.failure(this, "primeMeridian", e);
+                            StandardObjects.failure(this, "ellipsoid", e);
                         }
-                        object = StandardDefinitions.primeMeridian();
+                        object = StandardDefinitions.createEllipsoid(ellipsoid);
                     }
                     cached = object;
                 }
@@ -295,42 +300,37 @@ public enum GeodeticObjects {
     }
 
     /**
-     * Returns the ellipsoid associated to this geodetic object.
-     * The following table summarizes the ellipsoids known to this class,
-     * together with an enumeration value that can be used for fetching that ellipsoid:
+     * Returns the prime meridian associated to this geodetic object.
+     * The following table summarizes the prime meridians known to this class,
+     * together with an enumeration value that can be used for fetching that prime meridian:
      *
      * <blockquote><table class="sis">
-     *   <tr><th>Name or alias</th>                    <th>Enum</th>
           <th>EPSG</th></tr>
-     *   <tr><td>Clarke 1866</td>                      <td>{@link
#NAD27}</td>  <td>7008</td></tr>
-     *   <tr><td>GRS 1980 Authalic Sphere</td>         <td>{@link
#SPHERE}</td> <td>7048</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>
-     *   <tr><td>World Geodetic System (WGS) 1972</td> <td>{@link
#WGS72}</td>  <td>7043</td></tr>
-     *   <tr><td>World Geodetic System (WGS) 1984</td> <td>{@link
#WGS84}</td>  <td>7030</td></tr>
+     *   <tr><th>Name or alias</th> <th>Enum</th>         
 <th>EPSG</th></tr>
+     *   <tr><td>Greenwich</td>     <td>{@link #WGS84}</td>
<td>8901</td></tr>
      * </table></blockquote>
      *
-     * @return The ellipsoid associated to this constant.
+     * @return The prime meridian associated to this constant.
      *
-     * @see org.apache.sis.referencing.datum.DefaultEllipsoid
-     * @see DatumAuthorityFactory#createEllipsoid(String)
+     * @see org.apache.sis.referencing.datum.DefaultPrimeMeridian
+     * @see DatumAuthorityFactory#createPrimeMeridian(String)
      */
-    public Ellipsoid ellipsoid() {
-        Ellipsoid object = ellipsoid(cached);
+    public PrimeMeridian primeMeridian() {
+        PrimeMeridian object = primeMeridian(cached);
         if (object == null) {
             synchronized (this) {
-                object = ellipsoid(cached);
+                object = primeMeridian(cached);
                 if (object == null) {
-                    if (this == NAD83) {
-                        object = ETRS89.ellipsoid(); // Share the same instance for NAD83
and ETRS89.
+                    if (this != WGS84) {
+                        object = WGS84.primeMeridian(); // Share the same instance for all
constants.
                     } else {
                         final DatumAuthorityFactory factory = StandardObjects.datumFactory();
                         if (factory != null) try {
-                            cached = object = factory.createEllipsoid(String.valueOf(ellipsoid));
+                            cached = object = factory.createPrimeMeridian(StandardDefinitions.GREENWICH);
                             return object;
                         } catch (FactoryException e) {
-                            StandardObjects.failure(this, "ellipsoid", e);
+                            StandardObjects.failure(this, "primeMeridian", e);
                         }
-                        object = StandardDefinitions.createEllipsoid(ellipsoid);
+                        object = StandardDefinitions.primeMeridian();
                     }
                     cached = object;
                 }
@@ -340,33 +340,33 @@ public enum GeodeticObjects {
     }
 
     /**
-     * Returns the prime meridian associated to the given object, or {@code null} if none.
+     * Returns the ellipsoid associated to the given object, or {@code null} if none.
      */
-    private static PrimeMeridian primeMeridian(final IdentifiedObject object) {
-        if (object instanceof PrimeMeridian) {
-            return (PrimeMeridian) object;
+    private static Ellipsoid ellipsoid(final IdentifiedObject object) {
+        if (object instanceof Ellipsoid) {
+            return (Ellipsoid) object;
         }
         if (object instanceof GeodeticDatum) {
-            return ((GeodeticDatum) object).getPrimeMeridian();
+            return ((GeodeticDatum) object).getEllipsoid();
         }
         if (object instanceof GeodeticCRS) {
-            return ((GeodeticCRS) object).getDatum().getPrimeMeridian();
+            return ((GeodeticCRS) object).getDatum().getEllipsoid();
         }
         return null;
     }
 
     /**
-     * Returns the ellipsoid associated to the given object, or {@code null} if none.
+     * Returns the prime meridian associated to the given object, or {@code null} if none.
      */
-    private static Ellipsoid ellipsoid(final IdentifiedObject object) {
-        if (object instanceof Ellipsoid) {
-            return (Ellipsoid) object;
+    private static PrimeMeridian primeMeridian(final IdentifiedObject object) {
+        if (object instanceof PrimeMeridian) {
+            return (PrimeMeridian) object;
         }
         if (object instanceof GeodeticDatum) {
-            return ((GeodeticDatum) object).getEllipsoid();
+            return ((GeodeticDatum) object).getPrimeMeridian();
         }
         if (object instanceof GeodeticCRS) {
-            return ((GeodeticCRS) object).getDatum().getEllipsoid();
+            return ((GeodeticCRS) object).getDatum().getPrimeMeridian();
         }
         return null;
     }



Mime
View raw message