sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jso...@apache.org
Subject svn commit: r1737203 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/internal/metadata/ sis-metadata/src/main/java/org/apache/sis/io/wkt/ sis-referencing/src/main/java/org/apache/sis/referencing/crs/ sis-referencing/src/main/jav...
Date Thu, 31 Mar 2016 08:58:44 GMT
Author: jsorel
Date: Thu Mar 31 08:58:43 2016
New Revision: 1737203

URL: http://svn.apache.org/viewvc?rev=1737203&view=rev
Log:
Implement parametric CRS, update wkt and jaxb parsers

Added:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultParametricCRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultParametricCS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultParametricDatum.java
Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java?rev=1737203&r1=1737202&r2=1737203&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java [UTF-8] Thu Mar 31 08:58:43 2016
@@ -127,6 +127,15 @@ public final class WKTKeywords extends S
             BaseTimeCRS = "BaseTimeCRS";
 
     /**
+     * Related to {@link org.apache.sis.referencing.crs.DefaultParametricCRS}.
+     */
+    public static final String
+            ParametricDatum = "ParametricDatum",
+            PDatum          = "PDatum",
+            ParametricCRS   = "ParametricCRS",
+            BaseParamCRS    = "BaseParamCRS";
+
+    /**
      * Related to {@link org.apache.sis.referencing.crs.DefaultImageCRS}
      * and {@link org.apache.sis.referencing.crs.DefaultEngineeringCRS}.
      * Former can be seen as a special case of the later.

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java?rev=1737203&r1=1737202&r2=1737203&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] Thu Mar 31 08:58:43 2016
@@ -337,6 +337,7 @@ final class GeodeticObjectParser extends
             (object = parseToWGS84          (FIRST, element       )) == null &&
             (object = parseVerticalDatum    (FIRST, element, false)) == null &&
             (object = parseTimeDatum        (FIRST, element       )) == null &&
+            (object = parseParametricDatum  (FIRST, element       )) == null &&
             (object = parseEngineeringDatum (FIRST, element, false)) == null &&
             (object = parseImageDatum       (FIRST, element       )) == null &&
             (object = parseOperation        (FIRST, element))        == null)
@@ -362,6 +363,7 @@ final class GeodeticObjectParser extends
             (crs = parseProjectedCRS   (FIRST, element, false))   == null &&
             (crs = parseVerticalCRS    (FIRST, element, false))   == null &&
             (crs = parseTimeCRS        (FIRST, element, false))   == null &&
+            (crs = parseParametricCRS  (FIRST, element, false))   == null &&
             (crs = parseEngineeringCRS (FIRST, element, false))   == null &&
             (crs = parseImageCRS       (FIRST, element))          == null &&
             (crs = parseCompoundCRS    (FIRST, element))          == null &&
@@ -848,6 +850,18 @@ final class GeodeticObjectParser extends
                     z = "t";
                     break;
                 }
+                 /*
+                 * Parametric — axis name and abbreviation not yet specified by ISO 19111_2.
+                 */
+                case WKTKeywords.parametric: {
+                    if (defaultUnit == null) {
+                        throw parent.missingComponent(WKTKeywords.ParametricUnit);
+                    }
+                    direction = AxisDirection.OTHER;
+                    nz = "Parametric";
+                    z = "p";
+                    break;
+                }
                 /*
                  * Unknown CS type — we can not guess which axes to create.
                  */
@@ -936,8 +950,8 @@ final class GeodeticObjectParser extends
                 if (axes.length != (dimension = 3)) break;
                 return csFactory.createSphericalCS(csProperties, axes[0], axes[1], axes[2]);
             }
