Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -97,6 +97,7 @@ import org.apache.sis.internal.jdk7.Obje DefaultGeodeticCRS.class, DefaultVerticalCRS.class, DefaultTemporalCRS.class, + DefaultParametricCRS.class, DefaultEngineeringCRS.class, DefaultImageCRS.class, DefaultCompoundCRS.class @@ -159,12 +160,12 @@ public class AbstractCRS extends Abstrac * <td>{@link #getRemarks()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#DOMAIN_OF_VALIDITY_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#DOMAIN_OF_VALIDITY_KEY}</td> * <td>{@link org.opengis.metadata.extent.Extent}</td> * <td>{@link #getDomainOfValidity()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#SCOPE_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#SCOPE_KEY}</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getScope()}</td> * </tr>
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -170,12 +170,12 @@ public class DefaultCompoundCRS extends * <td>{@link #getRemarks()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#DOMAIN_OF_VALIDITY_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#DOMAIN_OF_VALIDITY_KEY}</td> * <td>{@link org.opengis.metadata.extent.Extent}</td> * <td>{@link #getDomainOfValidity()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#SCOPE_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#SCOPE_KEY}</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getScope()}</td> * </tr> Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -27,6 +27,7 @@ import org.opengis.referencing.datum.Dat import org.opengis.referencing.datum.GeodeticDatum; import org.opengis.referencing.datum.VerticalDatum; import org.opengis.referencing.datum.TemporalDatum; +import org.opengis.referencing.datum.ParametricDatum; import org.opengis.referencing.datum.EngineeringDatum; import org.opengis.referencing.crs.SingleCRS; import org.opengis.referencing.crs.DerivedCRS; @@ -34,11 +35,13 @@ import org.opengis.referencing.crs.Geode import org.opengis.referencing.crs.VerticalCRS; import org.opengis.referencing.crs.TemporalCRS; import org.opengis.referencing.crs.ProjectedCRS; +import org.opengis.referencing.crs.ParametricCRS; import org.opengis.referencing.crs.EngineeringCRS; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.cs.CoordinateSystem; import org.opengis.referencing.cs.VerticalCS; import org.opengis.referencing.cs.TimeCS; +import org.opengis.referencing.cs.ParametricCS; import org.opengis.referencing.operation.Conversion; import org.opengis.referencing.operation.OperationMethod; import org.opengis.referencing.operation.MathTransform; @@ -76,6 +79,7 @@ import org.apache.sis.util.Classes; * <tr><td>{@link GeodeticCRS}</td> <td>Base CRS is also a {@code GeodeticCRS} and is associated to the same type of coordinate system.</td></tr> * <tr><td>{@link VerticalCRS}</td> <td>Base CRS is also a {@code VerticalCRS} and coordinate system is a {@code VerticalCS}.</td></tr> * <tr><td>{@link TemporalCRS}</td> <td>Base CRS is also a {@code TemporalCRS} and coordinate system is a {@code TimeCS}.</td></tr> + * <tr><td>{@link ParametricCRS}</td> <td>Base CRS is also a {@code ParametricCRS} and coordinate system is a {@code ParametricCS}.</td></tr> * <tr><td>{@link EngineeringCRS}</td> <td>Base CRS is a {@code GeodeticCRS}, {@code ProjectedCRS} or {@code EngineeringCRS}.</td></tr> * </table> * @@ -90,6 +94,7 @@ import org.apache.sis.util.Classes; * synchronization. * * @author Martin Desruisseaux (IRD, Geomatys) + * @author Johann Sorel (Geomatys) * @since 0.6 * @version 0.7 * @module @@ -142,12 +147,12 @@ public class DefaultDerivedCRS extends A * <td>{@link #getRemarks()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#DOMAIN_OF_VALIDITY_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#DOMAIN_OF_VALIDITY_KEY}</td> * <td>{@link org.opengis.metadata.extent.Extent}</td> * <td>{@link #getDomainOfValidity()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#SCOPE_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#SCOPE_KEY}</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getScope()}</td> * </tr> @@ -263,7 +268,8 @@ public class DefaultDerivedCRS extends A * This method expects the same arguments and performs the same work than the * {@linkplain #DefaultDerivedCRS(Map, SingleCRS, Conversion, CoordinateSystem) above constructor}, * except that the {@code DerivedCRS} instance returned by this method may additionally implement - * the {@link GeodeticCRS}, {@link VerticalCRS}, {@link TemporalCRS} or {@link EngineeringCRS} interface. + * the {@link GeodeticCRS}, {@link VerticalCRS}, {@link TemporalCRS}, {@link ParametricCRS} or + * {@link EngineeringCRS} interface. * See the class javadoc for more information. * * @param properties The properties to be given to the new derived CRS object. @@ -287,9 +293,10 @@ public class DefaultDerivedCRS extends A if (baseCRS != null && derivedCS != null) { final String type = getType(baseCRS, derivedCS); if (type != null) { - if (WKTKeywords.GeodeticCRS.equals(type)) return new Geodetic(properties, (GeodeticCRS) baseCRS, conversion, derivedCS); - if (WKTKeywords.VerticalCRS.equals(type)) return new Vertical(properties, (VerticalCRS) baseCRS, conversion, (VerticalCS) derivedCS); - if (WKTKeywords.TimeCRS .equals(type)) return new Temporal(properties, (TemporalCRS) baseCRS, conversion, (TimeCS) derivedCS); + if (WKTKeywords.GeodeticCRS .equals(type)) return new Geodetic (properties, (GeodeticCRS) baseCRS, conversion, derivedCS); + if (WKTKeywords.VerticalCRS .equals(type)) return new Vertical (properties, (VerticalCRS) baseCRS, conversion, (VerticalCS) derivedCS); + if (WKTKeywords.TimeCRS .equals(type)) return new Temporal (properties, (TemporalCRS) baseCRS, conversion, (TimeCS) derivedCS); + if (WKTKeywords.ParametricCRS .equals(type)) return new Parametric(properties, (ParametricCRS) baseCRS, conversion, (ParametricCS) derivedCS); if (WKTKeywords.EngineeringCRS.equals(type)) { /* * This case may happen for baseCRS of kind GeodeticCRS, ProjectedCRS or EngineeringCRS. @@ -314,7 +321,8 @@ public class DefaultDerivedCRS extends A * {@linkplain #DefaultDerivedCRS(Map, SingleCRS, CoordinateReferenceSystem, OperationMethod, MathTransform, * CoordinateSystem) above constructor}, * except that the {@code DerivedCRS} instance returned by this method may additionally implement - * the {@link GeodeticCRS}, {@link VerticalCRS}, {@link TemporalCRS} or {@link EngineeringCRS} interface. + * the {@link GeodeticCRS}, {@link VerticalCRS}, {@link TemporalCRS}, {@link ParametricCRS} or + * {@link EngineeringCRS} interface. * See the class javadoc for more information. * * @param properties The properties to be given to the {@link DefaultConversion} object @@ -339,9 +347,10 @@ public class DefaultDerivedCRS extends A if (baseCRS != null && derivedCS != null) { final String type = getType(baseCRS, derivedCS); if (type != null) { - if (WKTKeywords.GeodeticCRS.equals(type)) return new Geodetic(properties, (GeodeticCRS) baseCRS, interpolationCRS, method, baseToDerived, derivedCS); - if (WKTKeywords.VerticalCRS.equals(type)) return new Vertical(properties, (VerticalCRS) baseCRS, interpolationCRS, method, baseToDerived, (VerticalCS) derivedCS); - if (WKTKeywords.TimeCRS .equals(type)) return new Temporal(properties, (TemporalCRS) baseCRS, interpolationCRS, method, baseToDerived, (TimeCS) derivedCS); + if (WKTKeywords.GeodeticCRS .equals(type)) return new Geodetic (properties, (GeodeticCRS) baseCRS, interpolationCRS, method, baseToDerived, derivedCS); + if (WKTKeywords.VerticalCRS .equals(type)) return new Vertical (properties, (VerticalCRS) baseCRS, interpolationCRS, method, baseToDerived, (VerticalCS) derivedCS); + if (WKTKeywords.TimeCRS .equals(type)) return new Temporal (properties, (TemporalCRS) baseCRS, interpolationCRS, method, baseToDerived, (TimeCS) derivedCS); + if (WKTKeywords.ParametricCRS .equals(type)) return new Parametric(properties, (ParametricCRS) baseCRS, interpolationCRS, method, baseToDerived, (ParametricCS) derivedCS); if (WKTKeywords.EngineeringCRS.equals(type)) { if (baseCRS instanceof EngineeringCRS) { // See the comment in create(Map, SingleCRS, Conversion, CoordinateSystem) @@ -372,6 +381,7 @@ public class DefaultDerivedCRS extends A if (WKTKeywords.GeodeticCRS .equals(type)) return new Geodetic (object); if (WKTKeywords.VerticalCRS .equals(type)) return new Vertical (object); if (WKTKeywords.TimeCRS .equals(type)) return new Temporal (object); + if (WKTKeywords.ParametricCRS .equals(type)) return new Parametric (object); if (WKTKeywords.EngineeringCRS.equals(type)) return new Engineering(object); } return new DefaultDerivedCRS(object); @@ -619,6 +629,8 @@ public class DefaultDerivedCRS extends A return WKTKeywords.VerticalCRS; } else if (TemporalCRS.class.isAssignableFrom(type) && derivedCS instanceof TimeCS) { return WKTKeywords.TimeCRS; + } else if (ParametricCRS.class.isAssignableFrom(type) && derivedCS instanceof ParametricCS) { + return WKTKeywords.ParametricCRS; } else if (ProjectedCRS.class.isAssignableFrom(type) || EngineeringCRS.class.isAssignableFrom(type)) { return WKTKeywords.EngineeringCRS; } else { @@ -786,6 +798,59 @@ public class DefaultDerivedCRS extends A } /** + * A derived parametric CRS. + */ + @XmlTransient + private static final class Parametric extends DefaultDerivedCRS implements ParametricCRS { + /** For cross-version compatibility. */ + private static final long serialVersionUID = 2344979923957294024L; + + /** Creates a copy of the given CRS. */ + Parametric(DerivedCRS other) { + super(other); + } + + /** Creates a new parametric CRS from the given properties. */ + Parametric(Map<String,?> properties, ParametricCRS baseCRS, Conversion conversion, ParametricCS derivedCS) { + super(properties, baseCRS, conversion, derivedCS); + } + + /** Creates a new parametric CRS from the given properties. */ + Parametric(Map<String,?> properties, ParametricCRS baseCRS, CoordinateReferenceSystem interpolationCRS, + OperationMethod method, MathTransform baseToDerived, ParametricCS derivedCS) + { + super(properties, baseCRS, interpolationCRS, method, baseToDerived, derivedCS); + } + + /** Returns the datum of the base parametric CRS. */ + @Override public ParametricDatum getDatum() { + return (ParametricDatum) super.getDatum(); + } + + /** Returns the coordinate system given at construction time. */ + @Override public ParametricCS getCoordinateSystem() { + return (ParametricCS) super.getCoordinateSystem(); + } + + /** Returns a coordinate reference system of the same type than this CRS but with different axes. */ + @Override AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem derivedCS) { + final Conversion conversionFromBase = getConversionFromBase(); + return new Parametric(properties, (ParametricCRS) conversionFromBase.getSourceCRS(), + conversionFromBase, (ParametricCS) derivedCS); + } + + /** Returns the WKT keyword for this derived CRS type. */ + @Override String keyword(final Formatter formatter) { + return WKTKeywords.ParametricCRS; + } + + /** Returns the GML code for this derived CRS type. */ + @Override SC_DerivedCRSType getType() { + return new SC_DerivedCRSType("parametric"); + } + } + + /** * An derived engineering CRS. ISO 19162 restricts the base CRS to {@code EngineeringCRS}, {@code ProjectedCRS} * or {@code GeodeticCRS}. Note that in the later case, an ambiguity may exist with the * {@link org.apache.sis.referencing.crs.DefaultDerivedCRS.Geodetic} when deciding which {@code DerivedCRS} to @@ -837,7 +902,6 @@ public class DefaultDerivedCRS extends A - ////////////////////////////////////////////////////////////////////////////////////////////////// //////// //////// //////// XML support with JAXB //////// Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -42,7 +42,9 @@ import static org.apache.sis.util.Argume * <li>CRSs on moving platforms such as road vehicles, vessels, aircraft, or spacecraft.</li> * </ul> * - * <p><b>Used with coordinate system types:</b> + * <p><b>Used with datum type:</b> + * {@linkplain org.apache.sis.referencing.datum.DefaultEngineeringDatum Engineering}.<br> + * <b>Used with coordinate system types:</b> * {@linkplain org.apache.sis.referencing.cs.DefaultAffineCS Affine}, * {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian}, * {@linkplain org.apache.sis.referencing.cs.DefaultCylindricalCS Cylindrical}, @@ -120,12 +122,12 @@ public class DefaultEngineeringCRS exten * <td>{@link #getRemarks()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#DOMAIN_OF_VALIDITY_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#DOMAIN_OF_VALIDITY_KEY}</td> * <td>{@link org.opengis.metadata.extent.Extent}</td> * <td>{@link #getDomainOfValidity()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#SCOPE_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#SCOPE_KEY}</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getScope()}</td> * </tr> Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -33,7 +33,9 @@ import org.apache.sis.referencing.Abstra * A geocentric CRS deals with the earth's curvature by taking a 3-dimensional spatial view, which obviates * the need to model the earth's curvature. * - * <p><b>Used with coordinate system type:</b> + * <p><b>Used with datum type:</b> + * {@linkplain org.apache.sis.referencing.datum.DefaultGeodeticDatum Geodetic}.<br> + * <b>Used with coordinate system types:</b> * {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian} or * {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS Spherical}. * </p> @@ -125,12 +127,12 @@ public class DefaultGeocentricCRS extend * <td>{@link #getRemarks()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#DOMAIN_OF_VALIDITY_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#DOMAIN_OF_VALIDITY_KEY}</td> * <td>{@link org.opengis.metadata.extent.Extent}</td> * <td>{@link #getDomainOfValidity()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#SCOPE_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#SCOPE_KEY}</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getScope()}</td> * </tr> Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -51,7 +51,9 @@ import static org.apache.sis.util.Argume * The CRS is geographic if associated with an ellipsoidal coordinate system, * or geocentric if associated with a spherical or Cartesian coordinate system. * - * <p><b>Used with coordinate system types:</b> + * <p><b>Used with datum type:</b> + * {@linkplain org.apache.sis.referencing.datum.DefaultGeodeticDatum Geodetic}.<br> + * <b>Used with coordinate system types:</b> * {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian}, * {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS Spherical} or * {@linkplain org.apache.sis.referencing.cs.DefaultEllipsoidalCS Ellipsoidal}. Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -47,7 +47,9 @@ import static org.apache.sis.internal.ut * This provides an accurate representation of the geometry of geographic features * for a large portion of the earth's surface. * - * <p><b>Used with coordinate system type:</b> + * <p><b>Used with datum type:</b> + * {@linkplain org.apache.sis.referencing.datum.DefaultGeodeticDatum Geodetic}.<br> + * <b>Used with coordinate system type:</b> * {@linkplain org.apache.sis.referencing.cs.DefaultEllipsoidalCS Ellipsoidal}. * </p> * @@ -139,12 +141,12 @@ public class DefaultGeographicCRS extend * <td>{@link #getRemarks()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#DOMAIN_OF_VALIDITY_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#DOMAIN_OF_VALIDITY_KEY}</td> * <td>{@link org.opengis.metadata.extent.Extent}</td> * <td>{@link #getDomainOfValidity()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#SCOPE_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#SCOPE_KEY}</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getScope()}</td> * </tr> Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -39,7 +39,9 @@ import static org.apache.sis.util.Argume * Image coordinate reference systems are treated as a separate sub-type because a separate * user community exists for images with its own terms of reference. * - * <p><b>Used with coordinate system types:</b> + * <p><b>Used with datum type:</b> + * {@linkplain org.apache.sis.referencing.datum.DefaultImageDatum Image}.<br> + * <b>Used with coordinate system types:</b> * {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian} or * {@linkplain org.apache.sis.referencing.cs.DefaultAffineCS Affine}. * </p> @@ -113,12 +115,12 @@ public class DefaultImageCRS extends Abs * <td>{@link #getRemarks()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#DOMAIN_OF_VALIDITY_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#DOMAIN_OF_VALIDITY_KEY}</td> * <td>{@link org.opengis.metadata.extent.Extent}</td> * <td>{@link #getDomainOfValidity()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#SCOPE_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#SCOPE_KEY}</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getScope()}</td> * </tr> Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -59,7 +59,9 @@ import static org.apache.sis.internal.re * Distortion correction is commonly applied to calculated bearings and distances to produce values * that are a close match to actual field values. * - * <p><b>Used with coordinate system type:</b> + * <p><b>Used with datum type:</b> + * {@linkplain org.apache.sis.referencing.datum.DefaultGeodeticDatum Geodetic}.<br> + * <b>Used with coordinate system type:</b> * {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian}. * </p> * @@ -120,12 +122,12 @@ public class DefaultProjectedCRS extends * <td>{@link #getRemarks()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#DOMAIN_OF_VALIDITY_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#DOMAIN_OF_VALIDITY_KEY}</td> * <td>{@link org.opengis.metadata.extent.Extent}</td> * <td>{@link #getDomainOfValidity()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#SCOPE_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#SCOPE_KEY}</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getScope()}</td> * </tr> Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -46,7 +46,9 @@ import static org.apache.sis.util.Argume * <li>{@link #toValue(Date)} for converting a {@link Date} to a temporal position.</li> * </ul> * - * <p><b>Used with coordinate system type:</b> + * <p><b>Used with datum type:</b> + * {@linkplain org.apache.sis.referencing.datum.DefaultTemporalDatum Temporal}.<br> + * <b>Used with coordinate system type:</b> * {@linkplain org.apache.sis.referencing.cs.DefaultTimeCS Time}. * </p> * @@ -132,12 +134,12 @@ public class DefaultTemporalCRS extends * <td>{@link #getRemarks()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#DOMAIN_OF_VALIDITY_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#DOMAIN_OF_VALIDITY_KEY}</td> * <td>{@link org.opengis.metadata.extent.Extent}</td> * <td>{@link #getDomainOfValidity()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#SCOPE_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#SCOPE_KEY}</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getScope()}</td> * </tr> Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -38,7 +38,9 @@ import static org.apache.sis.util.Argume * Vertical CRSs make use of the direction of gravity to define the concept of height or depth, * but the relationship with gravity may not be straightforward. * - * <p><b>Used with coordinate system type:</b> + * <p><b>Used with datum type:</b> + * {@linkplain org.apache.sis.referencing.datum.DefaultVerticalDatum Vertical}.<br> + * <b>Used with coordinate system type:</b> * {@linkplain org.apache.sis.referencing.cs.DefaultVerticalCS Vertical}. * </p> * @@ -111,12 +113,12 @@ public class DefaultVerticalCRS extends * <td>{@link #getRemarks()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#DOMAIN_OF_VALIDITY_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#DOMAIN_OF_VALIDITY_KEY}</td> * <td>{@link org.opengis.metadata.extent.Extent}</td> * <td>{@link #getDomainOfValidity()}</td> * </tr> * <tr> - * <td>{@value org.opengis.referencing.datum.Datum#SCOPE_KEY}</td> + * <td>{@value org.opengis.referencing.ReferenceSystem#SCOPE_KEY}</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getScope()}</td> * </tr> Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -100,6 +100,7 @@ @XmlJavaTypeAdapter(CD_GeodeticDatum.class), @XmlJavaTypeAdapter(CD_EngineeringDatum.class), @XmlJavaTypeAdapter(CD_ImageDatum.class), + @XmlJavaTypeAdapter(CD_ParametricDatum.class), @XmlJavaTypeAdapter(CD_TemporalDatum.class), @XmlJavaTypeAdapter(CD_VerticalDatum.class), @XmlJavaTypeAdapter(CS_CartesianCS.class), // Must be before CS_AffineCS. @@ -107,6 +108,7 @@ @XmlJavaTypeAdapter(CS_CylindricalCS.class), @XmlJavaTypeAdapter(CS_EllipsoidalCS.class), @XmlJavaTypeAdapter(CS_LinearCS.class), + @XmlJavaTypeAdapter(CS_ParametricCS.class), @XmlJavaTypeAdapter(CS_PolarCS.class), @XmlJavaTypeAdapter(CS_SphericalCS.class), @XmlJavaTypeAdapter(CS_TimeCS.class), Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -84,6 +84,7 @@ import static org.apache.sis.util.Utilit DefaultLinearCS.class, DefaultVerticalCS.class, DefaultTimeCS.class, + DefaultParametricCS.class, DefaultUserDefinedCS.class }) public class AbstractCS extends AbstractIdentifiedObject implements CoordinateSystem { Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -18,11 +18,13 @@ package org.apache.sis.referencing.cs; import java.util.Arrays; import javax.measure.unit.Unit; +import javax.measure.quantity.Length; import javax.measure.converter.UnitConverter; import javax.measure.converter.LinearConverter; import javax.measure.converter.ConversionException; import org.opengis.referencing.cs.AxisDirection; import org.opengis.referencing.cs.CoordinateSystem; +import org.opengis.referencing.cs.CoordinateSystemAxis; import org.opengis.referencing.operation.Matrix; import org.apache.sis.measure.Angle; import org.apache.sis.measure.ElevationAngle; @@ -49,7 +51,7 @@ import org.apache.sis.internal.jdk7.Obje * * @author Martin Desruisseaux (IRD, Geomatys) * @since 0.4 - * @version 0.6 + * @version 0.7 * @module */ public final class CoordinateSystems extends Static { @@ -306,8 +308,8 @@ public final class CoordinateSystems ext * not a matrix multiplication. The last column is processed in a special * way, since it contains the offset values. */ - final int sourceDim = matrix.getNumCol() - 1; // == sourceCS.getDimension() - final int targetDim = matrix.getNumRow() - 1; // == targetCS.getDimension() + final int sourceDim = matrix.getNumCol() - 1; // == sourceCS.getDimension() + final int targetDim = matrix.getNumRow() - 1; // == targetCS.getDimension() for (int j=0; j<targetDim; j++) { final Unit<?> targetUnit = targetCS.getAxis(j).getUnit(); for (int i=0; i<sourceDim; i++) { @@ -405,4 +407,106 @@ public final class CoordinateSystems ext } return cs; } + + /** + * Returns a coordinate system derived from the given one but with all linear units replaced by the given unit. + * Non-linear units (e.g. angular or scale units) are left unchanged. + * + * <p>This convenience method is equivalent to the following code:</p> + * {@preformat java + * return CoordinateSystems.replaceAxes(cs, new AxisFilter() { + * @Override public Unit<?> getUnitReplacement(CoordinateSystemAxis axis, Unit<?> unit) { + * return Units.isLinear(unit) ? newUnit : unit; + * } + * }); + * } + * + * @param cs The coordinate system in which to replace linear units, or {@code null}. + * @param newUnit The new linear unit. + * @return The modified coordinate system as a new instance, + * or {@code cs} if all linear units were already equal to the given one. + * + * @see Units#isLinear(Unit) + * + * @since 0.7 + */ + public static CoordinateSystem replaceLinearUnit(final CoordinateSystem cs, final Unit<Length> newUnit) { + ensureNonNull("newUnit", newUnit); + return CoordinateSystems.replaceAxes(cs, new AxisFilter() { + @Override public Unit<?> getUnitReplacement(CoordinateSystemAxis axis, Unit<?> unit) { + return Units.isLinear(unit) ? newUnit : unit; + } + + @Override + public boolean accept(CoordinateSystemAxis axis) { + return true; + } + + @Override + public AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, AxisDirection direction) { + return direction; + } + + @Deprecated @Override + public AxisDirection getDirectionReplacement(AxisDirection direction) { + return direction; + } + + @Deprecated @Override + public Unit<?> getUnitReplacement(Unit<?> unit) { + return getUnitReplacement(null, unit); + } + }); + } + + /** + * Returns a coordinate system derived from the given one but with all angular units replaced by the given unit. + * Non-angular units (e.g. linear or scale units) are left unchanged. + * + * <p>This convenience method is equivalent to the following code:</p> + * {@preformat java + * return CoordinateSystems.replaceAxes(cs, new AxisFilter() { + * @Override public Unit<?> getUnitReplacement(CoordinateSystemAxis axis, Unit<?> unit) { + * return Units.isAngular(unit) ? newUnit : unit; + * } + * }); + * } + * + * @param cs The coordinate system in which to replace angular units, or {@code null}. + * @param newUnit The new angular unit. + * @return The modified coordinate system as a new instance, + * or {@code cs} if all angular units were already equal to the given one. + * + * @see Units#isAngular(Unit) + * + * @since 0.7 + */ + public static CoordinateSystem replaceAngularUnit(final CoordinateSystem cs, final Unit<javax.measure.quantity.Angle> newUnit) { + ensureNonNull("newUnit", newUnit); + return CoordinateSystems.replaceAxes(cs, new AxisFilter() { + @Override public Unit<?> getUnitReplacement(CoordinateSystemAxis axis, Unit<?> unit) { + return Units.isAngular(unit) ? newUnit : unit; + } + + @Override + public boolean accept(CoordinateSystemAxis axis) { + return true; + } + + @Override + public AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, AxisDirection direction) { + return direction; + } + + @Deprecated @Override + public AxisDirection getDirectionReplacement(AxisDirection direction) { + return direction; + } + + @Deprecated @Override + public Unit<?> getUnitReplacement(Unit<?> unit) { + return getUnitReplacement(null, unit); + } + }); + } } Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -139,7 +139,7 @@ public class DefaultCompoundCS extends A ensureNonNull("components", components); components = components.clone(); for (int i=0; i<components.length; i++) { - ensureNonNullElement("components", i, components); + ensureNonNullElement("components", i, components[i]); } return components; } Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -83,6 +83,7 @@ import org.apache.sis.internal.jdk7.Obje DefaultGeodeticDatum.class, DefaultVerticalDatum.class, DefaultTemporalDatum.class, + DefaultParametricDatum.class, DefaultEngineeringDatum.class, DefaultImageDatum.class }) Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -238,7 +238,7 @@ public class BursaWolfParameters extends * * <p><b>Maintenance note:</b> * if the above policy regarding prime meridians is modified, then some {@code createOperationStep(…)} method - * implementations in {@link org.apache.sis.referencing.operation.CoordinateOperationInference} may need to be + * implementations in {@link org.apache.sis.referencing.operation.CoordinateOperationFinder} may need to be * revisited. See especially the methods creating a transformation between a pair of {@code GeocentricCRS} or * between a pair of {@code GeographicCRS} (tip: search for {@code DefaultGeodeticDatum}).</p> * Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -26,6 +26,7 @@ import java.util.Arrays; import javax.measure.unit.SI; import javax.measure.unit.NonSI; import javax.measure.unit.Unit; +import javax.measure.quantity.Length; import org.opengis.util.FactoryException; import org.opengis.util.InternationalString; import org.opengis.metadata.citation.Citation; @@ -42,7 +43,6 @@ import org.opengis.referencing.crs.Singl import org.opengis.referencing.cs.CSFactory; import org.opengis.referencing.cs.CartesianCS; import org.opengis.referencing.cs.AxisDirection; -import org.opengis.referencing.cs.CoordinateSystemAxis; import org.opengis.referencing.datum.DatumFactory; import org.opengis.referencing.datum.EngineeringDatum; import org.apache.sis.internal.referencing.GeodeticObjectBuilder; @@ -52,7 +52,6 @@ import org.apache.sis.internal.system.Lo import org.apache.sis.internal.util.Constants; import org.apache.sis.measure.Units; import org.apache.sis.referencing.CommonCRS; -import org.apache.sis.referencing.cs.AxisFilter; import org.apache.sis.referencing.cs.CoordinateSystems; import org.apache.sis.util.ArgumentChecks; import org.apache.sis.util.ArraysExt; @@ -627,36 +626,14 @@ public class CommonAuthorityFactory exte * At this point we got a coordinate system with axes in metres. * If the user asked for another unit of measurement, change the axes now. */ - final Unit<?> unit; + final Unit<Length> unit; if (isLegacy) { - unit = createUnitFromEPSG(factor); + unit = createUnitFromEPSG(factor).asType(Length.class); } else { unit = (factor != 1) ? Units.multiply(SI.METRE, factor) : SI.METRE; } if (!SI.METRE.equals(unit)) { - cs = (CartesianCS) CoordinateSystems.replaceAxes(cs, new AxisFilter() { - @Override public Unit<?> getUnitReplacement(Unit<?> ignored) { - assert SI.METRE.equals(ignored) : ignored; - return unit; - } - - @Override public Unit<?> getUnitReplacement(CoordinateSystemAxis axis, Unit<?> ignored) { - assert SI.METRE.equals(ignored) : ignored; - return unit; - } - - @Override public boolean accept(CoordinateSystemAxis axis) { - return true; - } - - @Override public AxisDirection getDirectionReplacement(AxisDirection direction) { - return direction; - } - - @Override public AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, AxisDirection direction) { - return direction; - } - }); + cs = (CartesianCS) CoordinateSystems.replaceLinearUnit(cs, unit); } /* * Set the projection name, operation method and parameters. The parameters for the Transverse Mercator Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -62,6 +62,7 @@ import org.apache.sis.util.Debug; * However, other methods may be overridden as well for better performances.</p> * * @author Martin Desruisseaux (IRD, Geomatys) + * @author Johann Sorel (Geomatys) * @since 0.7 * @version 0.7 * @module @@ -393,6 +394,24 @@ public abstract class GeodeticAuthorityF } /** + * Creates a 1-dimensional parametric coordinate reference system. + * + * <div class="section">Default implementation</div> + * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result. + * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown. + * + * @param code Value allocated by authority. + * @return The coordinate reference system for the given code. + * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. + * @throws FactoryException if the object creation failed for some other reason. + * + * @see org.apache.sis.referencing.crs.DefaultParametricCRS + */ + public ParametricCRS createParametricCRS(final String code) throws NoSuchAuthorityCodeException, FactoryException { + return cast(ParametricCRS.class, createCoordinateReferenceSystem(code), code); + } + + /** * Creates a CRS describing the position of points through two or more independent coordinate reference systems. * * <div class="note"><b>Example:</b> @@ -610,6 +629,24 @@ public abstract class GeodeticAuthorityF } /** + * Creates a datum defining the origin of a parametric coordinate reference system. + * + * <div class="section">Default implementation</div> + * The default implementation delegates to {@link #createDatum(String)} and casts the result. + * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown. + * + * @param code Value allocated by authority. + * @return The datum for the given code. + * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. + * @throws FactoryException if the object creation failed for some other reason. + * + * @see org.apache.sis.referencing.datum.DefaultParametricDatum + */ + public ParametricDatum createParametricDatum(final String code) throws NoSuchAuthorityCodeException, FactoryException { + return cast(ParametricDatum.class, createDatum(code), code); + } + + /** * Creates a datum defining the origin of an engineering coordinate reference system. * An engineering datum is used in a region around that origin. * This origin can be fixed with respect to the earth or be a defined point on a moving vehicle. @@ -870,6 +907,24 @@ public abstract class GeodeticAuthorityF } /** + * Creates a 1-dimensional parametric coordinate system. + * + * <div class="section">Default implementation</div> + * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result. + * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown. + * + * @param code Value allocated by authority. + * @return The coordinate system for the given code. + * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. + * @throws FactoryException if the object creation failed for some other reason. + * + * @see org.apache.sis.referencing.cs.DefaultParametricCS + */ + public ParametricCS createParametricCS(final String code) throws NoSuchAuthorityCodeException, FactoryException { + return cast(ParametricCS.class, createCoordinateSystem(code), code); + } + + /** * Creates a 2- or 3-dimensional Cartesian coordinate system made of straight orthogonal axes. * All axes shall have the same linear unit of measure. * Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -189,6 +189,7 @@ import org.apache.sis.xml.XML; * * @author Martin Desruisseaux (IRD, Geomatys) * @author Guilhem Legal (Geomatys) + * @author Johann Sorel (Geomatys) * @since 0.6 * @version 0.7 * @module @@ -1036,6 +1037,95 @@ public class GeodeticObjectFactory exten } /** + * Creates a parametric coordinate reference system. + * Parametric CRS can be used for physical properties or functions that vary monotonically with height. + * A typical example is the pressure in meteorological applications. + * + * <div class="note"><b>Dependencies:</b> + * the components needed by this method can be created by the following methods: + * <ol> + * <li>{@link #createCoordinateSystemAxis(Map, String, AxisDirection, Unit)}</li> + * <li>{@link #createParametricCS(Map, CoordinateSystemAxis)}</li> + * <li>{@link #createParametricDatum(Map)}</li> + * </ol></div> + * + * The default implementation creates a {@link DefaultParametricCRS} instance. + * + * @param properties Name and other properties to give to the new object. + * @param datum The parametric datum to use in created CRS. + * @param cs The parametric coordinate system for the created CRS. + * @throws FactoryException if the object creation failed. + * + * @see DefaultParametricCRS#DefaultParametricCRS(Map, ParametricDatum, ParametricCS) + * @see GeodeticAuthorityFactory#createParametricCRS(String) + */ + @Override + public ParametricCRS createParametricCRS(final Map<String,?> properties, + final ParametricDatum datum, final ParametricCS cs) throws FactoryException + { + final DefaultParametricCRS crs; + try { + crs = new DefaultParametricCRS(complete(properties), datum, cs); + } catch (IllegalArgumentException exception) { + throw new InvalidGeodeticParameterException(exception); + } + return unique("createParametricCRS", crs); + } + + /** + * Creates a parametric datum. + * The default implementation creates a {@link DefaultParametricDatum} instance. + * + * @param properties Name and other properties to give to the new object. + * @throws FactoryException if the object creation failed. + * + * @see DefaultParametricDatum#DefaultParametricDatum(Map) + * @see GeodeticAuthorityFactory#createParametricDatum(String) + */ + @Override + public ParametricDatum createParametricDatum(final Map<String,?> properties) + throws FactoryException + { + final DefaultParametricDatum datum; + try { + datum = new DefaultParametricDatum(complete(properties)); + } catch (IllegalArgumentException exception) { + throw new InvalidGeodeticParameterException(exception); + } + return unique("createParametricDatum", datum); + } + + /** + * Creates a parametric coordinate system. + * This coordinate system can be used only with parametric CRS. + * + * <div class="note"><b>Dependencies:</b> + * the components needed by this method can be created by the following methods: + * <ol> + * <li>{@link #createCoordinateSystemAxis(Map, String, AxisDirection, Unit)}</li> + * </ol></div> + * + * The default implementation creates a {@link DefaultParametricCS} instance. + * + * @param properties Name and other properties to give to the new object. + * @param axis The single axis. + * @throws FactoryException if the object creation failed. + * + * @see DefaultParametricCS#DefaultParametricCS(Map, CoordinateSystemAxis) + * @see GeodeticAuthorityFactory#createParametricCS(String) + */ + @Override + public ParametricCS createParametricCS(Map<String, ?> properties, CoordinateSystemAxis axis) throws FactoryException { + final DefaultParametricCS cs; + try { + cs = new DefaultParametricCS(complete(properties), axis); + } catch (IllegalArgumentException exception) { + throw new InvalidGeodeticParameterException(exception); + } + return unique("createParametricCS", cs); + } + + /** * Creates a compound coordinate reference system from an ordered list of {@code CoordinateReferenceSystem} objects. * Apache SIS puts no restriction on the components that can be used in a compound CRS. * However for better inter-operability, users are encouraged to follow the order mandated by ISO 19162: @@ -1458,6 +1548,7 @@ public class GeodeticObjectFactory exten * @throws FactoryException if the object creation failed. * * @see XML#unmarshal(String) + * @see org.apache.sis.referencing.CRS#fromXML(String) */ @Override public CoordinateReferenceSystem createFromXML(final String xml) throws FactoryException { Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -341,7 +341,7 @@ public class IdentifiedObjectFinder { * If the set returned by {@link #find(IdentifiedObject)} contains exactly one element, * then that element is returned. Otherwise this method returns {@code null}. * - * <p>Note that this method returns {@code null} even if there is more than one element, + * <p>This method returns {@code null} if there is more than one element * because in such case we consider that there is an ambiguity.</p> * * @param object The object looked up. Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -1591,11 +1591,11 @@ public class MultiAuthoritiesFactory ext */ public void reload() { for (int type=0; type < providers.length; type++) { - Iterable<?> provider = providers[type]; + final Iterable<?> provider = providers[type]; if (provider != null) { synchronized (provider) { if (provider instanceof LazySet<?>) { - provider = ((LazySet<?>) provider).reload(); + ((LazySet<?>) provider).reload(); } if (provider instanceof ServiceLoader<?>) { ((ServiceLoader<?>) provider).reload(); Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -67,10 +67,12 @@ import org.opengis.referencing.Identifie import org.opengis.referencing.NoSuchAuthorityCodeException; import org.apache.sis.internal.metadata.ReferencingServices; import org.apache.sis.internal.metadata.TransformationAccuracy; +import org.apache.sis.internal.metadata.WKTKeywords; import org.apache.sis.internal.metadata.sql.SQLUtilities; import org.apache.sis.internal.referencing.DeprecatedCode; import org.apache.sis.internal.referencing.EPSGParameterDomain; import org.apache.sis.internal.referencing.ReferencingUtilities; +import org.apache.sis.internal.referencing.SignReversalComment; import org.apache.sis.internal.referencing.Formulas; import org.apache.sis.internal.system.Loggers; import org.apache.sis.internal.system.Semaphores; @@ -1064,13 +1066,13 @@ addURIs: for (int i=0; ; i++) { * @param table The table on which a query has been executed. * @param name The name for the {@link IndentifiedObject} to construct. * @param code The EPSG code of the object to construct. - * @param remarks Remarks, or {@code null} if none. + * @param remarks Remarks as a {@link String} or {@link InternationalString}, or {@code null} if none. * @param deprecated {@code true} if the object to create is deprecated. * @return The name together with a set of properties. */ @SuppressWarnings("ReturnOfCollectionOrArrayField") private Map<String,Object> createProperties(final String table, String name, final Integer code, - String remarks, final boolean deprecated) throws SQLException, FactoryDataException + CharSequence remarks, final boolean deprecated) throws SQLException, FactoryDataException { /* * Search for aliases. Note that searching for the object code is not sufficient. We also need to check if the @@ -1172,8 +1174,12 @@ addURIs: for (int i=0; ; i++) { * @return The name together with a set of properties. */ private Map<String,Object> createProperties(final String table, final String name, final Integer code, - final String domainCode, String scope, String remarks, final boolean deprecated) throws SQLException, FactoryException + final String domainCode, String scope, final String remarks, final boolean deprecated) + throws SQLException, FactoryException { + if ("?".equals(scope)) { // EPSG sometime uses this value for unspecified scope. + scope = null; + } final Map<String,Object> properties = createProperties(table, name, code, remarks, deprecated); if (domainCode != null) { properties.put(Datum.DOMAIN_OF_VALIDITY_KEY, owner.createExtent(domainCode)); @@ -1537,6 +1543,15 @@ addURIs: for (int i=0; ; i++) { name, epsg, area, scope, remarks, deprecated), datum, cs); } /* ---------------------------------------------------------------------- + * PARAMETRIC CRS + * ---------------------------------------------------------------------- */ + else if (type.equalsIgnoreCase("engineering")) { + final ParametricCS cs = owner.createParametricCS (getString(code, result, 8)); + final ParametricDatum datum = owner.createParametricDatum(getString(code, result, 9)); + crs = crsFactory.createParametricCRS(createProperties("Coordinate Reference System", + name, epsg, area, scope, remarks, deprecated), datum, cs); + } + /* ---------------------------------------------------------------------- * UNKNOWN CRS * ---------------------------------------------------------------------- */ else { @@ -1685,6 +1700,9 @@ addURIs: for (int i=0; ; i++) { else if (type.equalsIgnoreCase("engineering")) { datum = datumFactory.createEngineeringDatum(properties); } + else if (type.equalsIgnoreCase("parametric")) { + datum = datumFactory.createParametricDatum(properties); + } else { throw new FactoryDataException(error().getString(Errors.Keys.UnknownType_1, type)); } @@ -2136,49 +2154,54 @@ addURIs: for (int i=0; ; i++) { final CSFactory csFactory = owner.csFactory; CoordinateSystem cs = null; { // On the JDK7 branch, this is a switch on strings. - if (type.equalsIgnoreCase("ellipsoidal")) { + if (type.equalsIgnoreCase(WKTKeywords.ellipsoidal)) { switch (dimension) { case 2: cs = csFactory.createEllipsoidalCS(properties, axes[0], axes[1]); break; case 3: cs = csFactory.createEllipsoidalCS(properties, axes[0], axes[1], axes[2]); break; } } - else if (type.equalsIgnoreCase("cartesian")) { + else if (type.equalsIgnoreCase("cartesian")) { // Need lower-case "c" switch (dimension) { case 2: cs = csFactory.createCartesianCS(properties, axes[0], axes[1]); break; case 3: cs = csFactory.createCartesianCS(properties, axes[0], axes[1], axes[2]); break; } } - else if (type.equalsIgnoreCase("spherical")) { + else if (type.equalsIgnoreCase(WKTKeywords.spherical)) { switch (dimension) { case 3: cs = csFactory.createSphericalCS(properties, axes[0], axes[1], axes[2]); break; } } - else if (type.equalsIgnoreCase("vertical") || type.equalsIgnoreCase("gravity-related")) { + else if (type.equalsIgnoreCase(WKTKeywords.vertical) || type.equalsIgnoreCase("gravity-related")) { switch (dimension) { case 1: cs = csFactory.createVerticalCS(properties, axes[0]); break; } } - else if (type.equalsIgnoreCase("time") || type.equalsIgnoreCase("temporal")) { + else if (type.equalsIgnoreCase("time") || type.equalsIgnoreCase(WKTKeywords.temporal)) { switch (dimension) { case 1: cs = csFactory.createTimeCS(properties, axes[0]); break; } } - else if (type.equalsIgnoreCase("linear")) { + else if (type.equalsIgnoreCase(WKTKeywords.parametric)) { + switch (dimension) { + case 1: cs = csFactory.createParametricCS(properties, axes[0]); break; + } + } + else if (type.equalsIgnoreCase(WKTKeywords.linear)) { switch (dimension) { case 1: cs = csFactory.createLinearCS(properties, axes[0]); break; } } - else if (type.equalsIgnoreCase("polar")) { + else if (type.equalsIgnoreCase(WKTKeywords.polar)) { switch (dimension) { case 2: cs = csFactory.createPolarCS(properties, axes[0], axes[1]); break; } } - else if (type.equalsIgnoreCase("cylindrical")) { + else if (type.equalsIgnoreCase(WKTKeywords.cylindrical)) { switch (dimension) { case 3: cs = csFactory.createCylindricalCS(properties, axes[0], axes[1], axes[2]); break; } } - else if (type.equalsIgnoreCase("affine")) { + else if (type.equalsIgnoreCase(WKTKeywords.affine)) { switch (dimension) { case 2: cs = csFactory.createAffineCS(properties, axes[0], axes[1]); break; case 3: cs = csFactory.createAffineCS(properties, axes[0], axes[1], axes[2]); break; @@ -2506,10 +2529,10 @@ addURIs: for (int i=0; ; i++) { " WHERE PARAMETER_CODE = ?", code); while (result.next()) { - final Integer epsg = getInteger (code, result, 1); - final String name = getString (code, result, 2); - final String remarks = getOptionalString (result, 3); - final boolean deprecated = getOptionalBoolean(result, 4); + final Integer epsg = getInteger (code, result, 1); + final String name = getString (code, result, 2); + final String description = getOptionalString (result, 3); + final boolean deprecated = getOptionalBoolean(result, 4); Class<?> type = Double.class; /* * If the parameter appears to have at least one non-null value in the "Parameter File Name" column, @@ -2560,6 +2583,29 @@ next: while (r.next()) { r.close(); } /* + * Determines if the inverse operation can be performed by reversing the parameter sign. + * The EPSG dataset uses "Yes" or "No" value, but SIS scripts use boolean type. We have + * to accept both. + */ + InternationalString isReversible = null; + r = executeQuery("ParameterSign", + "SELECT DISTINCT PARAM_SIGN_REVERSAL FROM [Coordinate_Operation Parameter Usage]" + + " WHERE (PARAMETER_CODE = ?)", epsg); + try { + if (r.next()) { + final String v = r.getString(1); + if (v != null && !r.next()) { + if (v.equalsIgnoreCase("true") || v.equalsIgnoreCase("yes") || v.equals("1")) { + isReversible = SignReversalComment.OPPOSITE; + } else if (v.equalsIgnoreCase("false") || v.equalsIgnoreCase("no") || v.equals("0")) { + isReversible = SignReversalComment.SAME; + } + } + } + } finally { + r.close(); + } + /* * Now creates the parameter descriptor. */ final NumberRange<?> valueDomain; @@ -2569,9 +2615,11 @@ next: while (r.next()) { case 1: valueDomain = MeasurementRange.create(Double.NEGATIVE_INFINITY, false, Double.POSITIVE_INFINITY, false, CollectionsExt.first(units)); break; } + final Map<String, Object> properties = + createProperties("Coordinate_Operation Parameter", name, epsg, isReversible, deprecated); + properties.put(Identifier.DESCRIPTION_KEY, description); @SuppressWarnings({"unchecked", "rawtypes"}) - final ParameterDescriptor<?> descriptor = new DefaultParameterDescriptor( - createProperties("Coordinate_Operation Parameter", name, epsg, remarks, deprecated), + final ParameterDescriptor<?> descriptor = new DefaultParameterDescriptor(properties, 1, 1, type, valueDomain, null, null); returnValue = ensureSingleton(descriptor, returnValue, code); } @@ -2974,6 +3022,7 @@ next: while (r.next()) { } } opProperties.put(ReferencingServices.OPERATION_TYPE_KEY, opType); + opProperties.put(ReferencingServices.PARAMETERS_KEY, parameters); /* * Following restriction will be removed in a future SIS version if the method is added to GeoAPI. */ Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -202,7 +202,7 @@ public abstract class InstallationScript * * @param authority The value given at construction time (e.g. {@code "EPSG"}). * @param resource Index of the SQL script to read, from 0 inclusive to - * <code>{@linkplain #getScriptNames()}.length</code> exclusive. + * <code>{@linkplain #getResourceNames getResourceNames}(authority).length</code> exclusive. * @return A reader for the content of SQL script to execute. * @throws IllegalArgumentException if the given {@code authority} argument is not the expected value. * @throws IndexOutOfBoundsException if the given {@code resource} argument is out of bounds. @@ -239,7 +239,7 @@ public abstract class InstallationScript * * <div class="note"><b>Example 1:</b> * if this {@code InstallationScriptProvider} instance gets the SQL scripts from files in a well-known directory - * and if the names given at {@linkplain #InstallationScriptProvider(String...) construction time} are the + * and if the names given at {@linkplain #InstallationScriptProvider(String, String...) construction time} are the * filenames in that directory, then this method can be implemented as below: * * {@preformat java Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/TableInfo.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/TableInfo.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/TableInfo.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/TableInfo.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -22,6 +22,7 @@ import org.opengis.referencing.crs.*; import org.opengis.referencing.datum.*; import org.opengis.referencing.operation.*; import org.opengis.parameter.ParameterDescriptor; +import org.apache.sis.internal.metadata.WKTKeywords; /** @@ -53,19 +54,31 @@ final class TableInfo { "COORD_REF_SYS_CODE", "COORD_REF_SYS_NAME", "COORD_REF_SYS_KIND", - new Class<?>[] { ProjectedCRS.class, GeographicCRS.class, GeocentricCRS.class, - VerticalCRS.class, CompoundCRS.class, EngineeringCRS.class}, - new String[] {"projected", "geographic", "geocentric", - "vertical", "compound", "engineering"}, + new Class<?>[] { ProjectedCRS.class, GeographicCRS.class, GeocentricCRS.class, + VerticalCRS.class, CompoundCRS.class, EngineeringCRS.class}, + // TemporalCRS.class, ParametricCRS.class (See comment below) + new String[] {"projected", "geographic", "geocentric", + "vertical", "compound", "engineering"}, + // "temporal", "parametric" "SHOW_CRS"), + /* + * Above declaration omitted Temporal and Parametric cases because they are not defined + * by the EPSG registry (at least as of version 8.9). In particular, we are not sure if + * EPSG would chose to use "time" or "temporal". Omitting those types for now does not + * prevent SIS to find CRS of those types; the operation will only be more costly. + */ new TableInfo(CoordinateSystem.class, "[Coordinate System]", "COORD_SYS_CODE", "COORD_SYS_NAME", "COORD_SYS_TYPE", - new Class<?>[] { CartesianCS.class, EllipsoidalCS.class, SphericalCS.class, VerticalCS.class}, - new String[] {"Cartesian", "ellipsoidal", "spherical", "vertical"}, //Really upper-case C. + new Class<?>[] {CartesianCS.class, EllipsoidalCS.class, VerticalCS.class, LinearCS.class, + SphericalCS.class, PolarCS.class, CylindricalCS.class}, + // TimeCS.class, ParametricCS.class, AffineCS.class (see above comment) + new String[] {WKTKeywords.Cartesian, WKTKeywords.ellipsoidal, WKTKeywords.vertical, WKTKeywords.linear, + WKTKeywords.spherical, WKTKeywords.polar, WKTKeywords.cylindrical}, + // WKTKeywords.temporal, WKTKeywords.parametric, WKTKeywords.affine null), new TableInfo(CoordinateSystemAxis.class, @@ -80,8 +93,10 @@ final class TableInfo { "DATUM_CODE", "DATUM_NAME", "DATUM_TYPE", - new Class<?>[] { GeodeticDatum.class, VerticalDatum.class, EngineeringDatum.class}, - new String[] {"geodetic", "vertical", "engineering"}, + new Class<?>[] { GeodeticDatum.class, VerticalDatum.class, EngineeringDatum.class}, + // TemporalDatum.class, ParametricDatum.class (see above comment), + new String[] {"geodetic", "vertical", "engineering"}, + // "temporal", "parametric", null), new TableInfo(Ellipsoid.class, Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java?rev=1740152&r1=1740151&r2=1740152&view=diff ============================================================================== --- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] (original) +++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] Wed Apr 20 14:53:31 2016 @@ -35,6 +35,7 @@ import org.opengis.referencing.operation import org.opengis.referencing.operation.CoordinateOperation; import org.opengis.referencing.operation.OperationMethod; import org.opengis.referencing.operation.MathTransform; +import org.opengis.referencing.operation.PassThroughOperation; import org.opengis.parameter.GeneralParameterValue; import org.opengis.parameter.ParameterDescriptorGroup; import org.opengis.parameter.ParameterValueGroup; @@ -158,7 +159,7 @@ public class AbstractCoordinateOperation * (i.e., instantiation due to the stochastic nature of the parameters). * * <p><b>Consider this field as final!</b> - * This field is modified only at unmarshalling time by {@link #setOperationVersion(String)}</p> + * This field is modified only at unmarshalling time by {@link #setOperationVersion(String)}.</p> * * @see #getOperationVersion() */ @@ -179,7 +180,7 @@ public class AbstractCoordinateOperation * Area in which this operation is valid, or {@code null} if not available. * * <p><b>Consider this field as final!</b> - * This field is modified only at unmarshalling time by {@link #setDomainOfValidity(Extent)}</p> + * This field is modified only at unmarshalling time by {@link #setDomainOfValidity(Extent)}.</p> * * @see #getDomainOfValidity() */ @@ -189,7 +190,7 @@ public class AbstractCoordinateOperation * Description of domain of usage, or limitations of usage, for which this operation is valid. * * <p><b>Consider this field as final!</b> - * This field is modified only at unmarshalling time by {@link #setScope(InternationalString)}</p> + * This field is modified only at unmarshalling time by {@link #setScope(InternationalString)}.</p> * * @see #getScope() */ @@ -201,7 +202,7 @@ public class AbstractCoordinateOperation * * <p><b>Consider this field as final!</b> * This field is non-final only for the convenience of constructors and for initialization - * at XML unmarshalling time by {@link AbstractSingleOperation#afterUnmarshal(Unmarshaller, Object)}</p> + * at XML unmarshalling time by {@link AbstractSingleOperation#afterUnmarshal(Unmarshaller, Object)}.</p> */ MathTransform transform; @@ -513,7 +514,7 @@ check: for (int isTarget=0; ; isTar /** * Returns the interpolation CRS of the given coordinate operation, or {@code null} if none. */ - private static CoordinateReferenceSystem getInterpolationCRS(final CoordinateOperation operation) { + static CoordinateReferenceSystem getInterpolationCRS(final CoordinateOperation operation) { return (operation instanceof AbstractCoordinateOperation) ? ((AbstractCoordinateOperation) operation).getInterpolationCRS() : null; } @@ -556,33 +557,34 @@ check: for (int isTarget=0; ; isTar * Note that those rules may change in any future SIS version. * * <ul> - * <li>If a {@linkplain org.apache.sis.metadata.iso.quality.DefaultQuantitativeResult quantitative result} - * is found with a linear unit, then this accuracy estimate is converted to - * {@linkplain javax.measure.unit.SI#METRE metres} and returned.</li> - * - * <li>Otherwise, if the operation is a {@linkplain DefaultConversion conversion}, then returns 0 since a - * conversion is by definition accurate up to rounding errors.</li> - * - * <li>Otherwise, if the operation is a {@linkplain DefaultTransformation transformation}, then checks if - * the datum shift were applied with the help of Bursa-Wolf parameters. - * If a datum shift has been applied, returns 25 meters. - * If a datum shift should have been applied but has been omitted, returns 3000 meters. - * - * <div class="note"><b>Note:</b> - * the 3000 meters value is higher than the highest value (999 meters) found in the EPSG - * database version 6.7. The 25 meters value is the next highest value found in the EPSG - * database for a significant number of transformations.</div> - * - * <li>Otherwise, if the operation is a {@linkplain DefaultConcatenatedOperation concatenated operation}, - * returns the sum of the accuracy of all components. This is a conservative scenario where we assume that - * errors cumulate linearly. - * - * <div class="note"><b>Note:</b> - * this is not necessarily the "worst case" scenario since the accuracy could be worst if the math transforms - * are highly non-linear.</div></li> + * <li>If at least one {@linkplain org.apache.sis.metadata.iso.quality.DefaultQuantitativeResult quantitative + * result} is found with a linear unit, then returns the largest result value converted to metres.</li> + * + * <li>Otherwise if the operation is a {@linkplain DefaultConversion conversion}, + * then returns 0 since a conversion is by definition accurate up to rounding errors.</li> + * + * <li>Otherwise if the operation is a {@linkplain DefaultTransformation transformation}, + * then checks if the datum shift were applied with the help of Bursa-Wolf parameters. + * If a datum shift has been applied, returns 25 meters. + * If a datum shift should have been applied but has been omitted, returns 3000 meters. + * + * <div class="note"><b>Note:</b> + * the 3000 meters value is higher than the highest value (999 meters) found in the EPSG + * database version 6.7. The 25 meters value is the next highest value found in the EPSG + * database for a significant number of transformations.</div> + * + * <li>Otherwise if the operation is a {@linkplain DefaultConcatenatedOperation concatenated operation}, + * returns the sum of the accuracy of all components. + * This is a conservative scenario where we assume that errors cumulate linearly. + * + * <div class="note"><b>Note:</b> + * this is not necessarily the "worst case" scenario since the accuracy could be worst + * if the math transforms are highly non-linear.</div></li> * </ul> * * @return The accuracy estimation (always in meters), or NaN if unknown. + * + * @see org.apache.sis.referencing.CRS#getLinearAccuracy(CoordinateOperation) */ public double getLinearAccuracy() { return PositionalAccuracyConstant.getLinearAccuracy(this); @@ -858,12 +860,17 @@ check: for (int isTarget=0; ; isTar super.formatTo(formatter); formatter.newLine(); /* - * If the WKT is a component of a ConcatenatedOperation, do not format the source and target CRS. - * This decision SIS-specific since the WKT 2 specification does not define concatenated operations. - * The choice of content to omit may change in any future version. + * If the WKT is a component of a ConcatenatedOperation, do not format the source CRS since it is identical + * to the target CRS of the previous step, or to the source CRS of the enclosing "ConcatenatedOperation" if + * this step is the first step. + * + * This decision is SIS-specific since the WKT 2 specification does not define concatenated operations. + * This choice may change in any future SIS version. */ - final boolean isComponent = (formatter.getEnclosingElement(1) instanceof ConcatenatedOperation); - if (!isComponent) { + final FormattableObject enclosing = formatter.getEnclosingElement(1); + final boolean isSubOperation = (enclosing instanceof PassThroughOperation); + final boolean isComponent = (enclosing instanceof ConcatenatedOperation); + if (!isSubOperation && !isComponent) { append(formatter, getSourceCRS(), WKTKeywords.SourceCRS); append(formatter, getTargetCRS(), WKTKeywords.TargetCRS); } @@ -880,12 +887,14 @@ check: for (int isTarget=0; ; isTar } if (parameters != null) { formatter.newLine(); + formatter.indent(+1); for (final GeneralParameterValue param : parameters.values()) { WKTUtilities.append(param, formatter); } + formatter.indent(-1); } } - if (!isComponent) { + if (!isSubOperation && !(this instanceof ConcatenatedOperation)) { append(formatter, getInterpolationCRS(), WKTKeywords.InterpolationCRS); final double accuracy = getLinearAccuracy(); if (accuracy > 0) { @@ -900,7 +909,7 @@ check: for (int isTarget=0; ; isTar if (formatter.getConvention().majorVersion() == 1) { formatter.setInvalidWKT(this, null); } - return WKTKeywords.CoordinateOperation; + return isComponent ? "CoordinateOperationStep" : WKTKeywords.CoordinateOperation; } /**
