sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1685127 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/io/wkt/ sis-referencing/src/main/java/org/apache/sis/referencing/ sis-referencing/src/main/java/org/apache/sis/referencing/cs/ sis-referencing/src/main/java/or...
Date Fri, 12 Jun 2015 16:41:38 GMT
Author: desruisseaux
Date: Fri Jun 12 16:41:37 2015
New Revision: 1685127

URL: http://svn.apache.org/r1685127
Log:
Referencing: added a CRS.fromWKT(String) convenience method and fixed some related javadoc.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/package-info.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java?rev=1685127&r1=1685126&r2=1685127&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
[UTF-8] Fri Jun 12 16:41:37 2015
@@ -546,7 +546,7 @@ public class WKTFormat extends CompoundF
      * @param  toAppendTo Where the text is to be appended.
      * @throws IOException If an error occurred while writing to {@code toAppendTo}.
      *
-     * @see #getWarning()
+     * @see FormattableObject#toWKT()
      */
     @Override
     public void format(final Object object, final Appendable toAppendTo) throws IOException
{

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java?rev=1685127&r1=1685126&r2=1685127&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
[UTF-8] Fri Jun 12 16:41:37 2015
@@ -93,11 +93,11 @@ public final class Warnings implements L
     private Map<Exception, String[]> exceptionSources;
 
     /**
-     * Keyword of unknown elements. This is initially a direct reference to the {@link Parser#ignoredElements}
map,
-     * which is okay only until a new parsing start. If this {@code Warnings} instance is
given to the user, then
+     * Keyword of unknown elements. This is initially a direct reference to the {@link AbstractParser#ignoredElements}
+     * map, which is okay only until a new parsing start. If this {@code Warnings} instance
is given to the user, then
      * the {@link #publish()} method must be invoked in order to copy this map.
      *
-     * @see Parser#ignoredElements
+     * @see AbstractParser#ignoredElements
      */
     private Map<String, List<String>> ignoredElements;
 

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/package-info.java?rev=1685127&r1=1685126&r2=1685127&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/package-info.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/package-info.java
[UTF-8] Fri Jun 12 16:41:37 2015
@@ -17,7 +17,7 @@
 
 /**
  * <cite>Well Known Text</cite> (WKT) parsing and formatting.
- * This package implements the services provided by the {@link org.apache.sis.referencing.CRS#parseWKT(String)}
+ * This package implements the services provided by the {@link org.apache.sis.referencing.CRS#fromWKT(String)}
  * and {@link org.opengis.referencing.IdentifiedObject#toWKT()} convenience methods, with
more control.
  * For example this package allows to:
  *
@@ -60,7 +60,7 @@
  * @author  Rémi Eve (IRD)
  * @author  Rueben Schulz (UBC)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  *
  * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">WKT 2 specification</a>

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1685127&r1=1685126&r2=1685127&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
[UTF-8] Fri Jun 12 16:41:37 2015
@@ -28,6 +28,7 @@ import org.opengis.referencing.cs.Ellips
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.crs.CRSFactory;
 import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.referencing.crs.CompoundCRS;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -42,6 +43,7 @@ import org.opengis.metadata.extent.Geogr
 import org.apache.sis.internal.util.DefinitionURI;
 import org.apache.sis.internal.referencing.AxisDirections;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
+import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.referencing.cs.DefaultVerticalCS;
 import org.apache.sis.referencing.cs.DefaultEllipsoidalCS;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
@@ -82,7 +84,7 @@ import static java.util.Collections.sing
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3
- * @version 0.5
+ * @version 0.6
  * @module
  */
 public final class CRS extends Static {
@@ -164,7 +166,7 @@ public final class CRS extends Static {
          * that CommonCRS is not expected to succeed if the real EPSG factory threw an exception,
          * so we will log a message at the warning level in such case.
          */
-        CRSAuthorityFactory factory = null; // TODO
+        final CRSAuthorityFactory factory = DefaultFactories.forClass(CRSAuthorityFactory.class);
         if (factory != null) try {
             return factory.createCoordinateReferenceSystem(value);
         } catch (FactoryException failure) {
@@ -177,6 +179,50 @@ public final class CRS extends Static {
     }
 
     /**
+     * Creates a Coordinate Reference System object from a <cite>Well Known Text</cite>
(WKT).
+     * This convenience method delegates to
+     * {@link org.apache.sis.referencing.factory.GeodeticObjectFactory#createFromWKT(String)}
+     * using a default factory instance. The Apache SIS parser understands both the version
1
+     * (a.k.a. OGC 01-009) and version 2 (a.k.a. ISO 19162) of the WKT format.
+     *
+     * <div class="note"><b>Example:</b> below is a slightly simplified
WKT 2 string for a Mercator projection.
+     * For making this example smaller, some optional {@code UNIT[…]} and {@code ORDER[…]}
elements have been omitted.
+     *
+     * {@preformat wkt
+     *   ProjectedCRS["SIRGAS 2000 / Brazil Mercator",
+     *     BaseGeodCRS["SIRGAS 2000",
+     *       Datum["Sistema de Referencia Geocentrico para las Americas 2000",
+     *         Ellipsoid["GRS 1980", 6378137, 298.257222101]]],
+     *     Conversion["Petrobras Mercator",
+     *       Method["Mercator (variant B)", Id["EPSG",9805]],
+     *       Parameter["Latitude of 1st standard parallel", -2],
+     *       Parameter["Longitude of natural origin", -43],
+     *       Parameter["False easting", 5000000],
+     *       Parameter["False northing", 10000000]],
+     *     CS[cartesian,2],
+     *       Axis["easting (E)", east],
+     *       Axis["northing (N)", north],
+     *       LengthUnit["metre", 1],
+     *     Id["EPSG",5641]]
+     * }
+     * </div>
+     *
+     * @param  text Coordinate system encoded in Well-Known Text format (version 1 or 2).
+     * @return The parsed Coordinate Reference System.
+     * @throws FactoryException if the given WKT can not be parsed.
+     *
+     * @see org.apache.sis.io.wkt.WKTFormat
+     * @see org.apache.sis.geometry.Envelopes#fromWKT(CharSequence)
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">WKT
2 specification</a>
+     *
+     * @since 0.6
+     */
+    public static CoordinateReferenceSystem fromWKT(final String text) throws FactoryException
{
+        ArgumentChecks.ensureNonNull("text", text);
+        return DefaultFactories.forBuildin(CRSFactory.class).createFromWKT(text);
+    }
+
+    /**
      * Returns the valid geographic area for the given coordinate reference system, or {@code
null} if unknown.
      * This method explores the {@linkplain CoordinateReferenceSystem#getDomainOfValidity()
domain of validity}
      * associated with the given CRS. If more than one geographic bounding box is found,
then they will be

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java?rev=1685127&r1=1685126&r2=1685127&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
[UTF-8] Fri Jun 12 16:41:37 2015
@@ -142,8 +142,8 @@ public enum AxesConvention implements Ax
      * changes are more difficult to handle by coordinate operation factories.
      * </div>
      *
-     * @see CoordinateSystems#normalize(CoordinateSystem)
      * @see org.apache.sis.referencing.CommonCRS#normalizedGeographic()
+     * @see CoordinateSystems#replaceAxes(CoordinateSystem, AxisFilter)
      */
     NORMALIZED {
         @Override

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java?rev=1685127&r1=1685126&r2=1685127&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
[UTF-8] Fri Jun 12 16:41:37 2015
@@ -1340,10 +1340,38 @@ public class GeodeticObjectFactory exten
     }
 
     /**
-     * Creates a coordinate reference system object from a string.
+     * Creates a Coordinate Reference System object from a <cite>Well Known Text</cite>
(WKT).
+     * This method understands both the version 1 (a.k.a. OGC 01-009) and version 2 (a.k.a.
ISO 19162)
+     * of the WKT format.
+     *
+     * <div class="note"><b>Example:</b> below is a slightly simplified
WKT 2 string for a Mercator projection.
+     * For making this example smaller, some optional {@code UNIT[…]} and {@code ORDER[…]}
elements have been omitted.
+     *
+     * {@preformat wkt
+     *   ProjectedCRS["SIRGAS 2000 / Brazil Mercator",
+     *     BaseGeodCRS["SIRGAS 2000",
+     *       Datum["Sistema de Referencia Geocentrico para las Americas 2000",
+     *         Ellipsoid["GRS 1980", 6378137, 298.257222101]]],
+     *     Conversion["Petrobras Mercator",
+     *       Method["Mercator (variant B)", Id["EPSG",9805]],
+     *       Parameter["Latitude of 1st standard parallel", -2],
+     *       Parameter["Longitude of natural origin", -43],
+     *       Parameter["False easting", 5000000],
+     *       Parameter["False northing", 10000000]],
+     *     CS[cartesian,2],
+     *       Axis["easting (E)", east],
+     *       Axis["northing (N)", north],
+     *       LengthUnit["metre", 1],
+     *     Id["EPSG",5641]]
+     * }
+     * </div>
      *
      * @param  text Coordinate system encoded in Well-Known Text format (version 1 or 2).
      * @throws FactoryException if the object creation failed.
+     *
+     * @see org.apache.sis.io.wkt.WKTFormat
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">WKT
2 specification</a>
+     * @see <a href="http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html">Legacy
WKT 1</a>
      */
     @Override
     public CoordinateReferenceSystem createFromWKT(final String text) throws FactoryException
{



Mime
View raw message