-            case WKTKeywords.parametric: {  // TODO: not yet supported.
-                return referencing.createAbstractCS(csProperties, axes);
+            case WKTKeywords.parametric: {
+                return csFactory.createParametricCS(csProperties, axes[0]);
             }
             default: {
                 warning(parent, null, Errors.formatInternational(Errors.Keys.UnknownType_1, type), null);
@@ -1439,6 +1453,31 @@ final class GeodeticObjectParser extends
     }
 
     /**
+     * Parses a {@code "ParametricDatum"} element. This element has the following pattern:
+     *
+     * {@preformat wkt
+     *     ParametricDatum["<name>", Anchor[...] {,<authority>}]
+     * }
+     *
+     * @param  mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+     * @param  parent The parent element.
+     * @return The {@code "ParametricDatum"} element as a {@link ParametricDatum} object.
+     * @throws ParseException if the {@code "ParametricDatum"} element can not be parsed.
+     */
+    private ParametricDatum parseParametricDatum(final int mode, final Element parent) throws ParseException {
+        final Element element = parent.pullElement(mode, WKTKeywords.ParametricDatum, WKTKeywords.PDatum);
+        if (element == null) {
+            return null;
+        }
+        final String  name   = element.pullString ("name");
+        try {
+            return datumFactory.createParametricDatum(parseAnchorAndClose(element, name));
+        } catch (FactoryException exception) {
+            throw element.parseFailed(exception);
+        }
+    }
+
+    /**
      * Parses a {@code "EngineeringDatum"} (WKT 2) element. The syntax is given by
      * <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#76">WKT 2 specification §11.2</a>.
      *
@@ -1924,6 +1963,66 @@ final class GeodeticObjectParser extends
             }
         } catch (FactoryException exception) {
             throw element.parseFailed(exception);
+        }
+        throw element.illegalCS(cs);
+    }
+
+    /**
+     * Parses {@code "ParametricCRS"} element.
+     *
+     * @param  mode      {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+     * @param  parent    The parent element.
+     * @param  isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
+     * @return The {@code "ParametricCRS"} object.
+     * @throws ParseException if the {@code "ParametricCRS"} element can not be parsed.
+     */
+    private SingleCRS parseParametricCRS(final int mode, final Element parent, final boolean isBaseCRS)
+            throws ParseException
+    {
+        final Element element = parent.pullElement(mode, isBaseCRS ? WKTKeywords.BaseParamCRS : WKTKeywords.ParametricCRS);
+        if (element == null) {
+            return null;
+        }
+        final String  name   = element.pullString("name");
+        final Unit<?> unit   = parseUnit(element);
+        /*
+         * A ParametricCRS can be either a "normal" one (with a non-null datum), or a DerivedCRS of kind ParametricCRS.
+         * In the later case, the datum is null and we have instead DerivingConversion element from a BaseParametricCRS.
+         */
+        ParametricDatum datum  = null;
+        SingleCRS     baseCRS  = null;
+        Conversion    fromBase = null;
+        if (!isBaseCRS) {
+            /*
+             * UNIT[…] in DerivedCRS parameters are mandatory according ISO 19162 and the specification does not said
+             * what to do if they are missing.  In this code, we default to the contextual units in the same way than
+             * what we do for ProjectedCRS parameters, in the hope to be consistent.
+             *
+             * An alternative would be to specify null units, in which case MathTransformParser.parseParameters(…)
+             * defaults to the units specified in the parameter descriptor. But this would make the CRS parser more
+             * implementation-dependent, because the parameter descriptors are provided by the MathTransformFactory
+             * instead than inferred from the WKT.
+             */
+            fromBase = parseDerivingConversion(OPTIONAL, element, WKTKeywords.DerivingConversion, unit, null);
+            if (fromBase != null) {
+                baseCRS = parseParametricCRS(MANDATORY, element, true);
+            }
+        }
+        if (baseCRS == null) {  // The most usual case.
+            datum = parseParametricDatum(MANDATORY, element);
+        }
+        final CoordinateSystem cs;
+        try {
+            cs = parseCoordinateSystem(element, WKTKeywords.parametric, 1, false, unit, datum);
+            final Map<String,?> properties = parseMetadataAndClose(element, name, datum);
+            if (cs instanceof ParametricCS) {
+                if (baseCRS != null) {
+                    return crsFactory.createDerivedCRS(properties, baseCRS, fromBase, cs);
+                }
+                return crsFactory.createParametricCRS(properties, datum, (ParametricCS) cs);
+            }
+        } catch (FactoryException exception) {
+            throw element.parseFailed(exception);
         }
         throw element.illegalCS(cs);
     }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java?rev=1737203&r1=1737202&r2=1737203&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] Thu Mar 31 08:58:43 2016
