You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2014/01/22 16:22:01 UTC
svn commit: r1560380 - in /sis/branches/JDK6: ./
core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/
core/sis-referencing/src/main/java/org/apache/sis/geometry/
core/sis-referencing/src/main/java/org/apache/sis/io/wkt/
core/sis-referenc...
Author: desruisseaux
Date: Wed Jan 22 15:22:00 2014
New Revision: 1560380
URL: http://svn.apache.org/r1560380
Log:
Merge from the JDK7 branch.
Added:
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
- copied unchanged from r1560378, sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
- copied unchanged from r1560378, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
Removed:
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java
Modified:
sis/branches/JDK6/ (props changed)
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Legacy.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
Propchange: sis/branches/JDK6/
------------------------------------------------------------------------------
Merged /sis/branches/JDK7:r1559290-1560378
Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -460,11 +460,11 @@ public class DefaultGeographicBoundingBo
* is assumed already in appropriate CRS.
*
* <p>When coordinate transformation is required, the target geographic CRS is not necessarily
- * {@linkplain org.apache.sis.referencing.GeodeticObjects#WGS84 WGS84}. This method preserves
- * the same {@linkplain org.apache.sis.referencing.datum.DefaultEllipsoid ellipsoid} than in
- * the envelope CRS when possible. This is because geographic bounding box are only approximative
- * and the ISO specification do not mandates a particular CRS,
- * so we avoid transformations that are not strictly necessary.</p>
+ * {@linkplain org.apache.sis.referencing.CommonCRS#WGS84 WGS84}. This method preserves the same
+ * {@linkplain org.apache.sis.referencing.datum.DefaultEllipsoid ellipsoid} than in the envelope
+ * CRS when possible. This is because geographic bounding box are only approximative and the ISO
+ * specification do not mandates a particular CRS, so we avoid transformations that are not
+ * strictly necessary.</p>
*
* <p><b>Note:</b> This method is available only if the referencing module is on the classpath.</p>
*
Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -208,7 +208,7 @@ public final class Extents extends Stati
* it does not specify the datum), the value returned by this method is also approximative.
*
* <p>The current implementation performs its computation on the
- * {@linkplain org.apache.sis.referencing.GeodeticObjects#SPHERE GRS 1980 Authalic Sphere}.
+ * {@linkplain org.apache.sis.referencing.CommonCRS#SPHERE GRS 1980 Authalic Sphere}.
* However this may change in any future SIS version.</p>
*
* @param box The geographic bounding box for which to compute the area, or {@code null}.
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -30,7 +30,7 @@ import org.opengis.geometry.MismatchedRe
import org.opengis.metadata.extent.GeographicBoundingBox;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.apache.sis.referencing.GeodeticObjects;
+import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.resources.Errors;
@@ -177,7 +177,7 @@ class ArrayEnvelope extends AbstractEnve
/**
* Constructs a new envelope with the same data than the specified geographic bounding box.
* The coordinate reference system is set to the
- * {@linkplain org.apache.sis.referencing.GeodeticObjects#defaultGeographic() default geographic CRS}.
+ * {@linkplain org.apache.sis.referencing.CommonCRS#defaultGeographic() default geographic CRS}.
* Axis order is (<var>longitude</var>, <var>latitude</var>).
*
* @param box The bounding box to copy.
@@ -196,7 +196,7 @@ class ArrayEnvelope extends AbstractEnve
ArraysExt.swap(ordinates, 1, (ordinates.length >>> 1) + 1);
}
}
- crs = GeodeticObjects.defaultGeographic();
+ crs = CommonCRS.defaultGeographic();
}
/**
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -25,7 +25,7 @@ import org.opengis.metadata.extent.Geogr
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.cs.AxisDirection;
-import org.apache.sis.referencing.GeodeticObjects;
+import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.Emptiable;
@@ -200,7 +200,7 @@ public class Envelope2D extends Rectangl
/**
* Constructs a new envelope with the same data than the specified geographic bounding box.
* The coordinate reference system is set to the
- * {@linkplain org.apache.sis.referencing.GeodeticObjects#defaultGeographic() default geographic CRS}.
+ * {@linkplain org.apache.sis.referencing.CommonCRS#defaultGeographic() default geographic CRS}.
* Axis order is (<var>longitude</var>, <var>latitude</var>).
*
* @param box The bounding box to copy (can not be {@code null}).
@@ -210,7 +210,7 @@ public class Envelope2D extends Rectangl
box.getSouthBoundLatitude(),
box.getEastBoundLongitude(),
box.getNorthBoundLatitude());
- crs = GeodeticObjects.defaultGeographic();
+ crs = CommonCRS.defaultGeographic();
if (Boolean.FALSE.equals(box.getInclusion())) {
x += width;
width = -width;
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -185,7 +185,7 @@ public class GeneralEnvelope extends Arr
/**
* Constructs a new envelope with the same data than the specified geographic bounding box.
* The coordinate reference system is set to the
- * {@linkplain org.apache.sis.referencing.GeodeticObjects#defaultGeographic() default geographic CRS}.
+ * {@linkplain org.apache.sis.referencing.CommonCRS#defaultGeographic() default geographic CRS}.
* Axis order is (<var>longitude</var>, <var>latitude</var>).
*
* @param box The bounding box to copy.
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -88,7 +88,7 @@ public final class ImmutableEnvelope ext
/**
* Constructs a new envelope with the same data than the specified geographic bounding box.
* The coordinate reference system is set to the
- * {@linkplain org.apache.sis.referencing.GeodeticObjects#defaultGeographic() default geographic CRS}.
+ * {@linkplain org.apache.sis.referencing.CommonCRS#defaultGeographic() default geographic CRS}.
* Axis order is (<var>longitude</var>, <var>latitude</var>).
*
* @param box The bounding box to copy.
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Legacy.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Legacy.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Legacy.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Legacy.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -19,6 +19,7 @@ package org.apache.sis.io.wkt;
import javax.measure.unit.SI;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CartesianCS;
+import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.referencing.cs.DefaultCartesianCS;
import org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis;
import org.apache.sis.util.Static;
@@ -55,15 +56,16 @@ final class Legacy extends Static {
new DefaultCoordinateSystemAxis(singletonMap(NAME_KEY, "Z"), "Z", AxisDirection.NORTH, SI.METRE));
/**
- * The standard three-dimensional Cartesian CS as defined by ISO 19111.
+ * Do not allow instantiation of this class.
*/
- @Deprecated
- static CartesianCS STANDARD; // TODO: Not supported yet.
+ private Legacy() {
+ }
/**
- * Do not allow instantiation of this class.
+ * The standard three-dimensional Cartesian CS as defined by ISO 19111.
*/
- private Legacy() {
+ private static CartesianCS standard() {
+ return (CartesianCS) CommonCRS.WGS84.geocentric().getCoordinateSystem();
}
/**
@@ -77,7 +79,7 @@ final class Legacy extends Static {
* or {@code cs} if the CS axes should be used as-is.
*/
static CartesianCS replace(final CartesianCS cs, final boolean toLegacy) {
- final CartesianCS check = toLegacy ? STANDARD : LEGACY;
+ final CartesianCS check = toLegacy ? standard() : LEGACY;
final int dimension = check.getDimension();
if (cs.getDimension() != dimension) {
return cs;
@@ -87,6 +89,6 @@ final class Legacy extends Static {
return cs;
}
}
- return toLegacy ? LEGACY : STANDARD;
+ return toLegacy ? LEGACY : standard();
}
}
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -60,18 +60,18 @@ public final class CRS extends Static {
*
* <blockquote><table class="sis">
* <tr><th>Code</th> <th>Enum</th> <th>CRS Type</th> <th>Description</th></tr>
- * <tr><td>CRS:27</td> <td>{@link GeodeticObjects#NAD27 NAD27}</td> <td>Geographic</td> <td>Like EPSG:4267 except for (<var>longitude</var>, <var>latitude</var>) axis order</td></tr>
- * <tr><td>CRS:83</td> <td>{@link GeodeticObjects#NAD83 NAD83}</td> <td>Geographic</td> <td>Like EPSG:4269 except for (<var>longitude</var>, <var>latitude</var>) axis order</td></tr>
- * <tr><td>CRS:84</td> <td>{@link GeodeticObjects#WGS84 WGS84}</td> <td>Geographic</td> <td>Like EPSG:4326 except for (<var>longitude</var>, <var>latitude</var>) axis order</td></tr>
- * <tr><td>EPSG:4047</td> <td>{@link GeodeticObjects#SPHERE SPHERE}</td> <td>Geographic</td> <td>GRS 1980 Authalic Sphere</td></tr>
- * <tr><td>EPSG:4230</td> <td>{@link GeodeticObjects#ED50 ED50}</td> <td>Geographic</td> <td>European Datum 1950</td></tr>
- * <tr><td>EPSG:4258</td> <td>{@link GeodeticObjects#ETRS89 ETRS89}</td> <td>Geographic</td> <td>European Terrestrial Reference Frame 1989</td></tr>
- * <tr><td>EPSG:4267</td> <td>{@link GeodeticObjects#NAD27 NAD27}</td> <td>Geographic</td> <td>North American Datum 1927</td></tr>
- * <tr><td>EPSG:4269</td> <td>{@link GeodeticObjects#NAD83 NAD83}</td> <td>Geographic</td> <td>North American Datum 1983</td></tr>
- * <tr><td>EPSG:4322</td> <td>{@link GeodeticObjects#WGS72 WGS72}</td> <td>Geographic</td> <td>World Geodetic System 1972</td></tr>
- * <tr><td>EPSG:4326</td> <td>{@link GeodeticObjects#WGS84 WGS84}</td> <td>Geographic</td> <td>World Geodetic System 1984</td></tr>
- * <tr><td>EPSG:5715</td> <td>{@link GeodeticObjects.Vertical#DEPTH DEPTH}</td> <td>Vertical</td> <td>Mean Sea Level depth</td></tr>
- * <tr><td>EPSG:5714</td> <td>{@link GeodeticObjects.Vertical#MEAN_SEA_LEVEL MEAN_SEA_LEVEL}</td> <td>Vertical</td> <td>Mean Sea Level height</td></tr>
+ * <tr><td>CRS:27</td> <td>{@link CommonCRS#NAD27 NAD27}</td> <td>Geographic</td> <td>Like EPSG:4267 except for (<var>longitude</var>, <var>latitude</var>) axis order</td></tr>
+ * <tr><td>CRS:83</td> <td>{@link CommonCRS#NAD83 NAD83}</td> <td>Geographic</td> <td>Like EPSG:4269 except for (<var>longitude</var>, <var>latitude</var>) axis order</td></tr>
+ * <tr><td>CRS:84</td> <td>{@link CommonCRS#WGS84 WGS84}</td> <td>Geographic</td> <td>Like EPSG:4326 except for (<var>longitude</var>, <var>latitude</var>) axis order</td></tr>
+ * <tr><td>EPSG:4047</td> <td>{@link CommonCRS#SPHERE SPHERE}</td> <td>Geographic</td> <td>GRS 1980 Authalic Sphere</td></tr>
+ * <tr><td>EPSG:4230</td> <td>{@link CommonCRS#ED50 ED50}</td> <td>Geographic</td> <td>European Datum 1950</td></tr>
+ * <tr><td>EPSG:4258</td> <td>{@link CommonCRS#ETRS89 ETRS89}</td> <td>Geographic</td> <td>European Terrestrial Reference Frame 1989</td></tr>
+ * <tr><td>EPSG:4267</td> <td>{@link CommonCRS#NAD27 NAD27}</td> <td>Geographic</td> <td>North American Datum 1927</td></tr>
+ * <tr><td>EPSG:4269</td> <td>{@link CommonCRS#NAD83 NAD83}</td> <td>Geographic</td> <td>North American Datum 1983</td></tr>
+ * <tr><td>EPSG:4322</td> <td>{@link CommonCRS#WGS72 WGS72}</td> <td>Geographic</td> <td>World Geodetic System 1972</td></tr>
+ * <tr><td>EPSG:4326</td> <td>{@link CommonCRS#WGS84 WGS84}</td> <td>Geographic</td> <td>World Geodetic System 1984</td></tr>
+ * <tr><td>EPSG:5715</td> <td>{@link CommonCRS.Vertical#DEPTH DEPTH}</td> <td>Vertical</td> <td>Mean Sea Level depth</td></tr>
+ * <tr><td>EPSG:5714</td> <td>{@link CommonCRS.Vertical#MEAN_SEA_LEVEL MEAN_SEA_LEVEL}</td> <td>Vertical</td> <td>Mean Sea Level height</td></tr>
* </table></blockquote>
*
* This method accepts also the URN and URL syntax.
@@ -116,18 +116,18 @@ public final class CRS extends Static {
try {
if (authority.equalsIgnoreCase("CRS")) {
switch (Integer.parseInt(value)) {
- case 27: return GeodeticObjects.NAD27.normalizedGeographic();
- case 83: return GeodeticObjects.NAD83.normalizedGeographic();
- case 84: return GeodeticObjects.WGS84.normalizedGeographic();
+ case 27: return CommonCRS.NAD27.normalizedGeographic();
+ case 83: return CommonCRS.NAD83.normalizedGeographic();
+ case 84: return CommonCRS.WGS84.normalizedGeographic();
}
} else if (authority.equalsIgnoreCase("EPSG")) {
final int n = Integer.parseInt(value);
- for (final GeodeticObjects candidate : GeodeticObjects.values()) {
+ for (final CommonCRS candidate : CommonCRS.values()) {
if (candidate.geographic == n) {
return candidate.geographic();
}
}
- for (final GeodeticObjects.Vertical candidate : GeodeticObjects.Vertical.values()) {
+ for (final CommonCRS.Vertical candidate : CommonCRS.Vertical.values()) {
if (candidate.isEPSG && candidate.crs == n) {
return candidate.crs();
}
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -34,12 +34,14 @@ import org.opengis.referencing.cs.Coordi
import org.opengis.referencing.cs.EllipsoidalCS;
import org.opengis.referencing.crs.GeographicCRS;
import org.opengis.referencing.crs.VerticalCRS;
+import org.apache.sis.metadata.iso.extent.Extents;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.referencing.datum.DefaultEllipsoid;
import org.apache.sis.referencing.datum.DefaultPrimeMeridian;
import org.apache.sis.referencing.datum.DefaultGeodeticDatum;
import org.apache.sis.referencing.datum.DefaultVerticalDatum;
import org.apache.sis.referencing.cs.DefaultVerticalCS;
+import org.apache.sis.referencing.cs.DefaultCartesianCS;
import org.apache.sis.referencing.cs.DefaultEllipsoidalCS;
import org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis;
import org.apache.sis.referencing.crs.DefaultGeographicCRS;
@@ -50,11 +52,12 @@ import org.apache.sis.measure.Latitude;
import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
import static org.opengis.referencing.IdentifiedObject.ALIAS_KEY;
import static org.opengis.referencing.IdentifiedObject.IDENTIFIERS_KEY;
+import static org.opengis.referencing.datum.Datum.DOMAIN_OF_VALIDITY_KEY;
import static org.apache.sis.internal.metadata.ReferencingServices.AUTHALIC_RADIUS;
/**
- * Definitions of referencing objects identified by the {@link GeodeticObjects} enumeration values.
+ * Definitions of referencing objects identified by the {@link CommonCRS} enumeration values.
* This class is used only as a fallback if the objects can not be fetched from the EPSG database.
*
* @author Martin Desruisseaux (Geomatys)
@@ -80,13 +83,17 @@ final class StandardDefinitions {
* @param code The EPSG code.
* @param name The object name.
* @param alias The alias, or {@code null} if none.
+ * @param world {@code true} if the properties shall have an entry for the domain of validity.
* @return The map of properties to give to constructors or factory methods.
*/
- private static Map<String,Object> properties(final short code, final String name, final String alias) {
+ private static Map<String,Object> properties(final short code, final String name, final String alias, final boolean world) {
final Map<String,Object> map = new HashMap<String,Object>(8);
map.put(IDENTIFIERS_KEY, new NamedIdentifier(Citations.EPSG, String.valueOf(code)));
map.put(NAME_KEY, new NamedIdentifier(Citations.EPSG, name));
map.put(ALIAS_KEY, alias); // May be null, which is okay.
+ if (world) {
+ map.put(DOMAIN_OF_VALIDITY_KEY, Extents.WORLD);
+ }
return map;
}
@@ -101,17 +108,18 @@ final class StandardDefinitions {
static GeographicCRS createGeographicCRS(final short code, final GeodeticDatum datum, final EllipsoidalCS cs) {
final String name;
String alias = null;
+ boolean world = false;
switch (code) {
- case 4326: name = "WGS 84"; break;
- case 4322: name = "WGS 72"; break;
+ case 4326: name = "WGS 84"; world = true; break;
+ case 4322: name = "WGS 72"; world = true; break;
case 4258: name = "ETRS89"; alias = "ETRS89-GRS80"; break;
- case 4269: name = "NAD83"; break;
- case 4267: name = "NAD27"; break;
- case 4230: name = "ED50"; break;
- case 4047: name = "Unspecified datum based upon the GRS 1980 Authalic Sphere"; break;
+ case 4269: name = "NAD83"; break;
+ case 4267: name = "NAD27"; break;
+ case 4230: name = "ED50"; break;
+ case 4047: name = "Unspecified datum based upon the GRS 1980 Authalic Sphere"; world = true; break;
default: throw new AssertionError(code);
}
- return new DefaultGeographicCRS(properties(code, name, alias), datum, cs);
+ return new DefaultGeographicCRS(properties(code, name, alias, world), datum, cs);
}
/**
@@ -125,17 +133,18 @@ final class StandardDefinitions {
static GeodeticDatum createGeodeticDatum(final short code, final Ellipsoid ellipsoid, final PrimeMeridian meridian) {
final String name;
final String alias;
+ boolean world = false;
switch (code) {
- case 6326: name = "World Geodetic System 1984"; alias = "WGS 84"; break;
- case 6322: name = "World Geodetic System 1972"; alias = "WGS 72"; break;
- case 6258: name = "European Terrestrial Reference System 1989"; alias = "ETRS89"; break;
- case 6269: name = "North American Datum 1983"; alias = "NAD83"; break;
- case 6267: name = "North American Datum 1927"; alias = "NAD27"; break;
- case 6230: name = "European Datum 1950"; alias = "ED50"; break;
- case 6047: name = "Not specified (based on GRS 1980 Authalic Sphere)"; alias = null; break;
+ case 6326: name = "World Geodetic System 1984"; alias = "WGS 84"; world = true; break;
+ case 6322: name = "World Geodetic System 1972"; alias = "WGS 72"; world = true; break;
+ case 6258: name = "European Terrestrial Reference System 1989"; alias = "ETRS89"; break;
+ case 6269: name = "North American Datum 1983"; alias = "NAD83"; break;
+ case 6267: name = "North American Datum 1927"; alias = "NAD27"; break;
+ case 6230: name = "European Datum 1950"; alias = "ED50"; break;
+ case 6047: name = "Not specified (based on GRS 1980 Authalic Sphere)"; alias = null; world = true; break;
default: throw new AssertionError(code);
}
- return new DefaultGeodeticDatum(properties(code, name, alias), ellipsoid, meridian);
+ return new DefaultGeodeticDatum(properties(code, name, alias, world), ellipsoid, meridian);
}
/**
@@ -160,7 +169,7 @@ final class StandardDefinitions {
case 7048: name = "GRS 1980 Authalic Sphere"; ivfDefinitive = false; semiMajorAxis = other = AUTHALIC_RADIUS; break;
default: throw new AssertionError(code);
}
- final Map<String,Object> map = properties(code, name, alias);
+ final Map<String,Object> map = properties(code, name, alias, false);
if (ivfDefinitive) {
return DefaultEllipsoid.createFlattenedSphere(map, semiMajorAxis, other, unit);
} else {
@@ -194,8 +203,8 @@ final class StandardDefinitions {
case 5715: name = "MSL depth"; alias = "mean sea level depth"; cs = "Vertical CS. Axis: depth (D)."; c = 6498; axis = 113; break;
default: throw new AssertionError(code);
}
- return new DefaultVerticalCRS(properties(code, name, alias), datum,
- new DefaultVerticalCS(properties(c, cs, null), createAxis(axis)));
+ return new DefaultVerticalCRS(properties(code, name, alias, true), datum,
+ new DefaultVerticalCS(properties(c, cs, null, false), createAxis(axis)));
}
/**
@@ -211,7 +220,7 @@ final class StandardDefinitions {
case 5100: name = "Mean Sea Level"; alias = "MSL"; break;
default: throw new AssertionError(code);
}
- return new DefaultVerticalDatum(properties(code, name, alias), VerticalDatumType.GEOIDAL);
+ return new DefaultVerticalDatum(properties(code, name, alias, true), VerticalDatumType.GEOIDAL);
}
/**
@@ -222,22 +231,35 @@ final class StandardDefinitions {
* @param code The EPSG code.
* @return The coordinate system for the given code.
*/
+ @SuppressWarnings("fallthrough")
static CoordinateSystem createCoordinateSystem(final short code) {
final String name;
- short xc, yc, zc = 0; // Not necessarily (long, lat) order.
+ final int dim; // Number of dimension.
+ short axisCode; // Code of first axis + dim (or code after the last axis).
+ boolean isCartesian = false;
switch (code) {
- case 6422: name = "Ellipsoidal 2D"; xc = 106; yc = 107; break;
- case 6423: name = "Ellipsoidal 3D"; xc = 108; yc = 109; zc = 110; break;
+ case 6422: name = "Ellipsoidal 2D"; dim = 2; axisCode = 108; break;
+ case 6423: name = "Ellipsoidal 3D"; dim = 3; axisCode = 111; break;
+ case 6500: name = "Earth centred"; dim = 3; axisCode = 118; isCartesian = true; break;
default: throw new AssertionError(code);
}
- final Map<String,?> properties = properties(code, name, null);
- final CoordinateSystemAxis xAxis = createAxis(xc);
- final CoordinateSystemAxis yAxis = createAxis(yc);
- if (zc != 0) {
- final CoordinateSystemAxis zAxis = createAxis(zc);
+ final Map<String,?> properties = properties(code, name, null, false);
+ CoordinateSystemAxis xAxis = null, yAxis = null, zAxis = null;
+ switch (dim) {
+ default: throw new AssertionError(dim);
+ case 3: zAxis = createAxis(--axisCode);
+ case 2: yAxis = createAxis(--axisCode);
+ case 1: xAxis = createAxis(--axisCode);
+ case 0: break;
+ }
+ if (isCartesian) {
+ return new DefaultCartesianCS(properties, xAxis, yAxis, zAxis);
+ }
+ if (zAxis != null) {
return new DefaultEllipsoidalCS(properties, xAxis, yAxis, zAxis);
+ } else {
+ return new DefaultEllipsoidalCS(properties, xAxis, yAxis);
}
- return new DefaultEllipsoidalCS(properties, xAxis, yAxis);
}
/**
@@ -248,12 +270,13 @@ final class StandardDefinitions {
*/
static CoordinateSystemAxis createAxis(final short code) {
final String name, abrv;
- final Unit<?> unit;
+ Unit<?> unit = SI.METRE;
double min = Double.NEGATIVE_INFINITY;
double max = Double.POSITIVE_INFINITY;
RangeMeaning rm = null;
final AxisDirection dir;
switch (code) {
+ case 108: // Used in Ellipsoidal 3D.
case 106: name = "Geodetic latitude";
abrv = "φ";
unit = NonSI.DEGREE_ANGLE;
@@ -262,6 +285,7 @@ final class StandardDefinitions {
max = Latitude.MAX_VALUE;
rm = RangeMeaning.EXACT;
break;
+ case 109: // Used in Ellipsoidal 3D.
case 107: name = "Geodetic longitude";
abrv = "λ";
unit = NonSI.DEGREE_ANGLE;
@@ -272,21 +296,30 @@ final class StandardDefinitions {
break;
case 110: name = "Ellipsoidal height";
abrv = "h";
- unit = SI.METRE;
dir = AxisDirection.UP;
break;
case 114: name = "Gravity-related height";
abrv = "H";
- unit = SI.METRE;
dir = AxisDirection.UP;
break;
case 113: name = "Depth";
abrv = "D";
- unit = SI.METRE;
dir = AxisDirection.DOWN;
break;
+ case 115: name = "Geocentric X";
+ abrv = "X";
+ dir = AxisDirection.GEOCENTRIC_X;
+ break;
+ case 116: name = "Geocentric Y";
+ abrv = "Y";
+ dir = AxisDirection.GEOCENTRIC_Y;
+ break;
+ case 117: name = "Geocentric Z";
+ abrv = "Z";
+ dir = AxisDirection.GEOCENTRIC_Z;
+ break;
default: throw new AssertionError(code);
}
- return new DefaultCoordinateSystemAxis(properties(code, name, null), abrv, dir, unit, min, max, rm);
+ return new DefaultCoordinateSystemAxis(properties(code, name, null, false), abrv, dir, unit, min, max, rm);
}
}
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -114,7 +114,7 @@ public enum AxesConvention {
* {@note The rules for normalized coordinate systems may be adjusted in future SIS versions based on experience
* gained. For more predictable results, consider using the <code>RIGHT_HANDED</code> enum instead.}
*
- * @see org.apache.sis.referencing.GeodeticObjects#normalizedGeographic()
+ * @see org.apache.sis.referencing.CommonCRS#normalizedGeographic()
*/
NORMALIZED,
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -571,6 +571,22 @@ public class DefaultCoordinateSystemAxis
}
/**
+ * Compares the unit and direction of this axis with the ones of the given axis.
+ * The range minimum and maximum values are compared only if {@code cr} is {@code true},
+ * i.e. it is caller responsibility to determine if range shall be considered as metadata.
+ *
+ * @param that The axis to compare with this axis.
+ * @param cr {@code true} for comparing also the range minimum and maximum values.
+ * @return {@code true} if unit, direction and optionally range extremum are equal.
+ */
+ private boolean equalsIgnoreMetadata(final CoordinateSystemAxis that, final boolean cr) {
+ return Objects.equals(getUnit(), that.getUnit()) &&
+ Objects.equals(getDirection(), that.getDirection()) &&
+ (!cr || (doubleToLongBits(getMinimumValue()) == doubleToLongBits(that.getMinimumValue()) &&
+ doubleToLongBits(getMaximumValue()) == doubleToLongBits(that.getMaximumValue())));
+ }
+
+ /**
* Compares the specified object with this axis for equality.
*
* @param object The object to compare to {@code this}.
@@ -587,21 +603,33 @@ public class DefaultCoordinateSystemAxis
if (!super.equals(object, mode)) {
return false;
}
- final DefaultCoordinateSystemAxis that = castOrCopy((CoordinateSystemAxis) object);
- if (!Objects.equals(direction, that.direction) || !Objects.equals(unit, that.unit)) {
- return false;
+ switch (mode) {
+ case STRICT: {
+ final DefaultCoordinateSystemAxis that = (DefaultCoordinateSystemAxis) object;
+ return Objects.equals(unit, that.unit) &&
+ Objects.equals(direction, that.direction) &&
+ Objects.equals(abbreviation, that.abbreviation) &&
+ Objects.equals(rangeMeaning, that.rangeMeaning) &&
+ doubleToLongBits(minimumValue) == doubleToLongBits(that.minimumValue) &&
+ doubleToLongBits(maximumValue) == doubleToLongBits(that.maximumValue);
+ }
+ case BY_CONTRACT: {
+ final CoordinateSystemAxis that = (CoordinateSystemAxis) object;
+ return equalsIgnoreMetadata(that, true) &&
+ Objects.equals(getAbbreviation(), that.getAbbreviation()) &&
+ Objects.equals(getRangeMeaning(), that.getRangeMeaning());
+ }
}
/*
- * It is important to NOT compare the minimum and maximum values when we are in
- * "ignore metadata" mode, because we want CRS with a [-180 … +180]° longitude
- * range to be considered equivalent, from a coordinate transformation point of
- * view, to a CRS with a [0 … 360]° longitude range.
+ * At this point the comparison is in "ignore metadata" mode. We compare the axis range
+ * only if the range meaning is "wraparound" for both axes, because only in such case a
+ * coordinate operation may shift some ordinate values (typically ±360° on longitudes).
*/
- if (mode.ordinal() < ComparisonMode.IGNORE_METADATA.ordinal()) {
- return Objects.equals(abbreviation, that.abbreviation) &&
- Objects.equals(rangeMeaning, that.rangeMeaning) &&
- doubleToLongBits(minimumValue) == doubleToLongBits(that.minimumValue) &&
- doubleToLongBits(maximumValue) == doubleToLongBits(that.maximumValue);
+ final CoordinateSystemAxis that = (CoordinateSystemAxis) object;
+ if (!equalsIgnoreMetadata(that, RangeMeaning.WRAPAROUND.equals(this.getRangeMeaning()) &&
+ RangeMeaning.WRAPAROUND.equals(that.getRangeMeaning())))
+ {
+ return false;
}
ReferenceIdentifier name = that.getName();
if (name != UNNAMED) {
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -86,7 +86,7 @@ import org.apache.sis.internal.jdk7.Obje
*
* <ol>
* <li>Create an {@code Ellipsoid} from one of the static convenience shortcuts listed in
- * {@link org.apache.sis.referencing.GeodeticObjects#ellipsoid()}.</li>
+ * {@link org.apache.sis.referencing.CommonCRS#ellipsoid()}.</li>
* <li>Create an {@code Ellipsoid} from an identifier in a database by invoking
* {@link org.opengis.referencing.datum.DatumAuthorityFactory#createEllipsoid(String)}.</li>
* <li>Create an {@code Ellipsoid} by invoking the {@code createEllipsoid(…)} or {@code createFlattenedSphere(…)}
@@ -100,7 +100,7 @@ import org.apache.sis.internal.jdk7.Obje
* <b>Example:</b> the following code gets the WGS84 ellipsoid:
*
* {@preformat java
- * Ellipsoid e = GeodeticObjects.WGS84.ellipsoid();
+ * Ellipsoid e = CommonCRS.WGS84.ellipsoid();
* }
*
* {@section Immutability and thread safety}
@@ -114,7 +114,7 @@ import org.apache.sis.internal.jdk7.Obje
* @version 0.4
* @module
*
- * @see org.apache.sis.referencing.GeodeticObjects#ellipsoid()
+ * @see org.apache.sis.referencing.CommonCRS#ellipsoid()
*/
@XmlType(name="EllipsoidType", propOrder={
"semiMajorAxisMeasure",
@@ -456,7 +456,7 @@ public class DefaultEllipsoid extends Ab
*
* @return The radius of a sphere having the same surface than this ellipsoid.
*
- * @see org.apache.sis.referencing.GeodeticObjects#SPHERE
+ * @see org.apache.sis.referencing.CommonCRS#SPHERE
*/
public double getAuthalicRadius() {
return Formulas.getAuthalicRadius(getSemiMajorAxis(), getSemiMinorAxis());
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -88,7 +88,7 @@ import org.apache.sis.internal.jdk7.Obje
*
* <ol>
* <li>Create a {@code GeodeticDatum} from one of the static convenience shortcuts listed in
- * {@link org.apache.sis.referencing.GeodeticObjects#datum()}.</li>
+ * {@link org.apache.sis.referencing.CommonCRS#datum()}.</li>
* <li>Create a {@code GeodeticDatum} from an identifier in a database by invoking
* {@link org.opengis.referencing.datum.DatumAuthorityFactory#createGeodeticDatum(String)}.</li>
* <li>Create a {@code GeodeticDatum} by invoking the {@code createGeodeticDatum(…)}
@@ -100,7 +100,7 @@ import org.apache.sis.internal.jdk7.Obje
* <b>Example:</b> the following code gets a <cite>World Geodetic System 1984</cite> datum:
*
* {@preformat java
- * GeodeticDatum datum = GeodeticObjects.WGS84.datum();
+ * GeodeticDatum datum = CommonCRS.WGS84.datum();
* }
*
* {@section Immutability and thread safety}
@@ -116,7 +116,7 @@ import org.apache.sis.internal.jdk7.Obje
*
* @see DefaultEllipsoid
* @see DefaultPrimeMeridian
- * @see org.apache.sis.referencing.GeodeticObjects#datum()
+ * @see org.apache.sis.referencing.CommonCRS#datum()
*/
@XmlType(name = "GeodeticDatumType", propOrder = {
"primeMeridian",
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -56,7 +56,7 @@ import org.apache.sis.internal.jdk7.Obje
*
* <ol>
* <li>Create a {@code PrimeMeridian} from one of the static convenience shortcuts listed in
- * {@link org.apache.sis.referencing.GeodeticObjects#primeMeridian()}.</li>
+ * {@link org.apache.sis.referencing.CommonCRS#primeMeridian()}.</li>
* <li>Create a {@code PrimeMeridian} from an identifier in a database by invoking
* {@link org.opengis.referencing.datum.DatumAuthorityFactory#createPrimeMeridian(String)}.</li>
* <li>Create a {@code PrimeMeridian} by invoking the {@code createPrimeMeridian(…)}
@@ -68,7 +68,7 @@ import org.apache.sis.internal.jdk7.Obje
* <b>Example:</b> the following code gets the Greenwich prime meridian:
*
* {@preformat java
- * PrimeMeridian pm = GeodeticObjects.WGS84.primeMeridian();
+ * PrimeMeridian pm = CommonCRS.WGS84.primeMeridian();
* }
*
* {@section Immutability and thread safety}
@@ -82,7 +82,7 @@ import org.apache.sis.internal.jdk7.Obje
* @version 0.4
* @module
*
- * @see org.apache.sis.referencing.GeodeticObjects#primeMeridian()
+ * @see org.apache.sis.referencing.CommonCRS#primeMeridian()
*/
@XmlType(name = "PrimeMeridianType")
@XmlRootElement(name = "PrimeMeridian")
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java Wed Jan 22 15:22:00 2014
@@ -48,7 +48,7 @@ import org.apache.sis.internal.jdk7.Obje
*
* <ol>
* <li>Create a {@code TemporalDatum} from one of the static convenience shortcuts listed in
- * {@link org.apache.sis.referencing.GeodeticObjects.Temporal#datum()}.</li>
+ * {@link org.apache.sis.referencing.CommonCRS.Temporal#datum()}.</li>
* <li>Create a {@code TemporalDatum} from an identifier in a database by invoking
* {@link org.opengis.referencing.datum.DatumAuthorityFactory#createTemporalDatum(String)}.</li>
* <li>Create a {@code TemporalDatum} by invoking the {@code createTemporalDatum(â¦)}
@@ -60,7 +60,7 @@ import org.apache.sis.internal.jdk7.Obje
* <b>Example:</b> the following code gets a temporal datum having its origin at January 1st, 4713 BC at 12:00 UTC:
*
* {@preformat java
- * TemporalDatum datum = GeodeticObjects.Temporal.JULIAN.datum();
+ * TemporalDatum datum = CommonCRS.Temporal.JULIAN.datum();
* }
*
* {@section Immutability and thread safety}
@@ -73,7 +73,7 @@ import org.apache.sis.internal.jdk7.Obje
* @version 0.4
* @module
*
- * @see org.apache.sis.referencing.GeodeticObjects.Temporal#datum()
+ * @see org.apache.sis.referencing.CommonCRS.Temporal#datum()
* @see org.apache.sis.referencing.cs.DefaultTimeCS
* @see org.apache.sis.referencing.crs.DefaultTemporalCRS
*/
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -52,7 +52,7 @@ import org.apache.sis.internal.jdk7.Obje
*
* <ol>
* <li>Create a {@code VerticalDatum} from one of the static convenience shortcuts listed in
- * {@link org.apache.sis.referencing.GeodeticObjects.Vertical#datum()}.</li>
+ * {@link org.apache.sis.referencing.CommonCRS.Vertical#datum()}.</li>
* <li>Create a {@code VerticalDatum} from an identifier in a database by invoking
* {@link org.opengis.referencing.datum.DatumAuthorityFactory#createVerticalDatum(String)}.</li>
* <li>Create a {@code VerticalDatum} by invoking the {@code createVerticalDatum(…)}
@@ -64,7 +64,7 @@ import org.apache.sis.internal.jdk7.Obje
* <b>Example:</b> the following code gets a vertical datum for height above the geoid:
*
* {@preformat java
- * VerticalDatum datum = GeodeticObjects.Vertical.GEOID.datum();
+ * VerticalDatum datum = CommonCRS.Vertical.GEOID.datum();
* }
*
* {@section Immutability and thread safety}
@@ -77,7 +77,7 @@ import org.apache.sis.internal.jdk7.Obje
* @version 0.4
* @module
*
- * @see org.apache.sis.referencing.GeodeticObjects.Vertical#datum()
+ * @see org.apache.sis.referencing.CommonCRS.Vertical#datum()
* @see org.apache.sis.referencing.cs.DefaultVerticalCS
* @see org.apache.sis.referencing.crs.DefaultVerticalCRS
*/
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -30,7 +30,7 @@
* or constructor, or indirectly by specifying the identifier of an entry in a database. In particular,
* the <a href="http://www.epsg.org">EPSG</a> database provides definitions for many geodetic objects,
* and Apache SIS provides convenience shortcuts for some of them in the
- * {@link org.apache.sis.referencing.GeodeticObjects} enumerations.
+ * {@link org.apache.sis.referencing.CommonCRS} enumerations.
*
* {@section The EPSG database}
* The EPSG geodetic parameter dataset is a structured database required to:
@@ -53,7 +53,7 @@
* Relationship with EPSG has two components documented in the javadoc: the object type and the EPSG 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 org.apache.sis.referencing.GeodeticObjects#WGS84} documentation said that object
+ * For example the {@link org.apache.sis.referencing.CommonCRS#WGS84} documentation said that object
* of type <cite>geodetic datum</cite> is associated to code {@code EPSG:6326}.
* This means that the EPSG object could be obtained by the following code:
*
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -20,7 +20,7 @@ import java.awt.geom.Rectangle2D;
import org.opengis.geometry.Envelope;
import org.opengis.geometry.DirectPosition;
import org.opengis.referencing.crs.GeographicCRS;
-import org.apache.sis.referencing.GeodeticObjects;
+import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
@@ -56,7 +56,7 @@ public final strictfp class AbstractEnve
/**
* The coordinate reference system used for the tests.
*/
- static final GeographicCRS WGS84 = GeodeticObjects.WGS84.normalizedGeographic();
+ static final GeographicCRS WGS84 = CommonCRS.WGS84.normalizedGeographic();
/**
* Creates an envelope of the given type. The type shall be one of the
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -17,6 +17,8 @@
package org.apache.sis.internal.referencing;
import org.opengis.referencing.cs.AxisDirection;
+import org.opengis.referencing.cs.CoordinateSystem;
+import org.apache.sis.referencing.cs.HardCodedCS;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -308,4 +310,13 @@ public final strictfp class AxisDirectio
assertSame(GEOCENTRIC_Z, AxisDirections.valueOf("Geocentre > north pole"));
assertSame(GEOCENTRIC_Z, AxisDirections.valueOf("Geocentre>north pole "));
}
+
+ /**
+ * Tests {@link AxisDirections#indexOf(CoordinateSystem, AxisDirection)}.
+ */
+ @Test
+ public void testIndexOf() {
+ assertEquals(1, AxisDirections.indexOf(HardCodedCS.GEODETIC_3D, AxisDirection.NORTH));
+ assertEquals(1, AxisDirections.indexOf(HardCodedCS.GEODETIC_3D, AxisDirection.SOUTH));
+ }
}
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -35,7 +35,7 @@ import static org.junit.Assert.*;
* @module
*/
@DependsOn({
- GeodeticObjectsTest.class
+ CommonCRSTest.class
})
public final strictfp class CRSTest extends TestCase {
/**
@@ -52,17 +52,17 @@ public final strictfp class CRSTest exte
*/
@Test
public void testForEpsgCode() throws FactoryException {
- verifyForCode(GeodeticObjects.WGS84 .geographic(), "EPSG:4326");
- verifyForCode(GeodeticObjects.WGS84 .geographic(), "urn:ogc:def:crs:EPSG::4326");
- verifyForCode(GeodeticObjects.WGS84 .geographic(), "http://www.opengis.net/gml/srs/epsg.xml#4326");
- verifyForCode(GeodeticObjects.WGS72 .geographic(), "EPSG:4322");
- verifyForCode(GeodeticObjects.SPHERE.geographic(), "EPSG:4047");
- verifyForCode(GeodeticObjects.NAD83 .geographic(), "EPSG:4269");
- verifyForCode(GeodeticObjects.NAD27 .geographic(), "EPSG:4267");
- verifyForCode(GeodeticObjects.ETRS89.geographic(), "EPSG:4258");
- verifyForCode(GeodeticObjects.ED50 .geographic(), "EPSG:4230");
- assertSame("EPSG:5714", GeodeticObjects.Vertical.MEAN_SEA_LEVEL.crs(), CRS.forCode("EPSG:5714"));
- assertSame("EPSG:5715", GeodeticObjects.Vertical.DEPTH.crs(), CRS.forCode("EPSG:5715"));
+ verifyForCode(CommonCRS.WGS84 .geographic(), "EPSG:4326");
+ verifyForCode(CommonCRS.WGS84 .geographic(), "urn:ogc:def:crs:EPSG::4326");
+ verifyForCode(CommonCRS.WGS84 .geographic(), "http://www.opengis.net/gml/srs/epsg.xml#4326");
+ verifyForCode(CommonCRS.WGS72 .geographic(), "EPSG:4322");
+ verifyForCode(CommonCRS.SPHERE.geographic(), "EPSG:4047");
+ verifyForCode(CommonCRS.NAD83 .geographic(), "EPSG:4269");
+ verifyForCode(CommonCRS.NAD27 .geographic(), "EPSG:4267");
+ verifyForCode(CommonCRS.ETRS89.geographic(), "EPSG:4258");
+ verifyForCode(CommonCRS.ED50 .geographic(), "EPSG:4230");
+ assertSame("EPSG:5714", CommonCRS.Vertical.MEAN_SEA_LEVEL.crs(), CRS.forCode("EPSG:5714"));
+ assertSame("EPSG:5715", CommonCRS.Vertical.DEPTH.crs(), CRS.forCode("EPSG:5715"));
}
/**
@@ -73,8 +73,8 @@ public final strictfp class CRSTest exte
@Test
@DependsOnMethod("testForEpsgCode")
public void testForCrsCode() throws FactoryException {
- verifyForCode(GeodeticObjects.WGS84.normalizedGeographic(), "CRS:84");
- verifyForCode(GeodeticObjects.NAD83.normalizedGeographic(), "CRS:83");
- verifyForCode(GeodeticObjects.NAD27.normalizedGeographic(), "CRS:27");
+ verifyForCode(CommonCRS.WGS84.normalizedGeographic(), "CRS:84");
+ verifyForCode(CommonCRS.NAD83.normalizedGeographic(), "CRS:83");
+ verifyForCode(CommonCRS.NAD27.normalizedGeographic(), "CRS:27");
}
}
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -72,7 +72,7 @@ public final strictfp class StandardDefi
public void testCreateGographicCRS() {
final PrimeMeridian pm = StandardDefinitions.primeMeridian();
final EllipsoidalCS cs = (EllipsoidalCS) StandardDefinitions.createCoordinateSystem((short) 6422);
- for (final GeodeticObjects e : GeodeticObjects.values()) {
+ for (final CommonCRS e : CommonCRS.values()) {
final Ellipsoid ellipsoid = StandardDefinitions.createEllipsoid(e.ellipsoid);
switch (e) {
case WGS84: compare(GeodeticDatumMock.WGS84 .getEllipsoid(), ellipsoid); break;
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -17,8 +17,10 @@
package org.apache.sis.referencing.crs;
import org.opengis.test.Validators;
+import org.opengis.referencing.cs.EllipsoidalCS;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.apache.sis.referencing.cs.AxesConvention;
+import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -44,7 +46,8 @@ public final strictfp class DefaultGeogr
private static final double STRICT = 0;
/**
- * Tests the {@link DefaultGeographicCRS#forConvention(AxesConvention)} method.
+ * Tests the {@link DefaultGeographicCRS#forConvention(AxesConvention)} method
+ * for {@link AxesConvention#POSITIVE_RANGE}.
*/
@Test
public void testShiftLongitudeRange() {
@@ -64,4 +67,20 @@ public final strictfp class DefaultGeogr
assertSame("Expected a no-op.", shifted, shifted.forConvention(AxesConvention.POSITIVE_RANGE));
assertSame("Expected cached instance.", shifted, crs .forConvention(AxesConvention.POSITIVE_RANGE));
}
+
+ /**
+ * Tests the {@link DefaultGeographicCRS#forConvention(AxesConvention)} method
+ * for {@link AxesConvention#NORMALIZED}.
+ */
+ @Test
+ public void testNormalize() {
+ final DefaultGeographicCRS crs = DefaultGeographicCRS.castOrCopy(CommonCRS.WGS84.geographic3D());
+ final DefaultGeographicCRS normalized = crs.forConvention(AxesConvention.NORMALIZED);
+ assertNotSame(crs, normalized);
+ final EllipsoidalCS cs = normalized.getCoordinateSystem();
+ final EllipsoidalCS ref = crs.getCoordinateSystem();
+ assertSame("longitude", ref.getAxis(1), cs.getAxis(0));
+ assertSame("latitude", ref.getAxis(0), cs.getAxis(1));
+ assertSame("height", ref.getAxis(2), cs.getAxis(2));
+ }
}
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -16,6 +16,7 @@
*/
package org.apache.sis.referencing.cs;
+import javax.measure.unit.SI;
import javax.measure.converter.ConversionException;
import org.opengis.referencing.operation.Matrix;
import org.opengis.referencing.cs.AxisDirection;
@@ -31,6 +32,7 @@ import org.junit.Test;
import static java.lang.Double.NaN;
import static java.util.Collections.singletonMap;
import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
+import static org.apache.sis.referencing.IdentifiedObjects.getProperties;
import static org.apache.sis.referencing.cs.CoordinateSystems.*;
import static org.apache.sis.test.Assert.*;
@@ -240,4 +242,31 @@ public final strictfp class CoordinateSy
-1, 0, 0, 0,
0, 0, 0, 1}), swapAndScaleAxes(yxh, hxy), STRICT);
}
+
+ /**
+ * Tests {@link CoordinateSystems#swapAndScaleAxes(CoordinateSystem, CoordinateSystem)} with a non-square matrix.
+ *
+ * @throws ConversionException Should not happen.
+ */
+ @Test
+ @DependsOnMethod("testSwapAndScaleAxes")
+ public void testScaleAndSwapAxesNonSquare() throws ConversionException {
+ final DefaultCartesianCS cs = new DefaultCartesianCS(singletonMap(NAME_KEY, "Test"),
+ new DefaultCoordinateSystemAxis(getProperties(HardCodedAxes.SOUTHING), "y", AxisDirection.SOUTH, SI.CENTIMETRE),
+ new DefaultCoordinateSystemAxis(getProperties(HardCodedAxes.EASTING), "x", AxisDirection.EAST, SI.MILLIMETRE));
+
+ Matrix matrix = swapAndScaleAxes(HardCodedCS.CARTESIAN_2D, cs);
+ assertMatrixEquals("(x,y) → (y,x)", Matrices.create(3, 3, new double[] {
+ 0, -100, 0,
+ 1000, 0, 0,
+ 0, 0, 1
+ }), matrix, STRICT);
+
+ matrix = swapAndScaleAxes(HardCodedCS.CARTESIAN_3D, cs);
+ assertMatrixEquals("(x,y,z) → (y,x)", Matrices.create(3, 4, new double[] {
+ 0, -100, 0, 0,
+ 1000, 0, 0, 0,
+ 0, 0, 0, 1
+ }), matrix, STRICT);
+ }
}
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -134,6 +134,10 @@ public final strictfp class DefaultCoord
assertTrue ("Longitude", LONGITUDE.equals(GEODETIC_LONGITUDE, ComparisonMode.IGNORE_METADATA));
assertTrue ("Latitude", LATITUDE .equals(GEODETIC_LATITUDE, ComparisonMode.IGNORE_METADATA));
assertFalse("Lon/Lat", LATITUDE .equals(LONGITUDE, ComparisonMode.IGNORE_METADATA));
+ /*
+ * Ensures that difference in "wraparound" ranges causes the axes to be considered different.
+ */
+ assertFalse(GEODETIC_LONGITUDE.equals(SHIFTED_LONGITUDE, ComparisonMode.IGNORE_METADATA));
}
/**
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1560380&r1=1560379&r2=1560380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Wed Jan 22 15:22:00 2014
@@ -77,7 +77,7 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.crs.DefaultCompoundCRSTest.class,
org.apache.sis.referencing.crs.HardCodedCRSTest.class,
org.apache.sis.referencing.StandardDefinitionsTest.class,
- org.apache.sis.referencing.GeodeticObjectsTest.class,
+ org.apache.sis.referencing.CommonCRSTest.class,
org.apache.sis.referencing.CRSTest.class,
org.apache.sis.geometry.AbstractDirectPositionTest.class,