sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1683824 [3/7] - in /sis/branches/JDK6: ./ application/sis-console/src/test/java/org/apache/sis/console/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ core/sis-metad...
Date Fri, 05 Jun 2015 17:46:10 GMT
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -21,12 +21,13 @@ import javax.xml.bind.annotation.XmlValu
 import javax.xml.bind.annotation.XmlAttribute;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
+import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.util.DefinitionURI;
 import org.apache.sis.internal.metadata.NameMeaning;
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.metadata.iso.citation.Citations;
 
-import static org.apache.sis.internal.util.Citations.getUnicodeIdentifier;
+import static org.apache.sis.internal.util.Citations.getCodeSpace;
 
 
 /**
@@ -36,7 +37,7 @@ import static org.apache.sis.internal.ut
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.5
+ * @version 0.6
  * @module
  */
 @XmlType(name = "CodeType")
@@ -103,11 +104,41 @@ public final class Code {
         String version = null, cs = codeSpace;
         final DefinitionURI parsed = DefinitionURI.parse(c);
         if (parsed != null) {
-            authority = Citations.fromName(cs); // May be null.
-            cs        = parsed.authority;
-            version   = parsed.version;
-            c         = parsed.code;
+            /*
+             * Case where the URN has been successfully parsed. The OGC's URN contains an "authority" component,
+             * which we take as the Identifier.codeSpace value (not Identifier.authority despite what the names
+             * would suggest).
+             *
+             * The GML document may also provide a 'codeSpace' attribute separated from the URN, which we take
+             * as the authority.  This is the opposite of what the names would suggest, but we can not map the
+             * 'codeSpace' attribute to Identifier.codeSpace  because the 'codeSpace' attribute value found in
+             * practice is often "IOGP" while the 'Identifier.description' example provided in ISO 19115-1 for
+             * an EPSG code has the "EPSG" codespace. Example:
+             *
+             *    - XML: <gml:identifier codeSpace="IOGP">urn:ogc:def:crs:EPSG::4326</gml:identifier>
+             *    - ISO: For "EPSG::4326", Identifier.codeSpace = "EPSG" and Identifier.code = "4326".
+             *
+             * Apache SIS attempts to organize this apparent contradiction by considering IOGP as the codespace of
+             * the EPSG codespace, but this interpretation is not likely to be widely used by libraries other than
+             * SIS. For now, a special handling is hard-coded below: if codeSpace = "IOGP" and authority = "EPSG",
+             * then we take the authority as the Citations.EPSG constant, which has a "IOGP:EPSG" identifier.
+             *
+             * A symmetrical special handling for EPSG is done in the 'forIdentifiedObject(…)' method of this class.
+             */
+            if (org.apache.sis.internal.util.Citations.isEPSG(cs, parsed.authority)) {
+                authority = Citations.EPSG;
+            } else {
+                authority = Citations.fromName(cs);     // May be null.
+            }
+            cs      = parsed.authority;
+            version = parsed.version;
+            c       = parsed.code;
         } else if (cs != null) {
+            /*
+             * Case where the URN can not be parsed but a 'codeSpace' attribute exists. We take this 'codeSpace'
+             * as both the code space and the authority. As a special case, if there is a semi-colon, we take all
+             * text after that semi-color as the version number.
+             */
             final int s = cs.lastIndexOf(DefinitionURI.SEPARATOR);
             if (s >= 0) {
                 version = cs.substring(s+1);
@@ -124,7 +155,8 @@ public final class Code {
      * <ul>
      *   <li>The first identifier having a code that begin with {@code "urn:"}.</li>
      *   <li>The first identifier having a code that begin with {@code "http:"}.</li>
-     *   <li>The first identifier, converted to the {@code "urn:} syntax if possible.</li>
+     *   <li>The first identifier in the {@code "EPSG"} codespace, converted to the {@code "urn:} syntax.</li>
+     *   <li>The first identifier in other codespace, converted to the {@code "urn:} syntax if possible.</li>
      * </ul>
      *
      * @param  type The type of the identified object.
@@ -134,6 +166,7 @@ public final class Code {
     public static Code forIdentifiedObject(final Class<?> type, final Iterable<? extends Identifier> identifiers) {
         if (identifiers != null) {
             boolean isHTTP = false;
+            boolean isEPSG = false;
             Identifier fallback = null;
             for (final Identifier identifier : identifiers) {
                 final String code = identifier.getCode();
@@ -143,13 +176,18 @@ public final class Code {
                 }
                 if (!isHTTP) {
                     isHTTP = code.regionMatches(true, 0, "http:", 0, 5);
-                    if (isHTTP || fallback == null) {
+                    if (isHTTP) {
                         fallback = identifier;
+                    } else if (!isEPSG) {
+                        isEPSG = Constants.EPSG.equalsIgnoreCase(identifier.getCodeSpace());
+                        if (isEPSG || fallback == null) {
+                            fallback = identifier;
+                        }
                     }
                 }
             }
             /*
-             * If no "urn:" or "http:" form has been found, try to create a "urn:" form the first identifier.
+             * If no "urn:" or "http:" form has been found, try to create a "urn:" form from the first identifier.
              * For example "EPSG:4326" may be converted to "urn:ogc:def:crs:EPSG:8.2:4326". If the first identifier
              * can not be converted to a "urn:" form, then it will be returned as-is.
              */
@@ -159,15 +197,50 @@ public final class Code {
                     if (urn != null) {
                         final Code code = new Code();
                         /*
-                         * Really getUnicodeIdentifier(…) below, not getCodeSpace(…). The reason is that the
-                         * code space already appears in the URN string, and common usage found in GML files
-                         * is to use the "codeSpace" attribute for the authority ("OGP" or "IOGP" for objects
-                         * from the EPSG database). Consequently in the common case where the authority is our
-                         * Citations.EPSG constant, we really want the "IOGP" string rather than "EPSG".
+                         * Rational for EPSG special case below:
+                         * -------------------------------------
+                         * Apache SIS already formats the Identifier.getCodeSpace() value in the URN.
+                         * This value is "EPSG" for IdentifiedObject instances from the EPSG database.
+                         * But GML additionally have a "codeSpace" attribute, and common usage seems to
+                         * give the "OGP" or "IOGP" value to that attribute as in the following example:
+                         *
+                         *     <gml:identifier codeSpace="IOGP">urn:ogc:def:crs:EPSG::4326</gml:identifier>
+                         *
+                         * A discussion can be found in the comments of https://issues.apache.org/jira/browse/SIS-196
+                         *
+                         * Where to take this "IOGP" value from? It is not the Identifier.getCodeSpace() String value
+                         * since ISO 19115-1 clearly uses the "EPSG" value in their example.  We could consider using
+                         * the Identifier.getAuthority() value, which is a Citation. But the "EPSG" part in above URN
+                         * is named "the authority" in URN specification, which suggest that Identifier.getAuthority()
+                         * should return a citation for the "EPSG Geodetic Parameter Dataset" rather than for the IOGP
+                         * organisation.
+                         *
+                         * Apache SIS declares IOGP as the codespace of the EPSG codespace, i.e. the identifier of the
+                         * EPSG authority is "IOGP:EPSG". So the code below searches for the "IOGP" part of the above.
+                         * However there is no indication at this time that objects from other sources than SIS would
+                         * follow such convention, so we also keep a hard-coded "IOGP" default value for now.
+                         *
+                         * A symmetrical special handling for EPSG is done in the 'getIdentifier()' method of this class.
                          *
-                         * See https://issues.apache.org/jira/browse/SIS-196
+                         * See https://issues.apache.org/jira/browse/SIS-199
                          */
-                        code.codeSpace = getUnicodeIdentifier(fallback.getAuthority());
+                        final Citation authority = fallback.getAuthority();
+                        if (isEPSG) {
+                            code.codeSpace = Constants.IOGP;    // Default value if we do not find a codespace below.
+                            if (authority != null) {
+                                for (final Identifier id : authority.getIdentifiers()) {
+                                    if (Constants.EPSG.equalsIgnoreCase(id.getCode())) {
+                                        final String cs = id.getCodeSpace();
+                                        if (cs != null) {
+                                            code.codeSpace = cs;
+                                            break;
+                                        }
+                                    }
+                                }
+                            }
+                        } else {
+                            code.codeSpace = getCodeSpace(authority);
+                        }
                         code.code = urn;
                         return code;
                     }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -18,8 +18,11 @@ package org.apache.sis.internal.referenc
 
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.apache.sis.internal.util.Utilities;
 import org.apache.sis.util.Characters;
 import org.apache.sis.util.Static;
+import org.apache.sis.util.iso.Types;
 
 import static org.opengis.referencing.cs.AxisDirection.*;
 import static org.apache.sis.util.CharSequences.*;
@@ -30,7 +33,7 @@ import static org.apache.sis.util.CharSe
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.5
+ * @version 0.6
  * @module
  */
 public final class AxisDirections extends Static {
@@ -511,4 +514,35 @@ public final class AxisDirections extend
         final int length = upper - lower;
         return (length == keyword.length()) && name.regionMatches(true, lower, keyword, 0, length);
     }
+
+    /**
+     * Builds a coordinate system name from the given array of axes.
+     * This method expects a {@code StringBuilder} pre-filled with the coordinate system name.
+     * The axis directions and abbreviations will be appended after the CS name.
+     * Examples:
+     *
+     * <ul>
+     *   <li>Ellipsoidal CS: North (°), East (°).</li>
+     *   <li>Cartesian CS: East (km), North (km).</li>
+     *   <li>Compound CS: East (km), North (km), Up (m).</li>
+     * </ul>
+     *
+     * @param  buffer A buffer pre-filled with the name header.
+     * @param  axes The axes to append in the given buffer.
+     * @return A name for the given coordinate system type and axes.
+     *
+     * @since 0.6
+     */
+    public static String appendTo(final StringBuilder buffer, final CoordinateSystemAxis[] axes) {
+        String separator = ": ";
+        for (final CoordinateSystemAxis axis : axes) {
+            buffer.append(separator).append(Types.getCodeLabel(axis.getDirection()));
+            separator = ", ";
+            final String symbol = Utilities.toString(axis.getUnit());
+            if (symbol != null && !symbol.isEmpty()) {
+                buffer.append(" (").append(symbol).append(')');
+            }
+        }
+        return buffer.append('.').toString();
+    }
 }

Copied: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/MergedProperties.java (from r1683791, sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/MergedProperties.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/MergedProperties.java?p2=sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/MergedProperties.java&p1=sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/MergedProperties.java&r1=1683791&r2=1683824&rev=1683824&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/MergedProperties.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/MergedProperties.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -69,11 +69,11 @@ public class MergedProperties extends Ab
     @Override
     protected EntryIterator<String,Object> entryIterator() {
         if (merge == null) {
-            merge = new HashMap<>(defaultProperties);
+            merge = new HashMap<String,Object>(defaultProperties);
             merge.putAll(properties);
             merge.remove(null);
         }
-        return new IteratorAdapter<>(merge);    // That iterator will skip null values.
+        return new IteratorAdapter<String,Object>(merge);    // That iterator will skip null values.
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/PositionalAccuracyConstant.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/PositionalAccuracyConstant.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/PositionalAccuracyConstant.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/PositionalAccuracyConstant.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -16,12 +16,25 @@
  */
 package org.apache.sis.internal.referencing;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.io.ObjectStreamException;
 import javax.xml.bind.annotation.XmlTransient;
+import javax.measure.quantity.Length;
+import javax.measure.unit.SI;
+import javax.measure.unit.Unit;
+import org.opengis.util.Record;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.quality.PositionalAccuracy;
 import org.opengis.metadata.quality.EvaluationMethodType;
+import org.opengis.metadata.quality.QuantitativeResult;
+import org.opengis.metadata.quality.Result;
+import org.opengis.referencing.operation.ConcatenatedOperation;
+import org.opengis.referencing.operation.Conversion;
+import org.opengis.referencing.operation.CoordinateOperation;
+import org.opengis.referencing.operation.SingleOperation;
+import org.opengis.referencing.operation.Transformation;
+import org.apache.sis.measure.Units;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.metadata.iso.quality.DefaultConformanceResult;
 import org.apache.sis.metadata.iso.quality.DefaultAbsoluteExternalPositionalAccuracy;
@@ -55,7 +68,7 @@ public final class PositionalAccuracyCon
      *
      * @see org.apache.sis.referencing.operation.AbstractCoordinateOperation#getLinearAccuracy()
      */
-    public static final double UNKNOWN_ACCURACY = 3000;
+    private static final double UNKNOWN_ACCURACY = 3000;
 
     /**
      * Default accuracy of datum shift, if not explicitly provided in the EPSG database.
@@ -66,7 +79,7 @@ public final class PositionalAccuracyCon
      *
      * @see org.apache.sis.referencing.operation.AbstractCoordinateOperation#getLinearAccuracy()
      */
-    public static final double DATUM_SHIFT_ACCURACY = 25;
+    private static final double DATUM_SHIFT_ACCURACY = 25;
 
     /**
      * Indicates that a {@linkplain org.opengis.referencing.operation.Transformation transformation}
@@ -113,4 +126,95 @@ public final class PositionalAccuracyCon
         if (equals(DATUM_SHIFT_OMITTED)) return DATUM_SHIFT_OMITTED;
         return this;
     }
+
+    /**
+     * Convenience method returning the accuracy in meters for the specified operation.
+     * This method tries each of the following procedures and returns the first successful one:
+     *
+     * <ul>
+     *   <li>If a {@link QuantitativeResult} is found with a linear unit, then this accuracy estimate
+     *       is converted to {@linkplain SI#METRE metres} and returned.</li>
+     *   <li>Otherwise, if the operation is a {@link Conversion}, then returns 0 since a conversion
+     *       is by definition accurate up to rounding errors.</li>
+     *   <li>Otherwise, if the operation is a {@link Transformation}, then checks if the datum shift
+     *       were applied with the help of Bursa-Wolf parameters. This procedure looks for SIS-specific
+     *       {@link #DATUM_SHIFT_APPLIED} and {@link #DATUM_SHIFT_OMITTED DATUM_SHIFT_OMITTED} constants.</li>
+     *   <li>Otherwise, if the operation is a {@link ConcatenatedOperation}, returns the sum of the accuracy
+     *       of all components. This is a conservative scenario where we assume that errors cumulate linearly.
+     *       Note that this is not necessarily the "worst case" scenario since the accuracy could be worst
+     *       if the math transforms are highly non-linear.</li>
+     * </ul>
+     *
+     * If the above is modified, please update {@code AbstractCoordinateOperation.getLinearAccuracy()} javadoc.
+     *
+     * @param  operation The operation to inspect for accuracy.
+     * @return The accuracy estimate (always in meters), or NaN if unknown.
+     *
+     * @see org.apache.sis.referencing.operation.AbstractCoordinateOperation#getLinearAccuracy()
+     */
+    public static double getLinearAccuracy(final CoordinateOperation operation) {
+        final Collection<PositionalAccuracy> accuracies = operation.getCoordinateOperationAccuracy();
+        for (final PositionalAccuracy accuracy : accuracies) {
+            for (final Result result : accuracy.getResults()) {
+                if (result instanceof QuantitativeResult) {
+                    final QuantitativeResult quantity = (QuantitativeResult) result;
+                    final Collection<? extends Record> records = quantity.getValues();
+                    if (records != null) {
+                        final Unit<?> unit = quantity.getValueUnit();
+                        if (Units.isLinear(unit)) {
+                            final Unit<Length> unitOfLength = unit.asType(Length.class);
+                            for (final Record record : records) {
+                                for (final Object value : record.getAttributes().values()) {
+                                    if (value instanceof Number) {
+                                        double v = ((Number) value).doubleValue();
+                                        v = unitOfLength.getConverterTo(SI.METRE).convert(v);
+                                        return v;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        /*
+         * No quantitative (linear) accuracy were found. If the coordinate operation is actually
+         * a conversion, the accuracy is up to rounding error (i.e. conceptually 0) by definition.
+         */
+        if (operation instanceof Conversion) {
+            return 0;
+        }
+        /*
+         * If the coordinate operation is actually a transformation, checks if Bursa-Wolf parameters
+         * were available for the datum shift. This is SIS-specific. See field javadoc for a rational
+         * about the return values chosen.
+         */
+        if (operation instanceof Transformation) {
+            if (accuracies.contains(DATUM_SHIFT_APPLIED)) {
+                return DATUM_SHIFT_ACCURACY;
+            }
+            if (accuracies.contains(DATUM_SHIFT_OMITTED)) {
+                return UNKNOWN_ACCURACY;
+            }
+        }
+        /*
+         * If the coordinate operation is a compound of other coordinate operations, returns the sum of their accuracy,
+         * skipping unknown ones. Making the sum is a conservative approach (not exactly the "worst case" scenario,
+         * since it could be worst if the transforms are highly non-linear).
+         */
+        double accuracy = Double.NaN;
+        if (operation instanceof ConcatenatedOperation) {
+            for (final SingleOperation op : ((ConcatenatedOperation) operation).getOperations()) {
+                final double candidate = Math.abs(getLinearAccuracy(op));
+                if (!Double.isNaN(candidate)) {
+                    if (Double.isNaN(accuracy)) {
+                        accuracy = candidate;
+                    } else {
+                        accuracy += candidate;
+                    }
+                }
+            }
+        }
+        return accuracy;
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -16,23 +16,33 @@
  */
 package org.apache.sis.internal.referencing;
 
-import org.apache.sis.internal.metadata.WKTKeywords;
+import java.util.Map;
 import java.util.Iterator;
 import java.util.Collection;
+import java.util.Collections;
+import javax.measure.unit.SI;
+import javax.measure.unit.Unit;
+import javax.measure.quantity.Length;
 
 import org.opengis.util.FactoryException;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.crs.SingleCRS;
+import org.opengis.referencing.crs.DerivedCRS;
 import org.opengis.referencing.crs.TemporalCRS;
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
+import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.operation.TransformException;
+import org.opengis.referencing.operation.OperationMethod;
 import org.opengis.referencing.operation.CoordinateOperation;
 import org.opengis.referencing.operation.CoordinateOperationFactory;
 import org.opengis.metadata.extent.GeographicBoundingBox;
@@ -40,16 +50,25 @@ import org.opengis.metadata.extent.Geogr
 import org.opengis.metadata.extent.VerticalExtent;
 import org.opengis.geometry.Envelope;
 
+import org.opengis.referencing.cs.AxisDirection;
 import org.apache.sis.geometry.Envelopes;
 import org.apache.sis.referencing.CRS;
 import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
+import org.apache.sis.referencing.cs.AbstractCS;
+import org.apache.sis.referencing.cs.AxisFilter;
+import org.apache.sis.referencing.cs.CoordinateSystems;
+import org.apache.sis.referencing.crs.DefaultDerivedCRS;
 import org.apache.sis.referencing.crs.DefaultTemporalCRS;
+import org.apache.sis.referencing.datum.BursaWolfParameters;
 import org.apache.sis.referencing.operation.transform.MathTransforms;
+import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
 import org.apache.sis.parameter.DefaultParameterDescriptor;
 import org.apache.sis.parameter.Parameterized;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.io.wkt.FormattableObject;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.metadata.iso.extent.DefaultExtent;
 import org.apache.sis.metadata.iso.extent.DefaultVerticalExtent;
 import org.apache.sis.metadata.iso.extent.DefaultTemporalExtent;
@@ -58,6 +77,7 @@ import org.apache.sis.metadata.iso.exten
 import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.internal.referencing.provider.Affine;
 import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.util.collection.Containers;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.Utilities;
 
@@ -77,77 +97,14 @@ public final class ServicesForMetadata e
     public ServicesForMetadata() {
     }
 
-    /**
-     * Returns a fully implemented parameter descriptor.
-     *
-     * @param  parameter A partially implemented parameter descriptor, or {@code null}.
-     * @return A fully implemented parameter descriptor, or {@code null} if the given argument was null.
-     */
-    @Override
-    public ParameterDescriptor<?> toImplementation(final ParameterDescriptor<?> parameter) {
-        return DefaultParameterDescriptor.castOrCopy(parameter);
-    }
 
-    /**
-     * Converts the given object in a {@code FormattableObject} instance.
-     *
-     * @param  object The object to wrap.
-     * @return The given object converted to a {@code FormattableObject} instance.
-     */
-    @Override
-    public FormattableObject toFormattableObject(final IdentifiedObject object) {
-        return AbstractIdentifiedObject.castOrCopy(object);
-    }
 
-    /**
-     * Converts the given object in a {@code FormattableObject} instance. Callers should verify that the given
-     * object is not already an instance of {@code FormattableObject} before to invoke this method. This method
-     * returns {@code null} if it can not convert the object.
-     *
-     * @param  object The object to wrap.
-     * @param  internal {@code true} if the formatting convention is {@code Convention.INTERNAL}.
-     * @return The given object converted to a {@code FormattableObject} instance, or {@code null}.
-     *
-     * @since 0.6
-     */
-    @Override
-    public FormattableObject toFormattableObject(final MathTransform object, boolean internal) {
-        Matrix matrix;
-        final ParameterValueGroup parameters;
-        if (internal && (matrix = MathTransforms.getMatrix(object)) != null) {
-            parameters = Affine.parameters(matrix);
-        } else if (object instanceof Parameterized) {
-            parameters = ((Parameterized) object).getParameterValues();
-        } else {
-            matrix = MathTransforms.getMatrix(object);
-            if (matrix == null) {
-                return null;
-            }
-            parameters = Affine.parameters(matrix);
-        }
-        return new FormattableObject() {
-            @Override
-            protected String formatTo(final Formatter formatter) {
-                WKTUtilities.appendParamMT(parameters, formatter);
-                return WKTKeywords.Param_MT;
-            }
-        };
-    }
 
-    /**
-     * Returns the coordinate operation factory to be used for transforming the envelope.
-     * We will fetch a lenient factory because {@link GeographicBoundingBox} are usually for approximative
-     * bounds (e.g. the area of validity of some CRS). If a user wants accurate bounds, he should probably
-     * use an {@link Envelope} with the appropriate CRS.
-     */
-    private static CoordinateOperationFactory getFactory() throws TransformException {
-        // TODO: specify a lenient factory when the API will allow that.
-        final CoordinateOperationFactory factory = DefaultFactories.forClass(CoordinateOperationFactory.class);
-        if (factory != null) {
-            return factory;
-        }
-        throw new TransformException(Errors.format(Errors.Keys.MissingRequiredModule_1, "geotk-referencing")); // This is temporary.
-    }
+    ///////////////////////////////////////////////////////////////////////////////////////
+    ////                                                                               ////
+    ////                        SERVICES FOR ISO 19115 METADATA                        ////
+    ////                                                                               ////
+    ///////////////////////////////////////////////////////////////////////////////////////
 
     /**
      * Creates an exception message for a spatial, vertical or temporal dimension not found.
@@ -182,8 +139,9 @@ public final class ServicesForMetadata e
                 !Utilities.equalsIgnoreMetadata(cs2.getAxis(1), cs1.getAxis(1)))
             {
                 final CoordinateOperation operation;
+                final CoordinateOperationFactory factory = DefaultFactories.forBuildin(CoordinateOperationFactory.class);
                 try {
-                    operation = getFactory().createOperation(crs, normalizedCRS);
+                    operation = factory.createOperation(crs, normalizedCRS);
                 } catch (FactoryException e) {
                     throw new TransformException(Errors.format(Errors.Keys.CanNotTransformEnvelopeToGeodetic), e);
                 }
@@ -414,4 +372,225 @@ public final class ServicesForMetadata e
             target.getTemporalElements().add(extent);
         }
     }
+
+
+
+
+    ///////////////////////////////////////////////////////////////////////////////////////
+    ////                                                                               ////
+    ////                          SERVICES FOR WKT FORMATTING                          ////
+    ////                                                                               ////
+    ///////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Returns a fully implemented parameter descriptor.
+     *
+     * @param  parameter A partially implemented parameter descriptor, or {@code null}.
+     * @return A fully implemented parameter descriptor, or {@code null} if the given argument was null.
+     */
+    @Override
+    public ParameterDescriptor<?> toImplementation(final ParameterDescriptor<?> parameter) {
+        return DefaultParameterDescriptor.castOrCopy(parameter);
+    }
+
+    /**
+     * Converts the given object in a {@code FormattableObject} instance.
+     *
+     * @param  object The object to wrap.
+     * @return The given object converted to a {@code FormattableObject} instance.
+     */
+    @Override
+    public FormattableObject toFormattableObject(final IdentifiedObject object) {
+        return AbstractIdentifiedObject.castOrCopy(object);
+    }
+
+    /**
+     * Converts the given object in a {@code FormattableObject} instance. Callers should verify that the given
+     * object is not already an instance of {@code FormattableObject} before to invoke this method. This method
+     * returns {@code null} if it can not convert the object.
+     *
+     * @param  object The object to wrap.
+     * @param  internal {@code true} if the formatting convention is {@code Convention.INTERNAL}.
+     * @return The given object converted to a {@code FormattableObject} instance, or {@code null}.
+     *
+     * @since 0.6
+     */
+    @Override
+    public FormattableObject toFormattableObject(final MathTransform object, boolean internal) {
+        Matrix matrix;
+        final ParameterValueGroup parameters;
+        if (internal && (matrix = MathTransforms.getMatrix(object)) != null) {
+            parameters = Affine.parameters(matrix);
+        } else if (object instanceof Parameterized) {
+            parameters = ((Parameterized) object).getParameterValues();
+        } else {
+            matrix = MathTransforms.getMatrix(object);
+            if (matrix == null) {
+                return null;
+            }
+            parameters = Affine.parameters(matrix);
+        }
+        return new FormattableObject() {
+            @Override
+            protected String formatTo(final Formatter formatter) {
+                WKTUtilities.appendParamMT(parameters, formatter);
+                return WKTKeywords.Param_MT;
+            }
+        };
+    }
+
+
+
+
+    ///////////////////////////////////////////////////////////////////////////////////////
+    ////                                                                               ////
+    ////                           SERVICES FOR WKT PARSING                            ////
+    ////                                                                               ////
+    ///////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Returns the Greenwich prime meridian.
+     *
+     * @return The Greenwich prime meridian.
+     *
+     * @since 0.6
+     */
+    @Override
+    public PrimeMeridian getGreenwich() {
+        return CommonCRS.WGS84.primeMeridian();
+    }
+
+    /**
+     * Returns the coordinate system of a geocentric CRS using axes in the given unit of measurement.
+     *
+     * @param  linearUnit The unit of measurement for the geocentric CRS axes.
+     * @return The coordinate system for a geocentric CRS with axes using the given unit of measurement.
+     *
+     * @since 0.6
+     */
+    @Override
+    public CartesianCS getGeocentricCS(final Unit<Length> linearUnit) {
+        CartesianCS cs = (CartesianCS) CommonCRS.WGS84.geocentric().getCoordinateSystem();
+        if (!SI.METRE.equals(linearUnit)) {
+            cs = (CartesianCS) CoordinateSystems.replaceAxes(cs, new AxisFilter() {
+                @Override public boolean accept(final CoordinateSystemAxis axis) {
+                    return true;
+                }
+
+                @Override public Unit<?> getUnitReplacement(final Unit<?> unit) {
+                    return linearUnit;
+                }
+
+                @Override public AxisDirection getDirectionReplacement(final AxisDirection direction) {
+                    return direction;
+                }
+            });
+        }
+        return cs;
+    }
+
+    /**
+     * Converts a geocentric coordinate system from the legacy WKT 1 to the current ISO 19111 standard.
+     * This method replaces the (Other, East, North) directions by (Geocentric X, Geocentric Y, Geocentric Z).
+     *
+     * @param  cs The geocentric coordinate system to upgrade.
+     * @return The upgraded coordinate system, or {@code cs} if there is no change to apply.
+     *
+     * @since 0.6
+     */
+    @Override
+    public CartesianCS upgradeGeocentricCS(final CartesianCS cs) {
+        return Legacy.forGeocentricCRS(cs, false);
+    }
+
+    /**
+     * Creates a coordinate system of unknown type. This method is used during parsing of WKT version 1,
+     * since that legacy format did not specified any information about the coordinate system in use.
+     * This method should not need to be invoked for parsing WKT version 2.
+     *
+     * @param  axes The axes of the unknown coordinate system.
+     * @return An "abstract" coordinate system using the given axes.
+     *
+     * @since 0.6
+     */
+    @Override
+    public CoordinateSystem createAbstractCS(final CoordinateSystemAxis[] axes) {
+        return new AbstractCS(Collections.singletonMap(AbstractCS.NAME_KEY,
+                AxisDirections.appendTo(new StringBuilder("CS"), axes)), axes);
+    }
+
+    /**
+     * Creates a derived CRS from the information found in a WKT 1 {@code FITTED_CS} element.
+     * This coordinate system can not be easily constructed from the information provided by the WKT 1 format.
+     * Note that this method is needed only for WKT 1 parsing, since WKT provides enough information for using
+     * the standard factories.
+     *
+     * @param  properties    The properties to be given to the {@code DerivedCRS} and {@code Conversion} objects.
+     * @param  baseCRS       Coordinate reference system to base the derived CRS on.
+     * @param  method        The coordinate operation method (mandatory in all cases).
+     * @param  baseToDerived Transform from positions in the base CRS to positions in this target CRS.
+     * @param  derivedCS     The coordinate system for the derived CRS.
+     * @return The newly created derived CRS, potentially implementing an additional CRS interface.
+     *
+     * @since 0.6
+     */
+    @Override
+    public DerivedCRS createDerivedCRS(final Map<String,?>    properties,
+                                       final SingleCRS        baseCRS,
+                                       final OperationMethod  method,
+                                       final MathTransform    baseToDerived,
+                                       final CoordinateSystem derivedCS)
+    {
+        return DefaultDerivedCRS.create(properties, baseCRS, null, method, baseToDerived, derivedCS);
+    }
+
+    /**
+     * Creates the {@code TOWGS84} element during parsing of a WKT version 1.
+     *
+     * @param  values The 7 Bursa-Wolf parameter values.
+     * @return The {@link BursaWolfParameters}.
+     *
+     * @since 0.6
+     */
+    @Override
+    public Object createToWGS84(final double[] values) {
+        final BursaWolfParameters info = new BursaWolfParameters(CommonCRS.WGS84.datum(), null);
+        info.setValues(values);
+        return info;
+    }
+
+    /**
+     * Returns the coordinate operation factory to use for the given properties and math transform factory.
+     * If the given properties are empty and the {@code mtFactory} is the system default, then this method
+     * returns the system default {@code CoordinateOperationFactory} instead of creating a new one.
+     *
+     * @param  properties The default properties.
+     * @param  mtFactory  The math transform factory to use.
+     * @return The coordinate operation factory to use.
+     *
+     * @since 0.6
+     */
+    @Override
+    public CoordinateOperationFactory getCoordinateOperationFactory(Map<String,?> properties, MathTransformFactory mtFactory) {
+        if (Containers.isNullOrEmpty(properties) && DefaultFactories.isDefaultInstance(MathTransformFactory.class, mtFactory)) {
+            return DefaultFactories.forBuildin(CoordinateOperationFactory.class);
+        } else {
+            return new DefaultCoordinateOperationFactory(properties, mtFactory);
+        }
+    }
+
+    /**
+     * Returns {@code true} if the {@linkplain AbstractIdentifiedObject#getName() primary name} or an aliases
+     * of the given object matches the given name.
+     *
+     * @param  object The object for which to check the name or alias.
+     * @param  name The name to compare with the object name or aliases.
+     * @return {@code true} if the primary name of at least one alias matches the specified {@code name}.
+     *
+     * @since 0.6
+     */
+    @Override
+    public boolean isHeuristicMatchForName(final IdentifiedObject object, final String name) {
+        return IdentifiedObjects.isHeuristicMatchForName(object, name);
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -36,6 +36,9 @@ import org.apache.sis.util.resources.Err
 
 import static org.apache.sis.referencing.IdentifiedObjects.isHeuristicMatchForName;
 
+// Branch-dependent imports
+import org.apache.sis.internal.jdk8.JDK8;
+
 
 /**
  * Convenience methods for fetching parameter values despite the variations in parameter names, value types and units.
@@ -646,24 +649,19 @@ public abstract class Parameters impleme
     public static void copy(final ParameterValueGroup values, final ParameterValueGroup destination)
             throws InvalidParameterNameException, InvalidParameterValueException
     {
-        final Integer ONE = 1;
+        final Integer ZERO = 0;
         final Map<String,Integer> occurrences = new HashMap<String,Integer>();
         for (final GeneralParameterValue value : values.values()) {
             final String name = value.getDescriptor().getName().getCode();
+            final int occurrence = JDK8.getOrDefault(occurrences, name, ZERO);
             if (value instanceof ParameterValueGroup) {
                 /*
                  * Contains sub-group - invokes 'copy' recursively.
+                 * The target group may exist, but not necessarily.
                  */
-                final GeneralParameterDescriptor descriptor;
-                descriptor = destination.getDescriptor().descriptor(name);
-                if (descriptor instanceof ParameterDescriptorGroup) {
-                    final ParameterValueGroup groups = (ParameterValueGroup) descriptor.createValue();
-                    copy((ParameterValueGroup) value, groups);
-                    values.groups(name).add(groups);
-                } else {
-                    throw new InvalidParameterNameException(Errors.format(
-                            Errors.Keys.UnexpectedParameter_1, name), name);
-                }
+                final List<ParameterValueGroup> groups = destination.groups(name);
+                copy((ParameterValueGroup) value, (occurrence < groups.size())
+                        ? groups.get(occurrence) : destination.addGroup(name));
             } else {
                 /*
                  * Single parameter - copy the value, with special care for value with units
@@ -672,9 +670,7 @@ public abstract class Parameters impleme
                  */
                 final ParameterValue<?> source = (ParameterValue<?>) value;
                 final ParameterValue<?> target;
-                Integer occurrence = occurrences.get(name);
-                if (occurrence == null) {
-                    occurrence = ONE;
+                if (occurrence == 0) {
                     try {
                         target = destination.parameter(name);
                     } catch (ParameterNotFoundException cause) {
@@ -683,9 +679,7 @@ public abstract class Parameters impleme
                     }
                 } else {
                     target = (ParameterValue<?>) getOrCreate(destination, name, occurrence);
-                    occurrence++;
                 }
-                occurrences.put(name, occurrence);
                 final Object  v    = source.getValue();
                 final Unit<?> unit = source.getUnit();
                 if (unit == null) {
@@ -699,6 +693,7 @@ public abstract class Parameters impleme
                             Errors.Keys.IllegalArgumentValue_2, name, v), name, v);
                 }
             }
+            occurrences.put(name, occurrence + 1);
         }
     }
 

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -43,6 +43,7 @@ import org.apache.sis.internal.metadata.
 import org.apache.sis.internal.jaxb.referencing.Code;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
+import org.apache.sis.internal.metadata.NameToIdentifier;
 import org.apache.sis.internal.referencing.WKTUtilities;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.system.DefaultFactories;
@@ -55,6 +56,7 @@ import org.apache.sis.util.ComparisonMod
 import org.apache.sis.util.LenientComparable;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.iso.Types;
+import org.apache.sis.util.iso.DefaultNameFactory;
 import org.apache.sis.util.resources.Errors;
 
 import static org.apache.sis.util.ArgumentChecks.*;
@@ -66,7 +68,6 @@ import static org.apache.sis.internal.ut
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
-import org.apache.sis.util.iso.DefaultNameFactory;
 
 
 /**
@@ -788,7 +789,7 @@ public class AbstractIdentifiedObject ex
      * @see IdentifiedObjects#isHeuristicMatchForName(IdentifiedObject, String)
      */
     public boolean isHeuristicMatchForName(final String name) {
-        return IdentifiedObjects.isHeuristicMatchForName(this.name, alias, name);
+        return NameToIdentifier.isHeuristicMatchForName(this.name, alias, name);
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/DeprecatedCode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/DeprecatedCode.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/DeprecatedCode.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/DeprecatedCode.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -24,9 +24,15 @@ import org.apache.sis.util.resources.Voc
 
 
 /**
- * An identifier for a deprecated identifier.
+ * An identifier which should not be used anymore.
  * This is used mostly for deprecated EPSG codes.
  *
+ * <div class="note"><b>Implementation note:</b>
+ * this class opportunistically recycle the {@linkplain #getDescription() description} property into a
+ * {@linkplain #getRemarks() remarks} property. This is a lazy way to inherit {@link #equals(Object)}
+ * and {@link #hashCode()} implementation without adding code in this class for taking in account a
+ * new field.</div>
+ *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
  * @version 0.6
@@ -39,13 +45,6 @@ final class DeprecatedCode extends Immut
     private static final long serialVersionUID = 357222258307746767L;
 
     /**
-     * Information about the replacement for this identifier.
-     *
-     * @see #getRemarks()
-     */
-    private final InternationalString remarks;
-
-    /**
      * Creates a deprecated identifier.
      *
      * @param supersededBy The code that replace this one.
@@ -53,8 +52,8 @@ final class DeprecatedCode extends Immut
     DeprecatedCode(final Citation authority, final String codeSpace,
             final String code, final String version, final CharSequence supersededBy)
     {
-        super(authority, codeSpace, code, version, null);
-        remarks = Vocabulary.formatInternational(Vocabulary.Keys.SupersededBy_1, supersededBy);
+        super(authority, codeSpace, code, version,
+                Vocabulary.formatInternational(Vocabulary.Keys.SupersededBy_1, supersededBy));
     }
 
     /**
@@ -76,6 +75,17 @@ final class DeprecatedCode extends Immut
      */
     @Override
     public InternationalString getRemarks() {
-        return remarks;
+        return super.getDescription();
+    }
+
+    /**
+     * Returns {@code null}, since we used the description for the superseded information.
+     * See <cite>"Implementation note"</cite> in class javadoc.
+     *
+     * @return {@code null}.
+     */
+    @Override
+    public InternationalString getDescription() {
+        return null;
     }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -33,9 +33,9 @@ import org.apache.sis.util.Static;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.iso.DefaultNameSpace;
 import org.apache.sis.metadata.iso.citation.Citations; // For javadoc.
+import org.apache.sis.internal.metadata.NameToIdentifier;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
-import static org.apache.sis.util.Characters.Filter.LETTERS_AND_DIGITS;
 import static org.apache.sis.internal.util.Citations.iterator;
 import static org.apache.sis.internal.util.Citations.identifierMatches;
 
@@ -85,6 +85,15 @@ public final class IdentifiedObjects ext
      *       <td>{@link CoordinateOperation#getCoordinateOperationAccuracy()}</td></tr>
      * </table>
      *
+     * <div class="note"><b>Note:</b>
+     * the current implementation does not provide
+     * {@value org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#MINIMUM_VALUE_KEY},
+     * {@value org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#MAXIMUM_VALUE_KEY} or
+     * {@value org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#RANGE_MEANING_KEY} entry for
+     * {@link org.opengis.referencing.cs.CoordinateSystemAxis} instances because the minimum and maximum
+     * values depend on the {@linkplain org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#getUnit()
+     * units of measurement}.</div>
+     *
      * @param  object The identified object to view as a properties map.
      * @param  excludes The keys of properties to exclude from the map.
      * @return An view of the identified object as an immutable map.
@@ -396,51 +405,8 @@ public final class IdentifiedObjects ext
             return ((AbstractIdentifiedObject) object).isHeuristicMatchForName(name);
         } else {
             ensureNonNull("object", object);
-            return isHeuristicMatchForName(object.getName(), object.getAlias(), name);
-        }
-    }
-
-    /**
-     * Returns {@code true} if the given {@linkplain AbstractIdentifiedObject#getName() primary name} or one
-     * of the given aliases matches the given name. The comparison ignores case, some Latin diacritical signs
-     * and any characters that are not letters or digits.
-     *
-     * @param  name     The name of the {@code IdentifiedObject} to check.
-     * @param  aliases  The list of alias in the {@code IdentifiedObject} (may be {@code null}).
-     *                  This method will never modify this list. Consequently, the
-     *                  given list can be a direct reference to an internal list.
-     * @param  toSearch The name for which to check for equality.
-     * @return {@code true} if the primary name or at least one alias matches the given {@code name}.
-     */
-    static boolean isHeuristicMatchForName(final Identifier name, final Collection<GenericName> aliases,
-            CharSequence toSearch)
-    {
-        toSearch = CharSequences.toASCII(toSearch);
-        if (name != null) { // Paranoiac check.
-            final CharSequence code = CharSequences.toASCII(name.getCode());
-            if (code != null) { // Paranoiac check.
-                if (CharSequences.equalsFiltered(toSearch, code, LETTERS_AND_DIGITS, true)) {
-                    return true;
-                }
-            }
-        }
-        if (aliases != null) {
-            for (final GenericName alias : aliases) {
-                if (alias != null) { // Paranoiac check.
-                    final CharSequence tip = CharSequences.toASCII(alias.tip().toString());
-                    if (CharSequences.equalsFiltered(toSearch, tip, LETTERS_AND_DIGITS, true)) {
-                        return true;
-                    }
-                    /*
-                     * Note: a previous version compared also the scoped names. We removed that part,
-                     * because experience has shown that this method is used only for the "code" part
-                     * of an object name. If we really want to compare scoped name, it would probably
-                     * be better to take a GenericName argument instead than String.
-                     */
-                }
-            }
+            return NameToIdentifier.isHeuristicMatchForName(object.getName(), object.getAlias(), name);
         }
-        return false;
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java?rev=1683824&r1=1683823&r2=1683824&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java [UTF-8] Fri Jun  5 17:46:07 2015
@@ -25,13 +25,15 @@ import org.opengis.util.FactoryException
 import org.opengis.referencing.datum.Datum;
 import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.referencing.crs.GeneralDerivedCRS;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.operation.OperationMethod;
 import org.opengis.referencing.operation.Conversion;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.geometry.MismatchedDimensionException;
 import org.apache.sis.referencing.operation.DefaultConversion;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.system.Semaphores;
 import org.apache.sis.util.resources.Errors;
@@ -90,8 +92,8 @@ abstract class AbstractDerivedCRS<C exte
      * @param  conversion The defining conversion from a normalized base to a normalized derived CRS.
      * @param  derivedCS  The coordinate system for the derived CRS. The number of axes
      *         must match the target dimension of the {@code baseToDerived} transform.
-     * @throws MismatchedDimensionException if the source and target dimension of {@code baseToDerived}
-     *         do not match the dimension of {@code base} and {@code derivedCS} respectively.
+     * @throws MismatchedDimensionException if the source and target dimensions of {@code baseToDerived}
+     *         do not match the dimensions of {@code base} and {@code derivedCS} respectively.
      */
     AbstractDerivedCRS(final Map<String,?>    properties,
                        final SingleCRS        baseCRS,
@@ -111,6 +113,27 @@ abstract class AbstractDerivedCRS<C exte
     }
 
     /**
+     * For {@link DefaultDerivedCRS#DefaultDerivedCRS(Map, SingleCRS, CoordinateReferenceSystem, OperationMethod,
+     * MathTransform, CoordinateSystem)} constructor only (<strong>not legal for {@code ProjectedCRS}</strong>).
+     */
+    @SuppressWarnings("unchecked")
+    AbstractDerivedCRS(final Map<String,?>             properties,
+                       final SingleCRS                 baseCRS,
+                       final CoordinateReferenceSystem interpolationCRS,
+                       final OperationMethod           method,
+                       final MathTransform             baseToDerived,
+                       final CoordinateSystem          derivedCS)
+            throws MismatchedDimensionException
+    {
+        super(properties, derivedCS);
+        ArgumentChecks.ensureNonNull("baseCRS", baseCRS);
+        ArgumentChecks.ensureNonNull("method", method);
+        ArgumentChecks.ensureNonNull("baseToDerived", baseToDerived);
+        conversionFromBase = (C) new DefaultConversion(   // Cast to (C) is valid only for DefaultDerivedCRS.
+                ConversionKeys.unprefix(properties), baseCRS, this, interpolationCRS, method, baseToDerived);
+    }
+
+    /**
      * 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.
@@ -136,7 +159,7 @@ abstract class AbstractDerivedCRS<C exte
     private C createConversionFromBase(final Map<String,?> properties, final SingleCRS baseCRS, final Conversion conversion) {
         MathTransformFactory factory = null;
         if (properties != null) {
-            factory = (MathTransformFactory) properties.get(OperationMethods.MT_FACTORY);
+            factory = (MathTransformFactory) properties.get(ReferencingServices.MT_FACTORY);
         }
         if (factory == null) {
             factory = DefaultFactories.forBuildin(MathTransformFactory.class);

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=1683824&r1=1683823&r2=1683824&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] Fri Jun  5 17:46:07 2015
@@ -31,15 +31,18 @@ import org.opengis.referencing.crs.Verti
 import org.opengis.referencing.crs.TemporalCRS;
 import org.opengis.referencing.crs.ProjectedCRS;
 import org.opengis.referencing.crs.EngineeringCRS;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.cs.VerticalCS;
 import org.opengis.referencing.cs.TimeCS;
 import org.opengis.referencing.operation.Conversion;
+import org.opengis.referencing.operation.OperationMethod;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.NoninvertibleTransformException;
 import org.opengis.geometry.MismatchedDimensionException;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
+import org.apache.sis.referencing.operation.DefaultConversion;
 import org.apache.sis.referencing.operation.DefaultOperationMethod;
 import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.internal.referencing.WKTUtilities;
@@ -51,9 +54,8 @@ import org.apache.sis.util.Classes;
 
 
 /**
- * A coordinate reference system that is defined by its coordinate
- * {@linkplain org.apache.sis.referencing.operation.DefaultConversion conversion} from another CRS
- * (not by a {@linkplain org.apache.sis.referencing.datum.AbstractDatum datum}). {@code DerivedCRS}
+ * A coordinate reference system that is defined by its coordinate {@linkplain DefaultConversion conversion}
+ * from another CRS (not by a {@linkplain org.apache.sis.referencing.datum.AbstractDatum datum}). {@code DerivedCRS}
  * can not be {@linkplain DefaultProjectedCRS projected CRS} themselves, but may be derived from a projected CRS
  * (for example in order to use a {@linkplain org.apache.sis.referencing.cs.DefaultPolarCS polar coordinate system}).
  *
@@ -154,8 +156,8 @@ public class DefaultDerivedCRS extends A
      *                    to a normalized derived CRS.
      * @param  derivedCS  The coordinate system for the derived CRS. The number of axes
      *         must match the target dimension of the {@code baseToDerived} transform.
-     * @throws MismatchedDimensionException if the source and target dimension of {@code baseToDerived}
-     *         do not match the dimension of {@code base} and {@code derivedCS} respectively.
+     * @throws MismatchedDimensionException if the source and target dimensions of {@code baseToDerived}
+     *         do not match the dimensions of {@code base} and {@code derivedCS} respectively.
      *
      * @see #create(Map, SingleCRS, Conversion, CoordinateSystem)
      */
@@ -169,6 +171,72 @@ public class DefaultDerivedCRS extends A
     }
 
     /**
+     * Creates a derived CRS from a math transform. The given {@code MathTransform} shall transform coordinate
+     * values specifically from the {@code baseCRS} to {@code this} CRS (optionally with an interpolation CRS);
+     * there is no consideration about <cite>“normalized CRS”</cite> in this constructor.
+     *
+     * <div class="section">Conversion properties</div>
+     * The {@code properties} map given in argument can contain any entries documented in the
+     * {@linkplain #DefaultDerivedCRS(Map, SingleCRS, Conversion, CoordinateSystem) above constructor},
+     * together with any entries documented by the {@linkplain DefaultConversion#DefaultConversion(Map,
+     * CoordinateReferenceSystem, CoordinateReferenceSystem, CoordinateReferenceSystem, OperationMethod, MathTransform)
+     * conversion constructor} provided that the {@code Conversion} entry keys are prefixed by {@code "conversion."}.
+     * In particular, the two first properties listed below are mandatory:
+     *
+     * <table class="sis">
+     *   <caption>Mandatory properties and some optional properties</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>{@code this.getName()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>"conversion.name"</td>
+     *     <td>{@link org.opengis.metadata.Identifier} or {@link String}</td>
+     *     <td>{@code conversionFromBase.getName()}</td>
+     *   </tr>
+     *   <tr>
+     *     <th colspan="3" class="hsep">Optional properties (non exhaustive list)</th>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#IDENTIFIERS_KEY}</td>
+     *     <td>{@link org.opengis.metadata.Identifier} (optionally as array)</td>
+     *     <td>{@code this.getIdentifiers()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.operation.CoordinateOperation#DOMAIN_OF_VALIDITY_KEY}</td>
+     *     <td>{@link org.opengis.metadata.extent.Extent}</td>
+     *     <td>{@code conversionFromBase.getDomainOfValidity()}</td>
+     *   </tr>
+     * </table>
+     *
+     * @param  properties       The properties to be given to the {@link DefaultConversion} object
+     *                          (with keys prefixed by {@code "conversion."}) and to the new derived CRS object.
+     * @param  baseCRS          Coordinate reference system to base the derived CRS on.
+     * @param  interpolationCRS The CRS of additional coordinates needed for the operation, or {@code null} if none.
+     * @param  method           The coordinate operation method (mandatory in all cases).
+     * @param  baseToDerived    Transform from positions in the base CRS to positions in this target CRS.
+     * @param  derivedCS        The coordinate system for the derived CRS.
+     * @throws IllegalArgumentException if at least one argument has an incompatible number of dimensions.
+     *
+     * @see #create(Map, SingleCRS, CoordinateReferenceSystem, OperationMethod, MathTransform, CoordinateSystem)
+     */
+    protected DefaultDerivedCRS(final Map<String,?>             properties,
+                                final SingleCRS                 baseCRS,
+                                final CoordinateReferenceSystem interpolationCRS,
+                                final OperationMethod           method,
+                                final MathTransform             baseToDerived,
+                                final CoordinateSystem          derivedCS)
+    {
+        super(properties, baseCRS, interpolationCRS, method, baseToDerived, derivedCS);
+    }
+
+    /**
      * 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.
@@ -197,8 +265,8 @@ public class DefaultDerivedCRS extends A
      * @param  derivedCS  The coordinate system for the derived CRS. The number of axes
      *         must match the target dimension of the {@code baseToDerived} transform.
      * @return The newly created derived CRS, potentially implementing an additional CRS interface.
-     * @throws MismatchedDimensionException if the source and target dimension of {@code baseToDerived}
-     *         do not match the dimension of {@code base} and {@code derivedCS} respectively.
+     * @throws MismatchedDimensionException if the source and target dimensions of {@code baseToDerived}
+     *         do not match the dimensions of {@code base} and {@code derivedCS} respectively.
      *
      * @see #DefaultDerivedCRS(Map, SingleCRS, Conversion, CoordinateSystem)
      */
@@ -210,15 +278,74 @@ public class DefaultDerivedCRS extends A
     {
         if (baseCRS != null && derivedCS != null) {
             final String type = getType(baseCRS, derivedCS);
-            if (WKTKeywords.GeodeticCRS   .equals(type)) return new Geodetic   (properties, (GeodeticCRS) baseCRS, conversion, (EllipsoidalCS) 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.EngineeringCRS.equals(type)) return new Engineering(properties,               baseCRS, conversion,                 derivedCS);
+            if (type != null) {
+                if (WKTKeywords.GeodeticCRS.equals(type)) return new Geodetic(properties, (GeodeticCRS) baseCRS, conversion, (EllipsoidalCS) 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.EngineeringCRS.equals(type)) {
+                    /*
+                     * This case may happen for baseCRS of kind GeodeticCRS, ProjectedCRS or EngineeringCRS.
+                     * But only the later is associated to EngineeringDatum; the two formers are associated
+                     * to GeodeticDatum. Consequently we can implement the EngineeringCRS.getDatum() method
+                     * only if the base CRS is itself of kind EngineeringCRS.  Otherwise we will return the
+                     * "type-neutral" DefaultDerivedCRS implementation.   Note that even in the later case,
+                     * the WKT format will still be able to detect that the WKT keyword is "EngineeringCRS".
+                     */
+                    if (baseCRS instanceof EngineeringCRS) {
+                        return new Engineering(properties, (EngineeringCRS) baseCRS, conversion, derivedCS);
+                    }
+                }
+            }
         }
         return new DefaultDerivedCRS(properties, baseCRS, conversion, derivedCS);
     }
 
     /**
+     * Creates a derived CRS from a math transform and a type inferred from the given arguments.
+     * This method expects the same arguments and performs the same work than the
+     * {@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.
+     * See the class javadoc for more information.
+     *
+     * @param  properties       The properties to be given to the {@link DefaultConversion} object
+     *                          (with keys prefixed by {@code "conversion."}) and to the new derived CRS object.
+     * @param  baseCRS          Coordinate reference system to base the derived CRS on.
+     * @param  interpolationCRS The CRS of additional coordinates needed for the operation, or {@code null} if none.
+     * @param  method           The coordinate operation method (mandatory in all cases).
+     * @param  baseToDerived    Transform from positions in the base CRS to positions in this target CRS.
+     * @param  derivedCS        The coordinate system for the derived CRS.
+     * @return The newly created derived CRS, potentially implementing an additional CRS interface.
+     * @throws IllegalArgumentException if at least one argument has an incompatible number of dimensions.
+     *
+     * @see #DefaultDerivedCRS(Map, SingleCRS, CoordinateReferenceSystem, OperationMethod, MathTransform, CoordinateSystem)
+     */
+    public static DefaultDerivedCRS create(final Map<String,?>             properties,
+                                           final SingleCRS                 baseCRS,
+                                           final CoordinateReferenceSystem interpolationCRS,
+                                           final OperationMethod           method,
+                                           final MathTransform             baseToDerived,
+                                           final CoordinateSystem          derivedCS)
+    {
+        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, (EllipsoidalCS) 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.EngineeringCRS.equals(type)) {
+                    if (baseCRS instanceof EngineeringCRS) {
+                        // See the comment in create(Map, SingleCRS, Conversion, CoordinateSystem)
+                        return new Engineering(properties, (EngineeringCRS) baseCRS, interpolationCRS, method, baseToDerived, derivedCS);
+                    }
+                }
+            }
+        }
+        return new DefaultDerivedCRS(properties, baseCRS, interpolationCRS, method, baseToDerived, derivedCS);
+    }
+
+    /**
      * 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.
@@ -233,10 +360,12 @@ public class DefaultDerivedCRS extends A
             return (DefaultDerivedCRS) object;
         } else {
             final String type = getType(object.getBaseCRS(), object.getCoordinateSystem());
-            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.EngineeringCRS.equals(type)) return new Engineering(object);
+            if (type != null) {
+                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.EngineeringCRS.equals(type)) return new Engineering(object);
+            }
             return new DefaultDerivedCRS(object);
         }
     }
@@ -279,8 +408,8 @@ public class DefaultDerivedCRS extends A
     /**
      * Returns the CRS on which the conversion is applied.
      * This CRS defines the {@linkplain #getDatum() datum} of this CRS and (at least implicitly)
-     * the {@linkplain org.apache.sis.referencing.operation.DefaultConversion#getSourceCRS() source}
-     * of the {@linkplain #getConversionFromBase() conversion from base}.
+     * the {@linkplain DefaultConversion#getSourceCRS() source} of
+     * the {@linkplain #getConversionFromBase() conversion from base}.
      *
      * @return The base coordinate reference system.
      */
@@ -294,10 +423,9 @@ public class DefaultDerivedCRS extends A
      * In Apache SIS, the conversion source and target CRS are set to the following values:
      *
      * <ul>
-     *   <li>The conversion {@linkplain org.apache.sis.referencing.operation.DefaultConversion#getSourceCRS()
-     *       source CRS} is the {@linkplain #getBaseCRS() base CRS} of {@code this} CRS.</li>
-     *   <li>The conversion {@linkplain org.apache.sis.referencing.operation.DefaultConversion#getTargetCRS()
-     *       target CRS} is {@code this} CRS.
+     *   <li>The conversion {@linkplain DefaultConversion#getSourceCRS() source CRS}
+     *       is the {@linkplain #getBaseCRS() base CRS} of {@code this} CRS.</li>
+     *   <li>The conversion {@linkplain DefaultConversion#getTargetCRS() target CRS} is {@code this} CRS.
      * </ul>
      *
      * <div class="note"><b>Note:</b>
@@ -474,11 +602,18 @@ public class DefaultDerivedCRS extends A
             super(other);
         }
 
-        /** Creates a new geodetic CRS derived from the given one. */
+        /** Creates a new geodetic CRS from the given properties. */
         Geodetic(Map<String,?> properties, GeodeticCRS baseCRS, Conversion conversion, EllipsoidalCS derivedCS) {
             super(properties, baseCRS, conversion, derivedCS);
         }
 
+        /** Creates a new geodetic CRS from the given properties. */
+        Geodetic(Map<String,?> properties, GeodeticCRS baseCRS, CoordinateReferenceSystem interpolationCRS,
+                OperationMethod method, MathTransform baseToDerived, EllipsoidalCS derivedCS)
+        {
+            super(properties, baseCRS, interpolationCRS, method, baseToDerived, derivedCS);
+        }
+
         /** Returns the datum of the base geodetic CRS. */
         @Override public GeodeticDatum getDatum() {
             return (GeodeticDatum) super.getDatum();
@@ -515,11 +650,18 @@ public class DefaultDerivedCRS extends A
             super(other);
         }
 
-        /** Creates a new vertical CRS derived from the given one. */
+        /** Creates a new vertical CRS from the given properties. */
         Vertical(Map<String,?> properties, VerticalCRS baseCRS, Conversion conversion, VerticalCS derivedCS) {
             super(properties, baseCRS, conversion, derivedCS);
         }
 
+        /** Creates a new vertical CRS from the given properties. */
+        Vertical(Map<String,?> properties, VerticalCRS baseCRS, CoordinateReferenceSystem interpolationCRS,
+                OperationMethod method, MathTransform baseToDerived, VerticalCS derivedCS)
+        {
+            super(properties, baseCRS, interpolationCRS, method, baseToDerived, derivedCS);
+        }
+
         /** Returns the datum of the base vertical CRS. */
         @Override public VerticalDatum getDatum() {
             return (VerticalDatum) super.getDatum();
@@ -556,11 +698,18 @@ public class DefaultDerivedCRS extends A
             super(other);
         }
 
-        /** Creates a new temporal CRS derived from the given one. */
+        /** Creates a new temporal CRS from the given properties. */
         Temporal(Map<String,?> properties, TemporalCRS baseCRS, Conversion conversion, TimeCS derivedCS) {
             super(properties, baseCRS, conversion, derivedCS);
         }
 
+        /** Creates a new temporal CRS from the given properties. */
+        Temporal(Map<String,?> properties, TemporalCRS baseCRS, CoordinateReferenceSystem interpolationCRS,
+                OperationMethod method, MathTransform baseToDerived, TimeCS derivedCS)
+        {
+            super(properties, baseCRS, interpolationCRS, method, baseToDerived, derivedCS);
+        }
+
         /** Returns the datum of the base temporal CRS. */
         @Override public TemporalDatum getDatum() {
             return (TemporalDatum) super.getDatum();
@@ -600,21 +749,27 @@ public class DefaultDerivedCRS extends A
             super(other);
         }
 
-        /** Creates a new temporal CRS derived from the given one. */
-        Engineering(Map<String,?> properties, SingleCRS baseCRS, Conversion conversion, CoordinateSystem derivedCS) {
+        /** Creates a new engineering CRS from the given properties. */
+        Engineering(Map<String,?> properties, EngineeringCRS baseCRS, Conversion conversion, CoordinateSystem derivedCS) {
             super(properties, baseCRS, conversion, derivedCS);
         }
 
+        /** Creates a new engineering CRS from the given properties. */
+        Engineering(Map<String,?> properties, EngineeringCRS baseCRS, CoordinateReferenceSystem interpolationCRS,
+                OperationMethod method, MathTransform baseToDerived, CoordinateSystem derivedCS)
+        {
+            super(properties, baseCRS, interpolationCRS, method, baseToDerived, derivedCS);
+        }
+
         /** Returns the datum of the base engineering CRS. */
         @Override public EngineeringDatum getDatum() {
-            final Datum datum = super.getDatum();
-            return (datum instanceof EngineeringDatum) ? (EngineeringDatum) datum : null;
+            return (EngineeringDatum) super.getDatum();
         }
 
         /** 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 Engineering(properties, (SingleCRS) conversionFromBase.getSourceCRS(), conversionFromBase, derivedCS);
+            return new Engineering(properties, (EngineeringCRS) conversionFromBase.getSourceCRS(), conversionFromBase, derivedCS);
         }
 
         /** Returns the WKT keyword for this derived CRS type.*/

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=1683824&r1=1683823&r2=1683824&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] Fri Jun  5 17:46:07 2015
@@ -50,7 +50,7 @@ import org.apache.sis.referencing.Abstra
  *   <li>Create a {@code GeocentricCRS} from an identifier in a database by invoking
  *       {@link org.opengis.referencing.crs.CRSAuthorityFactory#createGeocentricCRS(String)}.</li>
  *   <li>Create a {@code GeocentricCRS} by invoking the {@code CRSFactory.createGeocentricCRS(…)} method
- *       (implemented for example by {@link org.apache.sis.referencing.GeodeticObjectFactory}).</li>
+ *       (implemented for example by {@link org.apache.sis.referencing.factory.GeodeticObjectFactory}).</li>
  *   <li>Create a {@code GeocentricCRS} by invoking the
  *       {@linkplain #DefaultGeocentricCRS(Map, GeodeticDatum, CartesianCS) constructor}.</li>
  * </ol>

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=1683824&r1=1683823&r2=1683824&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] Fri Jun  5 17:46:07 2015
@@ -64,7 +64,7 @@ import static org.apache.sis.internal.ut
  *   <li>Create a {@code GeographicCRS} from an identifier in a database by invoking
  *       {@link org.opengis.referencing.crs.CRSAuthorityFactory#createGeographicCRS(String)}.</li>
  *   <li>Create a {@code GeographicCRS} by invoking the {@code CRSFactory.createGeographicCRS(…)} method
- *       (implemented for example by {@link org.apache.sis.referencing.GeodeticObjectFactory}).</li>
+ *       (implemented for example by {@link org.apache.sis.referencing.factory.GeodeticObjectFactory}).</li>
  *   <li>Create a {@code GeographicCRS} by invoking the
  *       {@linkplain #DefaultGeographicCRS(Map, GeodeticDatum, EllipsoidalCS) constructor}.</li>
  * </ol>

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=1683824&r1=1683823&r2=1683824&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] Fri Jun  5 17:46:07 2015
@@ -145,8 +145,8 @@ public class DefaultProjectedCRS extends
      *                    to a normalized derived CRS.
      * @param  derivedCS  The coordinate system for the derived CRS. The number of axes
      *         must match the target dimension of the {@code baseToDerived} transform.
-     * @throws MismatchedDimensionException if the source and target dimension of {@code baseToDerived}
-     *         do not match the dimension of {@code base} and {@code derivedCS} respectively.
+     * @throws MismatchedDimensionException if the source and target dimensions of {@code baseToDerived}
+     *         do not match the dimensions of {@code base} and {@code derivedCS} respectively.
      */
     public DefaultProjectedCRS(final Map<String,?> properties,
                                final GeographicCRS baseCRS,



Mime
View raw message