@@ -59,6 +59,9 @@ import org.apache.sis.io.wkt.Formattable
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.Classes;
+import org.opengis.referencing.crs.ParametricCRS;
+import org.opengis.referencing.cs.ParametricCS;
+import org.opengis.referencing.datum.ParametricDatum;
 
 
 /**
@@ -290,6 +293,7 @@ public class DefaultDerivedCRS extends A
                 case WKTKeywords.GeodeticCRS: return new Geodetic(properties, (GeodeticCRS) baseCRS, conversion,              derivedCS);
                 case WKTKeywords.VerticalCRS: return new Vertical(properties, (VerticalCRS) baseCRS, conversion, (VerticalCS) derivedCS);
                 case WKTKeywords.TimeCRS:     return new Temporal(properties, (TemporalCRS) baseCRS, conversion,     (TimeCS) derivedCS);
+                case WKTKeywords.ParametricCRS:return new Parametric(properties,(ParametricCRS)baseCRS,conversion,(ParametricCS)derivedCS);
                 case WKTKeywords.EngineeringCRS: {
                     /*
                      * This case may happen for baseCRS of kind GeodeticCRS, ProjectedCRS or EngineeringCRS.
@@ -343,6 +347,7 @@ public class DefaultDerivedCRS extends A
                 case WKTKeywords.GeodeticCRS: return new Geodetic(properties, (GeodeticCRS) baseCRS, interpolationCRS, method, baseToDerived,              derivedCS);
                 case WKTKeywords.VerticalCRS: return new Vertical(properties, (VerticalCRS) baseCRS, interpolationCRS, method, baseToDerived, (VerticalCS) derivedCS);
                 case WKTKeywords.TimeCRS:     return new Temporal(properties, (TemporalCRS) baseCRS, interpolationCRS, method, baseToDerived,     (TimeCS) derivedCS);
+                case WKTKeywords.ParametricCRS:return new Parametric(properties,(ParametricCRS)baseCRS,interpolationCRS,method,baseToDerived,(ParametricCS)derivedCS);
                 case WKTKeywords.EngineeringCRS: {
                     if (baseCRS instanceof EngineeringCRS) {
                         // See the comment in create(Map, SingleCRS, Conversion, CoordinateSystem)
@@ -375,6 +380,7 @@ public class DefaultDerivedCRS extends A
                 case WKTKeywords.VerticalCRS:    return new Vertical   (object);
                 case WKTKeywords.TimeCRS:        return new Temporal   (object);
                 case WKTKeywords.EngineeringCRS: return new Engineering(object);
+                case WKTKeywords.ParametricCRS:  return new Parametric (object);
             }
             return new DefaultDerivedCRS(object);
         }
@@ -839,6 +845,58 @@ 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.BaseParamCRS;
+        }
+
+        /** Returns the GML code for this derived CRS type. */
+        @Override SC_DerivedCRSType getType() {
+            return new SC_DerivedCRSType("parametric");
+        }
+    }
 
 
 

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultParametricCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultParametricCRS.java?rev=1737203&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultParametricCRS.java (added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultParametricCRS.java Thu Mar 31 08:58:43 2016
@@ -0,0 +1,289 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.crs;
+
+import java.util.Map;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.sis.internal.metadata.MetadataUtilities;
+import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.io.wkt.Formatter;
+import static org.apache.sis.referencing.crs.AbstractCRS.isBaseCRS;
+import org.apache.sis.referencing.cs.AxesConvention;
+import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
+import org.opengis.referencing.crs.ParametricCRS;
+import org.opengis.referencing.crs.TemporalCRS;
+import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.cs.ParametricCS;
+import org.opengis.referencing.datum.ParametricDatum;
+
+/**
+ * A 1-dimensional coordinate reference system which uses parameter values or functions.
+ *
+ * <p><b>Used with coordinate system type:</b>
+ *   {@linkplain org.apache.sis.referencing.cs.DefaultParametricCS Parametric}.
+ * </p>
+ *
+ * <div class="section">Immutability and thread safety</div>
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself),
+ * the coordinate system and the datum instances given to the constructor are also immutable. Unless otherwise noted
+ * in the javadoc, this condition holds if all components were created using only SIS factories and static constants.
+ *
+ * @author  Johann Sorel (Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ *
+ * @see org.apache.sis.referencing.datum.DefaultParametricDatum
+ * @see org.apache.sis.referencing.cs.DefaultParametricCS
+ * @see org.apache.sis.referencing.factory.GeodeticAuthorityFactory#createParametricCRS(String)
+ */
+@XmlType(name = "ParametricCRSType", propOrder = {
+    "coordinateSystem",
+    "datum"
+})
+@XmlRootElement(name = "ParametricCRS")
+public class DefaultParametricCRS extends AbstractCRS implements ParametricCRS {
+
+    /**
+     * The datum.
+     *
+     * <p><b>Consider this field as final!</b>
+     * This field is modified only at unmarshalling time by {@link #setDatum(ParametricDatum)}</p>
+     *
+     * @see #getDatum()
+     */
+    private ParametricDatum datum;
+
+    /**
+     * Creates a coordinate reference system from the given properties, datum and coordinate system.
+     * The properties given in argument follow the same rules than for the
+     * {@linkplain AbstractReferenceSystem#AbstractReferenceSystem(Map) super-class constructor}.
+     * The following table is a reminder of main (not all) properties:
+     *
+     * <table class="sis">
+     *   <caption>Recognized properties (non exhaustive list)</caption>
+     *   <tr>
+     *     <th>Property name</th>
+     *     <th>Value type</th>
+     *     <th>Returned by</th>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#NAME_KEY}</td>
+     *     <td>{@link org.opengis.metadata.Identifier} or {@link String}</td>
+     *     <td>{@link #getName()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#ALIAS_KEY}</td>
+     *     <td>{@link org.opengis.util.GenericName} or {@link CharSequence} (optionally as array)</td>
+     *     <td>{@link #getAlias()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#IDENTIFIERS_KEY}</td>
+     *     <td>{@link org.opengis.metadata.Identifier} (optionally as array)</td>
+     *     <td>{@link #getIdentifiers()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td>
+     *     <td>{@link org.opengis.util.InternationalString} or {@link String}</td>
+     *     <td>{@link #getRemarks()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.datum.Datum#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>{@link org.opengis.util.InternationalString} or {@link String}</td>
+     *     <td>{@link #getScope()}</td>
+     *   </tr>
+     * </table>
+     *
+     * @param properties The properties to be given to the coordinate reference system.
+     * @param datum The datum.
+     * @param cs The coordinate system.
+     *
+     * @see org.apache.sis.referencing.factory.GeodeticObjectFactory#createParametricCRS(Map, ParametricDatum, ParametricCS)
+     */
+    public DefaultParametricCRS(final Map<String,?> properties,
+                              final ParametricDatum datum,
+                              final ParametricCS    cs)
+    {
+        super(properties, cs);
+        ensureNonNull("datum", datum);
+        this.datum = datum;
+    }
+
+    /**
+     * Constructs a new coordinate reference system with the same values than the specified one.
+     * This copy constructor provides a way to convert an arbitrary implementation into a SIS one
+     * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API.
+     *
+     * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
+     *
+     * @param crs The coordinate reference system to copy.
+     *
+     * @see #castOrCopy(TemporalCRS)
+     */
+    protected DefaultParametricCRS(final ParametricCRS crs) {
+        super(crs);
+        datum = crs.getDatum();
+    }
+
+    /**
+     * Returns a SIS coordinate reference system implementation with the same values than the given
+     * arbitrary implementation. If the given object is {@code null}, then this method returns {@code null}.
+     * Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged.
+     * Otherwise a new SIS implementation is created and initialized to the attribute values of the given object.
+     *
+     * @param  object The object to get as a SIS implementation, or {@code null} if none.
+     * @return A SIS implementation containing the values of the given object (may be the
+     *         given object itself), or {@code null} if the argument was null.
+     */
+    public static DefaultParametricCRS castOrCopy(final ParametricCRS object) {
+        return (object == null || object instanceof DefaultParametricCRS)
+                ? (DefaultParametricCRS) object : new DefaultParametricCRS(object);
+    }
+
+    /**
+     * Returns the GeoAPI interface implemented by this class.
+     * The SIS implementation returns {@code ParametricCRS.class}.
+     *
+     * <div class="note"><b>Note for implementors:</b>
+     * Subclasses usually do not need to override this method since GeoAPI does not define {@code ParametricCRS}
+     * sub-interface. Overriding possibility is left mostly for implementors who wish to extend GeoAPI with their
+     * own set of interfaces.</div>
+     *
+     * @return {@code ParametricCRS.class} or a user-defined sub-interface.
+     */
+    @Override
+    public Class<? extends ParametricCRS> getInterface() {
+        return ParametricCRS.class;
+    }
+
+    /**
+     * Returns the datum.
+     *
+     * @return The datum.
+     */
+    @Override
+    @XmlElement(name = "parametricDatum", required = true)
+    public ParametricDatum getDatum() {
+        return datum;
+    }
+
+    /**
+     * Returns the coordinate system.
+     *
+     * @return The coordinate system.
+     */
+    @Override
+    @XmlElement(name = "parametricCS", required = true)
+    public ParametricCS getCoordinateSystem() {
+        return (ParametricCS) super.getCoordinateSystem();
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @return {@inheritDoc}
+     */
+    @Override
+    public DefaultParametricCRS forConvention(final AxesConvention convention) {
+        return (DefaultParametricCRS) super.forConvention(convention);
+    }
+
+    /**
+     * Returns a coordinate reference system of the same type than this CRS but with different axes.
+     */
+    @Override
+    final AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem cs) {
+        return new DefaultParametricCRS(properties, datum, (ParametricCS) cs);
+    }
+
+    /**
+     * Formats this CRS as a <cite>Well Known Text</cite> {@code ParametricCRS[…]} element.
+     *
+     * <div class="note"><b>Compatibility note:</b>
+     * {@code ParametricCRS} is defined in the WKT 2 specification only.</div>
+     *
+     * @return {@code "ParametricCRS"}.
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#83">WKT 2 specification</a>
+     */
+    @Override
+    protected String formatTo(final Formatter formatter) {
+        super.formatTo(formatter);
+        if (formatter.getConvention().majorVersion() == 1) {
+            formatter.setInvalidWKT(this, null);
+        }
+        return isBaseCRS(formatter) ? WKTKeywords.BaseParamCRS : WKTKeywords.ParametricCRS;
+    }
+
+
+
+
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+    ////////                                                                                  ////////
+    ////////                               XML support with JAXB                              ////////
+    ////////                                                                                  ////////
+    ////////        The following methods are invoked by JAXB using reflection (even if       ////////
+    ////////        they are private) or are helpers for other methods invoked by JAXB.       ////////
+    ////////        Those methods can be safely removed if Geographic Markup Language         ////////
+    ////////        (GML) support is not needed.                                              ////////
+    ////////                                                                                  ////////
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Constructs a new object in which every attributes are set to a null value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    private DefaultParametricCRS() {
+        /*
+         * The datum and the coordinate system are mandatory for SIS working. We do not verify their presence
+         * here because the verification would have to be done in an 'afterMarshal(…)' method and throwing an
+         * exception in that method causes the whole unmarshalling to fail.  But the SC_CRS adapter does some
+         * verifications.
+         */
+    }
+
+    /**
+     * Invoked by JAXB at unmarshalling time.
+     *
+     * @see #getDatum()
+     */
+    private void setDatum(final ParametricDatum value) {
+        if (datum == null) {
+            datum = value;
+        } else {
+            MetadataUtilities.propertyAlreadySet(DefaultVerticalCRS.class, "setDatum", "parametricDatum");
+        }
+    }
+
+    /**
+     * Used by JAXB only (invoked by reflection).
+     *
+     * @see #getCoordinateSystem()
+     */
+    private void setCoordinateSystem(final ParametricCS cs) {
+        setCoordinateSystem("parametricCS", cs);
+    }
+
+}

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultParametricCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultParametricCS.java?rev=1737203&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultParametricCS.java (added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultParametricCS.java Thu Mar 31 08:58:43 2016
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.cs;
+
+import java.util.Map;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.cs.ParametricCS;
+
+/**
+ * A 1-dimensional coordinate system for parametric values or functions.
+ *
+ * <table class="sis">
+ * <caption>Permitted associations</caption>
+ * <tr>
+ *   <th>Used with CRS</th>
+ *   <th>Permitted axis names</th>
+ * </tr><tr>
+ *   <td>{@linkplain org.apache.sis.referencing.crs.DefaultParametricCRS Parametric}</td>
+ *   <td>unspecified</td>
+ * </tr></table>
+ *
+ * <div class="section">Immutability and thread safety</div>
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * and the {@link CoordinateSystemAxis} instances given to the constructor are also immutable. Unless otherwise
+ * noted in the javadoc, this condition holds if all components were created using only SIS factories and static
+ * constants.
+ *
+ * @author  Johann Sorel (Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ *
+ * @see org.apache.sis.referencing.crs.DefaultParametricCRS
+ * @see org.apache.sis.referencing.datum.DefaultParametricDatum
+ * @see org.apache.sis.referencing.factory.GeodeticAuthorityFactory#createParametricCS(String)
+ */
+@XmlType(name = "ParametricCSType")
+@XmlRootElement(name = "ParametricCS")
+public class DefaultParametricCS extends AbstractCS implements ParametricCS {
+
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = -5588239024582484514L;
+
+    /**
+     * Creates a new coordinate system from an arbitrary number of axes. This constructor is for
+     * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only,
+     * because it does not verify the number of axes.
+     */
+    private DefaultParametricCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        super(properties, axes);
+    }
+
+    /**
+     * Constructs a coordinate system from a set of properties.
+     * The properties map is given unchanged to the
+     * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
+     * The following table is a reminder of main (not all) properties:
+     *
+     * <table class="sis">
+     *   <caption>Recognized properties (non exhaustive list)</caption>
+     *   <tr>
+     *     <th>Property name</th>
+     *     <th>Value type</th>
+     *     <th>Returned by</th>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#NAME_KEY}</td>
+     *     <td>{@link org.opengis.metadata.Identifier} or {@link String}</td>
+     *     <td>{@link #getName()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#ALIAS_KEY}</td>
+     *     <td>{@link org.opengis.util.GenericName} or {@link CharSequence} (optionally as array)</td>
+     *     <td>{@link #getAlias()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#IDENTIFIERS_KEY}</td>
+     *     <td>{@link org.opengis.metadata.Identifier} (optionally as array)</td>
+     *     <td>{@link #getIdentifiers()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td>
+     *     <td>{@link org.opengis.util.InternationalString} or {@link String}</td>
+     *     <td>{@link #getRemarks()}</td>
+     *   </tr>
+     * </table>
+     *
+     * @param properties The properties to be given to the identified object.
+     * @param axis       The axis.
+     *
+     * @see org.apache.sis.referencing.factory.GeodeticObjectFactory#createParametricCS(Map, CoordinateSystemAxis)
+     */
+    public DefaultParametricCS(final Map<String,?> properties, final CoordinateSystemAxis axis) {
+        super(properties, axis);
+    }
+
+    /**
+     * Creates a new coordinate system with the same values than the specified one.
+     * This copy constructor provides a way to convert an arbitrary implementation into a SIS one
+     * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API.
+     *
+     * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
+     *
+     * @param cs The coordinate system to copy.
+     *
+     * @see #castOrCopy(ParametricCS)
+     */
+    protected DefaultParametricCS(final ParametricCS cs) {
+        super(cs);
+    }
+
+    /**
+     * Returns a SIS coordinate system implementation with the same values than the given arbitrary implementation.
+     * If the given object is {@code null}, then this method returns {@code null}.
+     * Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged.
+     * Otherwise a new SIS implementation is created and initialized to the attribute values of the given object.
+     *
+     * @param  object The object to get as a SIS implementation, or {@code null} if none.
+     * @return A SIS implementation containing the values of the given object (may be the
+     *         given object itself), or {@code null} if the argument was null.
+     */
+    public static DefaultParametricCS castOrCopy(final ParametricCS object) {
+        return (object == null) || (object instanceof DefaultParametricCS)
+                ? (DefaultParametricCS) object : new DefaultParametricCS(object);
+    }
+
+    /**
+     * Returns the GeoAPI interface implemented by this class.
+     * The SIS implementation returns {@code ParametricCS.class}.
+     *
+     * <div class="note"><b>Note for implementors:</b>
+     * Subclasses usually do not need to override this method since GeoAPI does not define {@code ParametricCS}
+     * sub-interface. Overriding possibility is left mostly for implementors who wish to extend GeoAPI with
+     * their own set of interfaces.</div>
+     *
+     * @return {@code ParametricCS.class} or a user-defined sub-interface.
+     */
+    @Override
+    public Class<? extends ParametricCS> getInterface() {
+        return ParametricCS.class;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @return {@inheritDoc}
+     */
+    @Override
+    public DefaultParametricCS forConvention(final AxesConvention convention) {
+        return (DefaultParametricCS) super.forConvention(convention);
+    }
+
+    /**
+     * Returns a coordinate system with different axes.
+     */
+    @Override
+    final AbstractCS createForAxes(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        switch (axes.length) {
+            case 1: return new DefaultParametricCS(properties, axes);
+            default: throw unexpectedDimension(properties, axes, 1);
+        }
+    }
+
+
+
+
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+    ////////                                                                                  ////////
+    ////////                               XML support with JAXB                              ////////
+    ////////                                                                                  ////////
+    ////////        The following methods are invoked by JAXB using reflection (even if       ////////
+    ////////        they are private) or are helpers for other methods invoked by JAXB.       ////////
+    ////////        Those methods can be safely removed if Geographic Markup Language         ////////
+    ////////        (GML) support is not needed.                                              ////////
+    ////////                                                                                  ////////
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Constructs a new coordinate system in which every attributes are set to a null or empty value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB,
+     * which will assign values to the fields using reflexion.
+     */
+    private DefaultParametricCS() {
+    }
+
+
+}

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultParametricDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultParametricDatum.java?rev=1737203&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultParametricDatum.java (added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultParametricDatum.java Thu Mar 31 08:58:43 2016
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.datum;
+
+import java.util.Date;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.io.wkt.Formatter;
+import org.opengis.referencing.datum.ParametricDatum;
+
+/**
+ * Defines the origin of a parametric coordinate reference system.
+ *
+ * <div class="section">Creating new parametric datum instances</div>
+ * New instances can be created either directly by specifying all information to a factory method (choices 2
+ * and 3 below), or indirectly by specifying the identifier of an entry in a database (choices 1 below).
+ *
+ * <ol>
+ *   <li>Create a {@code ParametricDatum} from an identifier in a database by invoking
+ *       {@link org.opengis.referencing.datum.DatumAuthorityFactory#createParametricDatum(String)}.</li>
+ *   <li>Create a {@code ParametricDatum} by invoking the {@code DatumFactory.createParametricDatum(…)} method,
+ *       (implemented for example by {@link org.apache.sis.referencing.factory.GeodeticObjectFactory}).</li>
+ *   <li>Create a {@code DefaultParametricDatum} by invoking the
+ *       {@linkplain #createParametricDatum(Map) constructor}.</li>
+ * </ol>
+ *
+ * <div class="section">Immutability and thread safety</div>
+ * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
+ * given to the constructor are also immutable. Unless otherwise noted in the javadoc, this condition holds if
+ * all components were created using only SIS factories and static constants.
+ *
+ * @author  Johann Sorel (Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ *
+ * @see org.apache.sis.referencing.cs.DefaultParametricCS
+ * @see org.apache.sis.referencing.crs.DefaultParametricCRS
+ * @see org.apache.sis.referencing.factory.GeodeticAuthorityFactory#createParametricDatum(String)
+ */
+@XmlType(name = "ParametricDatumType")
+@XmlRootElement(name = "ParametricDatum")
+public class DefaultParametricDatum extends AbstractDatum implements ParametricDatum {
+
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = 4951496470378888681L;
+
+    /**
+     * Creates a parametric datum from the given properties. The properties map is given
+     * unchanged to the {@linkplain AbstractDatum#AbstractDatum(Map) super-class constructor}.
+     * The following table is a reminder of main (not all) properties:
+     *
+     * <table class="sis">
+     *   <caption>Recognized properties (non exhaustive list)</caption>
+     *   <tr>
+     *     <th>Property name</th>
+     *     <th>Value type</th>
+     *     <th>Returned by</th>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#NAME_KEY}</td>
+     *     <td>{@link Identifier} or {@link String}</td>
+     *     <td>{@link #getName()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#ALIAS_KEY}</td>
+     *     <td>{@link GenericName} or {@link CharSequence} (optionally as array)</td>
+     *     <td>{@link #getAlias()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#IDENTIFIERS_KEY}</td>
+     *     <td>{@link Identifier} (optionally as array)</td>
+     *     <td>{@link #getIdentifiers()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td>
+     *     <td>{@link InternationalString} or {@link String}</td>
+     *     <td>{@link #getRemarks()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.datum.Datum#ANCHOR_POINT_KEY}</td>
+     *     <td>{@link InternationalString} or {@link String}</td>
+     *     <td>{@link #getAnchorPoint()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.datum.Datum#REALIZATION_EPOCH_KEY}</td>
+     *     <td>{@link Date}</td>
+     *     <td>{@link #getRealizationEpoch()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.datum.Datum#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>{@link InternationalString} or {@link String}</td>
+     *     <td>{@link #getScope()}</td>
+     *   </tr>
+     * </table>
+     *
+     * @param properties The properties to be given to the identified object.
+     *
+     * @see org.apache.sis.referencing.factory.GeodeticObjectFactory#createParametricDatum(Map)
+     */
+    public DefaultParametricDatum(final Map<String,?> properties) {
+        super(properties);
+    }
+
+    /**
+     * Creates a new datum with the same values than the specified one.
+     * This copy constructor provides a way to convert an arbitrary implementation into a SIS one
+     * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API.
+     *
+     * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
+     *
+     * @param datum The datum to copy.
+     *
+     * @see #castOrCopy(ParametricDatum)
+     */
+    protected DefaultParametricDatum(final ParametricDatum datum) {
+        super(datum);
+    }
+
+    /**
+     * Returns a SIS datum implementation with the same values than the given arbitrary implementation.
+     * If the given object is {@code null}, then this method returns {@code null}.
+     * Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged.
+     * Otherwise a new SIS implementation is created and initialized to the attribute values of the given object.
+     *
+     * @param  object The object to get as a SIS implementation, or {@code null} if none.
+     * @return A SIS implementation containing the values of the given object (may be the
+     *         given object itself), or {@code null} if the argument was null.
+     */
+    public static DefaultParametricDatum castOrCopy(final ParametricDatum object) {
+        return (object == null) || (object instanceof DefaultParametricDatum) ?
+                (DefaultParametricDatum) object : new DefaultParametricDatum(object);
+    }
+
+    /**
+     * Returns the GeoAPI interface implemented by this class.
+     * The SIS implementation returns {@code ParametricDatum.class}.
+     *
+     * <div class="note"><b>Note for implementors:</b>
+     * Subclasses usually do not need to override this method since GeoAPI does not define {@code TemporalDatum}
+     * sub-interface. Overriding possibility is left mostly for implementors who wish to extend GeoAPI with their
+     * own set of interfaces.</div>
+     *
+     * @return {@code ParametricDatum.class} or a user-defined sub-interface.
+     */
+    @Override
+    public Class<? extends ParametricDatum> getInterface() {
+        return ParametricDatum.class;
+    }
+
+    /**
+     * Formats this datum as a <cite>Well Known Text</cite> {@code ParametricDatum[…]} element.
+     *
+     * <div class="note"><b>Compatibility note:</b>
+     * {@code TimeDatum} is defined in the WKT 2 specification only.</div>
+     *
+     * @return {@code "ParametricDatum"}.
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#83">WKT 2 specification</a>
+     */
+    @Override
+    protected String formatTo(final Formatter formatter) {
+        super.formatTo(formatter);
+        if (formatter.getConvention().majorVersion() == 1) {
+            formatter.setInvalidWKT(this, null);
+        }
+        return formatter.shortOrLong(WKTKeywords.PDatum, WKTKeywords.ParametricDatum);
+    }
+
+
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+    ////////                                                                                  ////////
+    ////////                               XML support with JAXB                              ////////
+    ////////                                                                                  ////////
+    ////////        The following methods are invoked by JAXB using reflection (even if       ////////
+    ////////        they are private) or are helpers for other methods invoked by JAXB.       ////////
+    ////////        Those methods can be safely removed if Geographic Markup Language         ////////
+    ////////        (GML) support is not needed.                                              ////////
+    ////////                                                                                  ////////
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Constructs a new datum in which every attributes are set to a null value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    private DefaultParametricDatum() {
+    }
+
+}

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java?rev=1737203&r1=1737202&r2=1737203&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] Thu Mar 31 08:58:43 2016
@@ -393,6 +393,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 +628,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 +906,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/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java?rev=1737203&r1=1737202&r2=1737203&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] Thu Mar 31 08:58:43 2016
@@ -1548,4 +1548,92 @@ public class GeodeticObjectFactory exten
                     Errors.Keys.IllegalClass_2, CoordinateReferenceSystem.class, object.getClass()));
         }
     }
+
+    /**
+     * Creates a parametric coordinate reference system.
+     *
+     * <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 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 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("createTemporalDatum", datum);
+    }
+
 }



Mime
View raw message