sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1533612 - in /sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing: EPSG.java GeodeticObjects.java datum/BursaWolfParameters.java datum/DefaultGeodeticDatum.java
Date Fri, 18 Oct 2013 19:54:35 GMT
Author: desruisseaux
Date: Fri Oct 18 19:54:35 2013
New Revision: 1533612

URL: http://svn.apache.org/r1533612
Log:
Added an EPSG annotation for documentation purpose.

Added:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSG.java
  (with props)
Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java

Added: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSG.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSG.java?rev=1533612&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSG.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSG.java
[UTF-8] Fri Oct 18 19:54:35 2013
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * Documents the relationship between a SIS element and the corresponding EPSG element.
+ * The EPSG geodetic parameter dataset is a structured database required to:
+ *
+ * <ul>
+ *   <li>define {@linkplain org.opengis.referencing.crs.CoordinateReferenceSystem Coordinate
Reference Systems (CRS)
+ *       such that coordinates describe positions unambiguously;</li>
+ *   <li>define {@linkplain org.opengis.referencing.operation.CoordinateOperation Coordinate
Operations}
+ *       that allow coordinates to be changed from one CRS to another CRS.</li>
+ * </ul>
+ *
+ * This {@code EPSG} annotation is associated to various elements defined by SIS in Java,
including:
+ *
+ * <ul>
+ *   <li>classes or methods implementing a specific coordinate operation method;</li>
+ *   <li>enumeration constants representing some specific CRS;</li>
+ *   <li>fields containing parameter values.</li>
+ * </ul>
+ *
+ * This annotation has two members: the GeoAPI {@linkplain #type() type} and the EPSG {@linkplain
#code() code}.
+ * The <var>type</var> specifies which {@link org.opengis.referencing.AuthorityFactory}
method to invoke, while
+ * the <var>code</var> specifies the argument value to give to that method in
order to get the EPSG object. For
+ * example the {@link GeodeticObjects#WGS84} enumeration constants has the following annotation:
+ *
+ * {@preformat java
+ *   &#64;EPSG(type = GeographicCRS.class, code = 4326)
+ * }
+ *
+ * which means that the annotated constant is related to an EPSG object that could be obtained
by the following
+ * code, where {@code factory} is an instance of {@link org.opengis.referencing.crs.CRSAuthorityFactory}:
+ *
+ * {@preformat java
+ *   GeographicCRS crs = factory.createGeographicCRS("4326");
+ * }
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4
+ * @version 0.4
+ * @module
+ *
+ * @see org.apache.sis.metadata.iso.citation.Citations#EPSG
+ * @see org.apache.sis.io.wkt.Convention#EPSG
+ * @see <a href="http://www.epsg.org">EPSG Geodetic Parameters</a>
+ */
+@Documented
+@Retention(RetentionPolicy.SOURCE)
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+public @interface EPSG {
+    /**
+     * The type returned by the {@link org.opengis.referencing.AuthorityFactory} method
+     * which create the EPSG object. There is a one-to-one relationship between this type
+     * and the table to query in the EPSG database.
+     *
+     * @return The type of the object identified by the EPSG code.
+     */
+    Class<?> type();
+
+    /**
+     * The argument to give to the method identified by {@link #type()} in order to create
the EPSG object.
+     * Those codes are used as primary keys in the EPSG database.
+     *
+     * @return The code of the EPSG object.
+     */
+    int code();
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSG.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSG.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

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=1533612&r1=1533611&r2=1533612&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] Fri Oct 18 19:54:35 2013
@@ -27,6 +27,7 @@ import org.opengis.referencing.Identifie
 import org.opengis.referencing.crs.GeodeticCRS;
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.referencing.crs.TemporalCRS;
+import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.datum.PrimeMeridian;
@@ -103,6 +104,7 @@ public enum GeodeticObjects {
      *   <tr><th>Ellipsoid axes unit:</th>     <td>{@link SI#METRE}</td></tr>
      * </table></blockquote>
      */
+    @EPSG(type = GeographicCRS.class, code = 4326)
     WGS84((short) 7030),
 
     /**
@@ -119,6 +121,7 @@ public enum GeodeticObjects {
      *   <tr><th>Ellipsoid axes unit:</th>     <td>{@link SI#METRE}</td></tr>
      * </table></blockquote>
      */
+    @EPSG(type = GeographicCRS.class, code = 4322)
     WGS72((short) 7043),
 
     /**
@@ -141,6 +144,7 @@ public enum GeodeticObjects {
      *        The <cite>Web Map Server</cite> <code>"CRS:83"</code>
authority code uses the NAD83 datum,
      *        while the <code>"IGNF:MILLER"</code> authority code uses the GRS80
datum.}
      */
+    @EPSG(type = GeographicCRS.class, code = 4258)
     ETRS89((short) 7019),
 
     /**
@@ -164,6 +168,7 @@ public enum GeodeticObjects {
      *        The <cite>Web Map Server</cite> <code>"CRS:83"</code>
authority code uses the NAD83 datum,
      *        while the <code>"IGNF:MILLER"</code> authority code uses the GRS80
datum.}
      */
+    @EPSG(type = GeographicCRS.class, code = 4269)
     NAD83((short) 7019),
 
     /**
@@ -180,6 +185,7 @@ public enum GeodeticObjects {
      *   <tr><th>Ellipsoid axes unit:</th>     <td>{@link SI#METRE}</td></tr>
      * </table></blockquote>
      */
+    @EPSG(type = GeographicCRS.class, code = 4267)
     NAD27((short) 7008),
 
     /**
@@ -196,6 +202,7 @@ public enum GeodeticObjects {
      *   <tr><th>Ellipsoid axes unit:</th>     <td>{@link SI#METRE}</td></tr>
      * </table></blockquote>
      */
+    @EPSG(type = GeographicCRS.class, code = 4230)
     ED50((short) 7022),
 
     /**
@@ -212,6 +219,7 @@ public enum GeodeticObjects {
      *   <tr><th>Ellipsoid axes unit:</th>     <td>{@link SI#METRE}</td></tr>
      * </table></blockquote>
      */
+    @EPSG(type = GeographicCRS.class, code = 4047)
     SPHERE((short) 7048);
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java?rev=1533612&r1=1533611&r2=1533612&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
[UTF-8] Fri Oct 18 19:54:35 2013
@@ -18,10 +18,13 @@ package org.apache.sis.referencing.datum
 
 import java.util.Arrays;
 import java.io.Serializable;
+import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.referencing.datum.GeodeticDatum;
+import org.opengis.referencing.operation.OperationMethod;
 import org.opengis.referencing.operation.Matrix;
 import org.apache.sis.referencing.operation.matrix.Matrix4;
 import org.apache.sis.referencing.operation.matrix.Matrices;
+import org.apache.sis.referencing.EPSG;
 import org.apache.sis.io.wkt.FormattableObject;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.Immutable;
@@ -164,36 +167,42 @@ public class BursaWolfParameters extends
      * X-axis translation in metres (EPSG:8605).
      * The legacy OGC parameter name is {@code "dx"}.
      */
+    @EPSG(type = ParameterDescriptor.class, code = 8605)
     public final double tX;
 
     /**
      * Y-axis translation in metres (EPSG:8606).
      * The legacy OGC parameter name is {@code "dy"}.
      */
+    @EPSG(type = ParameterDescriptor.class, code = 8606)
     public final double tY;
 
     /**
      * Z-axis translation in metres (EPSG:8607).
      * The legacy OGC parameter name is {@code "dz"}.
      */
+    @EPSG(type = ParameterDescriptor.class, code = 8607)
     public final double tZ;
 
     /**
      * X-axis rotation in arc seconds (EPSG:8608), sign following the <cite>Position
Vector</cite> convention.
      * The legacy OGC parameter name is {@code "ex"}.
      */
+    @EPSG(type = ParameterDescriptor.class, code = 8608)
     public final double rX;
 
     /**
      * Y-axis rotation in arc seconds (EPSG:8609), sign following the <cite>Position
Vector</cite> convention.
      * The legacy OGC parameter name is {@code "ey"}.
      */
+    @EPSG(type = ParameterDescriptor.class, code = 8609)
     public final double rY;
 
     /**
      * Z-axis rotation in arc seconds (EPSG:8610), sign following the <cite>Position
Vector</cite> convention.
      * The legacy OGC parameter name is {@code "ez"}.
      */
+    @EPSG(type = ParameterDescriptor.class, code = 8610)
     public final double rZ;
 
     /**
@@ -204,6 +213,7 @@ public class BursaWolfParameters extends
      *           of 100.001 km in the target coordinate reference system, the scale difference
is 1 ppm
      *           (the ratio being 1.000001).}
      */
+    @EPSG(type = ParameterDescriptor.class, code = 8611)
     public final double dS;
 
     /**
@@ -358,6 +368,7 @@ public class BursaWolfParameters extends
      *
      * @see DefaultGeodeticDatum#getPositionVectorTransformation(GeodeticDatum)
      */
+    @EPSG(type = OperationMethod.class, code = 1033)
     public Matrix getPositionVectorTransformation() {
         final double  S = 1 + dS / PPM;
         final double RS = TO_RADIANS * S;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java?rev=1533612&r1=1533611&r2=1533612&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
[UTF-8] Fri Oct 18 19:54:35 2013
@@ -28,6 +28,8 @@ import org.opengis.referencing.datum.Ell
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.operation.Matrix;
+import org.opengis.referencing.operation.OperationMethod;
+import org.apache.sis.referencing.EPSG;
 import org.apache.sis.referencing.GeodeticObjects;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 import org.apache.sis.referencing.operation.matrix.NoninvertibleMatrixException;
@@ -275,6 +277,7 @@ public class DefaultGeodeticDatum extend
      *
      * @see BursaWolfParameters#getPositionVectorTransformation()
      */
+    @EPSG(type = OperationMethod.class, code = 1033)
     public Matrix getPositionVectorTransformation(final GeodeticDatum targetDatum) {
         ensureNonNull("targetDatum", targetDatum);
         try {



Mime
View raw message