sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1674333 [1/3] - in /sis/trunk: ./ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/ core/sis...
Date Fri, 17 Apr 2015 15:06:07 GMT
Author: desruisseaux
Date: Fri Apr 17 15:06:06 2015
New Revision: 1674333

URL: http://svn.apache.org/r1674333
Log:
Merge from JDK6 branch the addition of Lambert Conformal projection.

Added:
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractLambert.java
      - copied unchanged from r1674331, sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractLambert.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal1SP.java
      - copied unchanged from r1674331, sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal1SP.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal2SP.java
      - copied unchanged from r1674331, sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformal2SP.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalBelgium.java
      - copied unchanged from r1674331, sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalBelgium.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConformal.java
      - copied unchanged from r1674331, sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConformal.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/CoordinateOperationMethodsHTML.java
      - copied, changed from r1674331, sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/CoordinateOperationMethodsHTML.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConformalTest.java
      - copied unchanged from r1674331, sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConformalTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/HTMLGenerator.java
      - copied unchanged from r1674331, sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/HTMLGenerator.java
Modified:
    sis/trunk/   (props changed)
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractMercator.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MercatorSpherical.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MillerCylindrical.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/DeprecatedCode.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/DeprecatedName.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/formulas.html
    sis/trunk/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AllProvidersTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MapProjectionTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/GeneralMatrixTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix3Test.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/EquirectangularTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NoOp.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ParameterizedTransformTestMock.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
    sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS 84.xml
    sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/CartesianCS.xml
    sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml
    sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Clarke 1880.xml
    sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Greenwich.xml
    sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Mean Sea Level.xml
    sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Paris.xml
    sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/WGS 84.xml
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Deprecable.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java

Propchange: sis/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Apr 17 15:06:06 2015
@@ -1,4 +1,4 @@
 /sis/branches/Android:1430670-1480699
-/sis/branches/JDK6:1394364-1672283
-/sis/branches/JDK7:1394913-1672280
-/sis/branches/JDK8:1584960-1672278
+/sis/branches/JDK6:1394364-1674331
+/sis/branches/JDK7:1394913-1674327
+/sis/branches/JDK8:1584960-1674318

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameToIdentifier.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -18,7 +18,6 @@ package org.apache.sis.internal.metadata
 
 import java.util.Locale;
 import org.opengis.util.NameSpace;
-import org.opengis.util.ScopedName;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.Identifier;
@@ -36,9 +35,12 @@ import org.apache.sis.internal.jdk7.Obje
 /**
  * Does the unobvious mapping between {@link Identifier} properties and {@link GenericName} ones.
  *
+ * <p><b>Limitation:</b>
+ * Current version does not yet work with URN or HTTP syntax.</p>
+ *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.5
+ * @version 0.6
  * @module
  */
 public final class NameToIdentifier implements ReferenceIdentifier {
@@ -58,56 +60,49 @@ public final class NameToIdentifier impl
     }
 
     /**
-     * Infers the authority from the scope.
+     * Returns the scope of the given name if it is not global.
+     * This method is null-safe, including paranoiac checks against null scope.
      *
-     * @return The authority, or {@code null} if none.
+     * @param  name The name from which to get the scope, or {@code null}.
+     * @return The scope of the given name, or {@code null} if the given name was null or has a global scope.
      */
-    @Override
-    public Citation getAuthority() {
-        final NameSpace scope = name.scope();
-        if (scope != null && !scope.isGlobal()) {
-            return Citations.fromName(scope.name().tip().toString());
+    private static GenericName scope(final GenericName name) {
+        if (name != null) {
+            final NameSpace scope = name.scope();
+            if (scope != null && !scope.isGlobal()) {
+                return scope.name();
+            }
         }
         return null;
     }
 
     /**
-     * Returns the code space of the given name, or its authority if there is no code space.
+     * Infers the authority from the scope if any, or from the code space otherwise.
      *
-     * @param  name The name from which to get the code space or authority, or {@code null}.
-     * @param  locale The locale, or {@code null} for a call to {@code name.toString()}.
-     * @return The code space or authority, or {@code null} if none.
+     * @return The authority, or {@code null} if none.
      */
-    public static String getCodespaceOrAuthority(final GenericName name, final Locale locale) {
-        String codespace = getCodeSpace(name, locale);
-        if (codespace == null) {
-            final NameSpace scope = name.scope();
-            if (scope != null && !scope.isGlobal()) {
-                codespace = toString(scope.name().tip(), locale);
+    @Override
+    public Citation getAuthority() {
+        GenericName scope = scope(name);
+        if (scope == null) {
+            scope = scope(name.tip());
+            if (scope == null) {
+                return null;
             }
         }
-        return codespace;
+        return Citations.fromName(scope.head().toString());
     }
 
     /**
-     * Takes everything except the tip as the code space.
+     * Takes the element before the tip as the code space.
      *
      * @param  name The name from which to get the code space, or {@code null}.
      * @param  locale The locale, or {@code null} for a call to {@code name.toString()}.
      * @return The code space, or {@code null} if none.
      */
     public static String getCodeSpace(final GenericName name, final Locale locale) {
-        if (name != null) {
-            if (name instanceof ScopedName) {
-                return toString(((ScopedName) name).path(), locale);
-            }
-            if (name.depth() == 2) {
-                // May happen on GenericName implementation that do not implement the ScopedName interface.
-                // The most importance case is org.apache.sis.referencing.NamedIdentifier.
-                return toString(name.head(), locale);
-            }
-        }
-        return null;
+        final GenericName scope = scope(name.tip());
+        return (scope != null) ? toString(scope.tip(), locale) : null;
     }
 
     /**
@@ -179,9 +174,9 @@ public final class NameToIdentifier impl
      * Such null values should never happen since the properties used here are mandatory, but we try to make this class
      * robust to broken implementations.
      *
-     * @param  name   The name from which to get the localized string.
+     * @param  name   The name from which to get the localized string, or {@code null}.
      * @param  locale The locale, or {@code null} for a call to {@code name.toString()}.
-     * @return The localized string representation.
+     * @return The localized string representation, or {@code null} if the given name was null.
      */
     public static String toString(final GenericName name, final Locale locale) {
         if (name != null) {

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -25,7 +25,6 @@ import org.opengis.metadata.citation.Cit
 import org.opengis.parameter.ParameterValue;
 import org.opengis.referencing.ReferenceIdentifier;
 import org.opengis.util.InternationalString;
-import org.apache.sis.util.Deprecable;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.metadata.iso.citation.Citations;
@@ -39,7 +38,6 @@ import org.apache.sis.io.wkt.ElementKind
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.util.CharSequences.trimWhitespaces;
 import static org.apache.sis.util.collection.Containers.property;
-import static org.opengis.referencing.IdentifiedObject.REMARKS_KEY;
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
@@ -129,7 +127,7 @@ import org.apache.sis.internal.jdk7.Obje
  * @see DefaultIdentifier
  */
 @XmlRootElement(name = "RS_Identifier")
-public class ImmutableIdentifier extends FormattableObject implements ReferenceIdentifier, Deprecable, Serializable {
+public class ImmutableIdentifier extends FormattableObject implements ReferenceIdentifier, Serializable {
     /**
      * For cross-version compatibility.
      */
@@ -185,13 +183,6 @@ public class ImmutableIdentifier extends
     private final InternationalString description;
 
     /**
-     * Comments on or information about this identifier, or {@code null} if none.
-     *
-     * @see #getRemarks()
-     */
-    private final InternationalString remarks;
-
-    /**
      * Empty constructor for JAXB.
      */
     private ImmutableIdentifier() {
@@ -200,13 +191,11 @@ public class ImmutableIdentifier extends
         authority   = null;
         version     = null;
         description = null;
-        remarks     = null;
     }
 
     /**
-     * Creates a new identifier from the specified one. This is a copy constructor
-     * which will get the code, codespace, authority, version and (if available)
-     * the remarks from the given identifier.
+     * Creates a new identifier from the specified one. This is a copy constructor which
+     * get the code, codespace, authority and version from the given identifier.
      *
      * @param identifier The identifier to copy.
      */
@@ -221,11 +210,6 @@ public class ImmutableIdentifier extends
         } else {
             description = null;
         }
-        if (identifier instanceof Deprecable) {
-            remarks = ((Deprecable) identifier).getRemarks();
-        } else {
-            remarks = null;
-        }
         validate(null);
     }
 
@@ -248,7 +232,7 @@ public class ImmutableIdentifier extends
 
     /**
      * Creates a new identifier from the specified code and authority,
-     * with an optional version number and remarks.
+     * with an optional version number and description.
      *
      * @param authority
      *          Organization or party responsible for definition and maintenance of the code
@@ -262,18 +246,17 @@ public class ImmutableIdentifier extends
      * @param version
      *          The version of the associated code space or code as specified by the code authority,
      *          or {@code null} if none.
-     * @param remarks
-     *          Comments on or information about this identifier, or {@code null} if none.
+     * @param description
+     *          Natural language description of the meaning of the code value, or {@code null} if none.
      */
     public ImmutableIdentifier(final Citation authority, final String codeSpace,
-            final String code, final String version, final InternationalString remarks)
+            final String code, final String version, final InternationalString description)
     {
         this.code        = code;
         this.codeSpace   = codeSpace;
         this.authority   = authority;
         this.version     = version;
-        this.description = null;
-        this.remarks     = remarks;
+        this.description = description;
         validate(null);
     }
 
@@ -316,11 +299,6 @@ public class ImmutableIdentifier extends
      *     <td>{@link #getDescription()}</td>
      *   </tr>
      *   <tr>
-     *     <td>{@value org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td>
-     *     <td>{@link String} or {@link InternationalString}</td>
-     *     <td>{@link #getRemarks()}</td>
-     *   </tr>
-     *   <tr>
      *     <td>{@value org.apache.sis.referencing.AbstractIdentifiedObject#LOCALE_KEY}</td>
      *     <td>{@link Locale}</td>
      *     <td>(none)</td>
@@ -328,10 +306,10 @@ public class ImmutableIdentifier extends
      * </table>
      *
      * <div class="section">Localization</div>
-     * {@code "remarks"} is a localizable attributes which may have a language and country
-     * code suffix. For example the {@code "remarks_fr"} property stands for remarks in
-     * {@linkplain Locale#FRENCH French} and the {@code "remarks_fr_CA"} property stands
-     * for remarks in {@linkplain Locale#CANADA_FRENCH French Canadian}.
+     * {@code "description"} is a localizable attributes which may have a language and country
+     * code suffix. For example the {@code "description_fr"} property stands for description in
+     * {@linkplain Locale#FRENCH French} and the {@code "description_fr_CA"} property stands
+     * for description in {@linkplain Locale#CANADA_FRENCH French Canadian}.
      *
      * <p>The {@code "locale"} property applies only to exception messages, if any.
      * After successful construction, {@code ImmutableIdentifier} instances do not keep the locale
@@ -345,7 +323,6 @@ public class ImmutableIdentifier extends
         code        = trimWhitespaces(  property (properties, CODE_KEY,    String.class));
         version     = trimWhitespaces(  property (properties, VERSION_KEY, String.class));
         description = Types.toInternationalString(properties, DESCRIPTION_KEY);
-        remarks     = Types.toInternationalString(properties, REMARKS_KEY);
         /*
          * Map String authority to one of the pre-defined constants (typically EPSG or OGC).
          */
@@ -365,7 +342,7 @@ public class ImmutableIdentifier extends
          */
         value = properties.get(CODESPACE_KEY);
         if (value == null && !properties.containsKey(CODESPACE_KEY)) {
-            codeSpace = org.apache.sis.internal.util.Citations.getUnicodeIdentifier(authority);
+            codeSpace = org.apache.sis.internal.util.Citations.getCodeSpace(authority);
         } else if (value instanceof String) {
             codeSpace = trimWhitespaces((String) value);
         } else {
@@ -499,10 +476,13 @@ public class ImmutableIdentifier extends
      * <div class="note"><b>Example:</b> "superseded by code XYZ".</div>
      *
      * @return Optional comments about this identifier, or {@code null} if none.
+     *
+     * @deprecated Replaced by {@link #getDescription()} for non-deprecated identifiers, or by
+     *             {@link org.apache.sis.util.Deprecable#getRemarks()} for identifiers that may be deprecated.
      */
-    @Override
+    @Deprecated
     public InternationalString getRemarks() {
-        return remarks;
+        return description;
     }
 
     /**
@@ -514,8 +494,11 @@ public class ImmutableIdentifier extends
      * @see org.apache.sis.referencing.AbstractIdentifiedObject#isDeprecated()
      *
      * @return {@code true} if this code is deprecated.
+     *
+     * @deprecated Moved to {@link org.apache.sis.util.Deprecable#isDeprecated()} if this
+     *             {@code ImmutableIdentifier} instance implements {@code Deprecable}.
      */
-    @Override
+    @Deprecated
     public boolean isDeprecated() {
         return false;
     }
@@ -548,11 +531,11 @@ public class ImmutableIdentifier extends
         }
         if (object != null && object.getClass() == getClass()) {
             final ImmutableIdentifier that = (ImmutableIdentifier) object;
-            return Objects.equals(code,      that.code)      &&
-                   Objects.equals(codeSpace, that.codeSpace) &&
-                   Objects.equals(authority, that.authority) &&
-                   Objects.equals(version,   that.version)   &&
-                   Objects.equals(remarks,   that.remarks);
+            return Objects.equals(code,        that.code)      &&
+                   Objects.equals(codeSpace,   that.codeSpace) &&
+                   Objects.equals(authority,   that.authority) &&
+                   Objects.equals(version,     that.version)   &&
+                   Objects.equals(description, that.description);
         }
         return false;
     }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -76,7 +76,7 @@ public final class Citations extends Sta
      *             because of this name change and for avoiding confusion with {@link #EPSG} citation.
      */
     @Deprecated
-    public static final Citation OGP = new SimpleCitation("OGP");
+    public static final Citation OGP = new SimpleCitation("OGP"); // TODO: after removal, forName("OGP") should map to EPSG.
 
     /**
      * The <a href="http://www.epsg.org">EPSG</a> dataset. This citation is used as an authority for
@@ -92,6 +92,8 @@ public final class Citations extends Sta
      *
      * The citation {@linkplain DefaultCitation#getTitle() title} and contact information reference
      * the IOGP organization, but the {@link IdentifierSpace#getName() namespace} is {@code "EPSG"}.
+     * Note that both the new "IOGP" and the legacy "OGP" abbreviations may be used as a code space
+     * in GML files.
      *
      * @see #AUTO
      * @see #AUTO2

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -24,6 +24,7 @@ import org.apache.sis.metadata.iso.citat
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.metadata.iso.citation.HardCodedCitations;
 import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.internal.util.Constants;
 import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
@@ -40,7 +41,7 @@ import static org.opengis.referencing.Re
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.6
  * @module
  */
 @DependsOn({
@@ -53,18 +54,18 @@ public final strictfp class ImmutableIde
      */
     private static Map<String,Object> properties() {
         final Map<String,Object> properties = new HashMap<String,Object>();
-        assertNull(properties.put(CODE_KEY,        "This is a code"));
-        assertNull(properties.put(AUTHORITY_KEY,   "This is an authority"));
-        assertNull(properties.put(VERSION_KEY,     "This is a version"));
-        assertNull(properties.put("dummy",         "Doesn't matter"));
-        assertNull(properties.put("remarks",       "There is remarks"));
-        assertNull(properties.put("remarks_fr",    "Voici des remarques"));
-        assertNull(properties.put("remarks_fr_CA", "Pareil"));
+        assertNull(properties.put(CODE_KEY,            "This is a code"));
+        assertNull(properties.put(AUTHORITY_KEY,       "This is an authority"));
+        assertNull(properties.put(VERSION_KEY,         "This is a version"));
+        assertNull(properties.put("dummy",             "Doesn't matter"));
+        assertNull(properties.put("description",       "There is a description"));
+        assertNull(properties.put("description_fr",    "Voici une description"));
+        assertNull(properties.put("description_fr_CA", "Pareil"));
         return properties;
     }
 
     /**
-     * Tests the constructor with only {@link String} values, including localized remarks.
+     * Tests the constructor with only {@link String} values, including a localized description.
      */
     @Test
     public void testConstructorWithStringValues() {
@@ -72,34 +73,34 @@ public final strictfp class ImmutableIde
         final ImmutableIdentifier identifier = new ImmutableIdentifier(properties);
         Validators.validate(identifier);
 
-        assertEquals(CODE_KEY,        "This is a code",       identifier.getCode());
-        assertNull  (CODESPACE_KEY,                           identifier.getCodeSpace());
-        assertEquals(AUTHORITY_KEY,   "This is an authority", identifier.getAuthority().getTitle().toString());
-        assertEquals(VERSION_KEY,     "This is a version",    identifier.getVersion());
-        assertEquals("remarks",       "There is remarks",     identifier.getRemarks().toString(Locale.ENGLISH));
-        assertEquals("remarks_fr",    "Voici des remarques",  identifier.getRemarks().toString(Locale.FRENCH));
-        assertEquals("remarks_fr_CA", "Pareil",               identifier.getRemarks().toString(Locale.CANADA_FRENCH));
-        assertEquals("remarks_fr_BE", "Voici des remarques",  identifier.getRemarks().toString(new Locale("fr", "BE")));
+        assertEquals(CODE_KEY,            "This is a code",         identifier.getCode());
+        assertNull  (CODESPACE_KEY,                                 identifier.getCodeSpace());
+        assertEquals(AUTHORITY_KEY,       "This is an authority",   identifier.getAuthority().getTitle().toString());
+        assertEquals(VERSION_KEY,         "This is a version",      identifier.getVersion());
+        assertEquals("description",       "There is a description", identifier.getDescription().toString(Locale.ENGLISH));
+        assertEquals("description_fr",    "Voici une description",  identifier.getDescription().toString(Locale.FRENCH));
+        assertEquals("description_fr_CA", "Pareil",                 identifier.getDescription().toString(Locale.CANADA_FRENCH));
+        assertEquals("description_fr_BE", "Voici une description",  identifier.getDescription().toString(new Locale("fr", "BE")));
     }
 
     /**
-     * Tests the constructor with the {@code "remarks"} attribute as a {@link SimpleInternationalString}.
+     * Tests the constructor with the {@code "description"} attribute as a {@link SimpleInternationalString}.
      */
     @Test
     @DependsOnMethod("testConstructorWithStringValues")
     public void testConstructorWithInternationalString() {
         final Map<String,Object> properties = properties();
-        assertNotNull(properties.put("remarks", new SimpleInternationalString("Overwritten remarks")));
+        assertNotNull(properties.put("description", new SimpleInternationalString("Overwritten description")));
         final ImmutableIdentifier identifier = new ImmutableIdentifier(properties);
         Validators.validate(identifier);
 
-        assertEquals(CODE_KEY,        "This is a code",       identifier.getCode());
-        assertNull  (CODESPACE_KEY,                           identifier.getCodeSpace());
-        assertEquals(AUTHORITY_KEY,   "This is an authority", identifier.getAuthority().getTitle().toString());
-        assertEquals(VERSION_KEY,     "This is a version",    identifier.getVersion());
-        assertEquals("remarks",       "Overwritten remarks",  identifier.getRemarks().toString(Locale.ENGLISH));
-        assertEquals("remarks_fr",    "Voici des remarques",  identifier.getRemarks().toString(Locale.FRENCH));
-        assertEquals("remarks_fr_CA", "Pareil",               identifier.getRemarks().toString(Locale.CANADA_FRENCH));
+        assertEquals(CODE_KEY,            "This is a code",          identifier.getCode());
+        assertNull  (CODESPACE_KEY,                                  identifier.getCodeSpace());
+        assertEquals(AUTHORITY_KEY,       "This is an authority",    identifier.getAuthority().getTitle().toString());
+        assertEquals(VERSION_KEY,         "This is a version",       identifier.getVersion());
+        assertEquals("description",       "Overwritten description", identifier.getDescription().toString(Locale.ENGLISH));
+        assertEquals("description_fr",    "Voici une description",   identifier.getDescription().toString(Locale.FRENCH));
+        assertEquals("description_fr_CA", "Pareil",                  identifier.getDescription().toString(Locale.CANADA_FRENCH));
     }
 
     /**
@@ -113,13 +114,13 @@ public final strictfp class ImmutableIde
         final ImmutableIdentifier identifier = new ImmutableIdentifier(properties);
         Validators.validate(identifier);
 
-        assertEquals(CODE_KEY,        "This is a code",       identifier.getCode());
-        assertNull  (CODESPACE_KEY,                           identifier.getCodeSpace());
-        assertEquals(AUTHORITY_KEY,   "An other authority",   identifier.getAuthority().getTitle().toString());
-        assertEquals(VERSION_KEY,     "This is a version",    identifier.getVersion());
-        assertEquals("remarks",       "There is remarks",     identifier.getRemarks().toString(Locale.ENGLISH));
-        assertEquals("remarks_fr",    "Voici des remarques",  identifier.getRemarks().toString(Locale.FRENCH));
-        assertEquals("remarks_fr_CA", "Pareil",               identifier.getRemarks().toString(Locale.CANADA_FRENCH));
+        assertEquals(CODE_KEY,            "This is a code",         identifier.getCode());
+        assertNull  (CODESPACE_KEY,                                 identifier.getCodeSpace());
+        assertEquals(AUTHORITY_KEY,       "An other authority",     identifier.getAuthority().getTitle().toString());
+        assertEquals(VERSION_KEY,         "This is a version",      identifier.getVersion());
+        assertEquals("description",       "There is a description", identifier.getDescription().toString(Locale.ENGLISH));
+        assertEquals("description_fr",    "Voici une description",  identifier.getDescription().toString(Locale.FRENCH));
+        assertEquals("description_fr_CA", "Pareil",                 identifier.getDescription().toString(Locale.CANADA_FRENCH));
     }
 
     /**
@@ -131,17 +132,17 @@ public final strictfp class ImmutableIde
     @DependsOnMethod("testConstructorWithStringValues")
     public void testPredefinedCitation() {
         final Map<String,Object> properties = properties();
-        assertNotNull(properties.put(AUTHORITY_KEY, "EPSG"));
+        assertNotNull(properties.put(AUTHORITY_KEY, Constants.EPSG));
         final ImmutableIdentifier identifier = new ImmutableIdentifier(properties);
         Validators.validate(identifier);
 
-        assertEquals(CODE_KEY,        "This is a code",       identifier.getCode());
-        assertSame  (AUTHORITY_KEY,   Citations.EPSG,         identifier.getAuthority());
-        assertEquals(CODESPACE_KEY,   "EPSG",                 identifier.getCodeSpace()); // Inferred from authority.
-        assertEquals(VERSION_KEY,     "This is a version",    identifier.getVersion());
-        assertEquals("remarks",       "There is remarks",     identifier.getRemarks().toString(Locale.ENGLISH));
-        assertEquals("remarks_fr",    "Voici des remarques",  identifier.getRemarks().toString(Locale.FRENCH));
-        assertEquals("remarks_fr_CA", "Pareil",               identifier.getRemarks().toString(Locale.CANADA_FRENCH));
+        assertEquals(CODE_KEY,            "This is a code",         identifier.getCode());
+        assertSame  (AUTHORITY_KEY,       Citations.EPSG,           identifier.getAuthority());
+        assertEquals(CODESPACE_KEY,       Constants.EPSG,           identifier.getCodeSpace()); // Inferred from authority.
+        assertEquals(VERSION_KEY,         "This is a version",      identifier.getVersion());
+        assertEquals("description",       "There is a description", identifier.getDescription().toString(Locale.ENGLISH));
+        assertEquals("description_fr",    "Voici une description",  identifier.getDescription().toString(Locale.FRENCH));
+        assertEquals("description_fr_CA", "Pareil",                 identifier.getDescription().toString(Locale.CANADA_FRENCH));
     }
 
     /**

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -158,6 +158,15 @@ public final class Code {
                     final String urn = DefinitionURI.format(NameMeaning.toObjectType(type), fallback);
                     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".
+                         *
+                         * See https://issues.apache.org/jira/browse/SIS-196
+                         */
                         code.codeSpace = getUnicodeIdentifier(fallback.getAuthority());
                         code.code = urn;
                         return code;

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractMercator.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractMercator.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractMercator.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractMercator.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -34,7 +34,7 @@ import org.apache.sis.referencing.operat
  * @version 0.6
  * @module
  */
-public class AbstractMercator extends MapProjection {
+class AbstractMercator extends MapProjection {
     /**
      * For cross-version compatibility.
      */

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -121,6 +121,18 @@ abstract class AbstractProvider extends
     }
 
     /**
+     * Creates a descriptor for a latitude parameter in degrees without default value.
+     * This method is used for latitude of origin that can not be zero, of for standard parallels
+     * where the default value should be the value of another parameter instead than 0°.
+     */
+    static ParameterDescriptor<Double> createMandatoryLatitude(final ParameterBuilder builder) {
+        return builder.createBounded(MeasurementRange.create(
+                Latitude.MIN_VALUE, true,
+                Latitude.MAX_VALUE, true,
+                NonSI.DEGREE_ANGLE), null);
+    }
+
+    /**
      * Creates a descriptor for a latitude parameter in degrees with a default value of 0°.
      */
     static ParameterDescriptor<Double> createLatitude(final ParameterBuilder builder, final boolean includePoles) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -27,9 +27,11 @@ import org.opengis.referencing.operation
 import org.apache.sis.parameter.Parameters;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 import org.apache.sis.referencing.operation.transform.ContextualParameters;
 import org.apache.sis.referencing.operation.transform.MathTransforms;
 import org.apache.sis.internal.referencing.j2d.ParameterizedAffine;
+import org.apache.sis.internal.util.DoubleDouble;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.util.resources.Messages;
 
@@ -37,12 +39,18 @@ import static java.lang.Math.*;
 
 
 /**
- * The provider for "<cite>Equidistant Cylindrical (Spherical)</cite>" projection
+ * The provider for <cite>"Equidistant Cylindrical (Spherical)"</cite> projection
  * (EPSG:1029, <span class="deprecated">EPSG:9823</span>).
+ * In the particular case where the longitude of origin and the standard parallel are 0°,
+ * this projection is also known as <cite>"Plate Carrée"</cite>.
  *
- * At the difference of most other map projection providers, this class does not extend {@link MapProjection}
+ * <p>At the difference of most other map projection providers, this class does not extend {@link MapProjection}
  * because it does not create non-liner kernel. Instead, the projection created by this class is implemented
- * by an affine transform.
+ * by an affine transform.</p>
+ *
+ * <p>We do not provide <cite>"Pseudo Plate Carrée"</cite> projection (EPSG:9825) at this time because that
+ * pseudo-projection is only the identity transform. Even the semi-major and semi-minor axis lengths are set
+ * to 1.</p>
  *
  * <p>This provider is <strong>not</strong> suitable for the <cite>Equidistant Cylindrical</cite> projection
  * (EPSG:1028, <span class="deprecated">EPSG:9842</span>). EPSG defines Equidistant Cylindrical projection as
@@ -174,6 +182,7 @@ public final class Equirectangular exten
             .addName(                   "Equidistant Cylindrical (Spherical)")
             .addName(                   "Plate Carrée")  // Not formally defined by EPSG, but cited in documentation.
             .addName(Citations.OGC,     "Equirectangular")
+            .addName(Citations.ESRI,    "Plate_Carree")
             .addName(Citations.GEOTIFF, "CT_Equirectangular")
             .addName(Citations.PROJ4,   "eqc")
             .addIdentifier(Citations.GEOTIFF, "17")
@@ -203,6 +212,26 @@ public final class Equirectangular exten
     }
 
     /**
+     * Gets a parameter value identified by the given descriptor and stores it only if different than zero.
+     *
+     * @param  source     The parameters from which to read the value.
+     * @param  target     Where to store the parameter values.
+     * @param  descriptor The descriptor that specify the parameter names and desired units.
+     * @return The parameter value in the units given by the descriptor.
+     * @throws IllegalArgumentException if the given value is out of bounds.
+     */
+    private static double getAndStore(final Parameters source, final ParameterValueGroup target,
+            final ParameterDescriptor<Double> descriptor) throws IllegalArgumentException
+    {
+        final double value = source.doubleValue(descriptor);    // Apply a unit conversion if needed.
+        MapProjection.validate(descriptor, value);              // Unconditional validation for semi-axes.
+        if (value != 0) {                                       // All default values in this class are zero.
+            target.parameter(descriptor.getName().getCode()).setValue(value);
+        }
+        return value;
+    }
+
+    /**
      * Creates an Equirectangular projection from the specified group of parameter values. This method is an
      * adaptation of {@link org.apache.sis.referencing.operation.projection.NormalizedProjection} constructor,
      * reproduced in this method because we will create an affine transform instead than the usual projection
@@ -219,13 +248,13 @@ public final class Equirectangular exten
     {
         final Parameters p = Parameters.castOrWrap(parameters);
         final ContextualParameters context = new ContextualParameters(this);
-        double a  = MapProjection.getAndStore(p, context, MapProjection.SEMI_MAJOR);
-        double b  = MapProjection.getAndStore(p, context, MapProjection.SEMI_MINOR);
-        double λ0 = MapProjection.getAndStore(p, context, CENTRAL_MERIDIAN);
-        double φ0 = MapProjection.getAndStore(p, context, LATITUDE_OF_ORIGIN);
-        double φ1 = MapProjection.getAndStore(p, context, STANDARD_PARALLEL);
-        double fe = MapProjection.getAndStore(p, context, FALSE_EASTING);
-        double fn = MapProjection.getAndStore(p, context, FALSE_NORTHING);
+        double a  = getAndStore(p, context, MapProjection.SEMI_MAJOR);
+        double b  = getAndStore(p, context, MapProjection.SEMI_MINOR);
+        double λ0 = getAndStore(p, context, CENTRAL_MERIDIAN);
+        double φ0 = getAndStore(p, context, LATITUDE_OF_ORIGIN);
+        double φ1 = getAndStore(p, context, STANDARD_PARALLEL);
+        double fe = getAndStore(p, context, FALSE_EASTING);
+        double fn = getAndStore(p, context, FALSE_NORTHING);
         /*
          * Perform following transformation, in that order. Note that following
          * AffineTransform convention, the Java code appears in reverse order:
@@ -236,21 +265,24 @@ public final class Equirectangular exten
          *   4) Scale longitude by cos(φ1).
          */
         φ1 = toRadians(φ1);
-        context.getMatrix(true).concatenate(0, cos(φ1), null);
+        context.getMatrix(true).convertBefore(0, cos(φ1), null);
         context.normalizeGeographicInputs(λ0)
-               .concatenate(1, null, -φ0);
+               .convertBefore(1, null, -φ0);
         /*
-         * At this point, we usually invoke scaleAndTranslate2D(false, a, fe, fn) where 'a' (the semi-major
-         * axis length) is taken as the Earth radius (R). However quoting EPSG: "If the figure of the earth
-         * used is an ellipsoid rather than a sphere then R should be calculated as the radius of the conformal
-         * sphere at the projection origin at latitude φ1 using the formula for RC given in section 1.2, table 3".
+         * At this point, we usually invoke 'denormalize.convertAfter(…, a, …)' where 'a' (the semi-major axis length)
+         * is taken as the Earth radius (R). However quoting EPSG: "If the figure of the earth used is an ellipsoid
+         * rather than a sphere then R should be calculated as the radius of the conformal sphere at the projection
+         * origin at latitude φ1 using the formula for RC given in section 1.2, table 3".
          */
         if (a != b) {
             final double rs = b / a;
             final double sinφ1 = sin(φ1);
             a = b / (1 - (1 - rs*rs) * (sinφ1*sinφ1));
         }
-        context.scaleAndTranslate2D(false, a, fe, fn);
+        final DoubleDouble k = new DoubleDouble(a);
+        final MatrixSIS denormalize = context.getMatrix(false);
+        denormalize.convertAfter(0, k, new DoubleDouble(fe));
+        denormalize.convertAfter(1, k, new DoubleDouble(fn));
         /*
          * Creates the ConcatenatedTransform, letting the factory returns the cached instance
          * if the caller already invoked this method previously (which usually do not happen).

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -128,28 +128,15 @@ public abstract class MapProjection exte
     }
 
     /**
-     * Gets a parameter value identified by the given descriptor and stores it in the {@code context}.
-     * This method performs the following actions:
+     * Validates the given parameter value.
      *
-     * <ul>
-     *   <li>Convert the value to the units specified by the descriptor.</li>
-     *   <li>Ensure that the value is contained in the range specified by the descriptor.</li>
-     *   <li>Store the value only if different than the default value.</li>
-     * </ul>
-     *
-     * This method should be invoked at {@link #createMathTransform(MathTransformFactory, ParameterValueGroup)}
-     * execution time only.
-     *
-     * @param  source     The parameters from which to read the value.
-     * @param  target     Where to store the parameter values.
-     * @param  descriptor The descriptor that specify the parameter names and desired units.
-     * @return The parameter value in the units given by the descriptor.
+     * @param  descriptor The descriptor that specify the parameter to validate.
+     * @param  value The parameter value in the units given by the descriptor.
      * @throws IllegalArgumentException if the given value is out of bounds.
      */
-    public static double getAndStore(final Parameters source, final ParameterValueGroup target,
-            final ParameterDescriptor<Double> descriptor) throws IllegalArgumentException
+    public static void validate(final ParameterDescriptor<Double> descriptor, final double value)
+            throws IllegalArgumentException
     {
-        final double value = source.doubleValue(descriptor);    // Apply a unit conversion if needed.
         if (Double.isNaN(value) || Double.isInfinite(value)) {
             throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalParameterValue_2,
                     descriptor.getName(), value));
@@ -171,11 +158,6 @@ public abstract class MapProjection exte
                         descriptor.getName(), min, max, value));
             }
         }
-        final Double defaultValue = descriptor.getDefaultValue();
-        if (defaultValue == null || !defaultValue.equals(value)) {
-            target.parameter(descriptor.getName().getCode()).setValue(value);
-        }
-        return value;
     }
 
     /**

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -41,11 +41,6 @@ public final class Mercator1SP extends A
      */
     private static final long serialVersionUID = -5886510621481710072L;
 
-    /*
-     * ACCESS POLICY: Only formal EPSG parameters shall be public.
-     * Parameters that we add ourselves should be package-privated.
-     */
-
     /**
      * The operation parameter descriptor for the <cite>Latitude of natural origin</cite> (φ₀) parameter value.
      * In theory, this parameter should not be used and its value should be 0 in all cases.

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -18,6 +18,7 @@ package org.apache.sis.internal.referenc
 
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
+import org.opengis.util.InternationalString;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.metadata.iso.citation.Citations;
 
@@ -53,23 +54,6 @@ public final class Mercator2SP extends A
     public static final ParameterDescriptor<Double> STANDARD_PARALLEL = Equirectangular.STANDARD_PARALLEL;
 
     /**
-     * The operation parameter descriptor for the <cite>Latitude of natural origin</cite> (φ₀) parameter value.
-     * In theory, this parameter should not be used and its value should be 0 in all cases.
-     * This parameter is included in the EPSG dataset for completeness in CRS labelling only.
-     *
-     * <p>This parameter is used by {@link Mercator1SP} and is not formally a parameter of {@link Mercator2SP}
-     * projections. Nevertheless we declare it is as an optional parameter because it is sometime used in Well
-     * Known Text (WKT).</p>
-     */
-    static final ParameterDescriptor<Double> LATITUDE_OF_ORIGIN;
-
-    /**
-     * The operation parameter descriptor for the <cite>Longitude of natural origin</cite> (λ₀) parameter value.
-     * Valid values range is [-180 … 180]° and default value is 0°.
-     */
-    public static final ParameterDescriptor<Double> CENTRAL_MERIDIAN = Mercator1SP.CENTRAL_MERIDIAN;
-
-    /**
      * The operation parameter descriptor for the <cite>Scale factor</cite> (not necessarily at natural origin)
      * parameter value. Valid values range is (0 … ∞) and default value is 1.
      *
@@ -88,19 +72,26 @@ public final class Mercator2SP extends A
         final ParameterBuilder builder = builder();
         /*
          * "Latitude of natural origin" and "Scale factor" are not formally parameters of the "Mercator (variant B)"
-         * projection according EPSG. But we declare them as optional parameters because they are sometime used.
-         * However we remove the EPSG name and identifier at least for the scale factor, because its meaning does
-         * not fit well in this context. The EPSG name is "Scale factor at natural origin" while actually the scale
-         * factor applied here would rather at the standard parallel.
+         * projection according EPSG. But we declare them as optional parameters because they are sometime used in
+         * Well Known Text (WKT).
          */
         builder.setRequired(false); // Will apply to all remaining parameters.
-        LATITUDE_OF_ORIGIN = createConstant(exceptEPSG(Mercator1SP.LATITUDE_OF_ORIGIN, builder)
-                .setRemarks(Mercator1SP.LATITUDE_OF_ORIGIN.getRemarks()), 0.0);
-
+        final InternationalString remarks = notFormalParameter("Mercator (variant A)");
+        final ParameterDescriptor<Double> latitudeOfOrigin = createConstant(builder
+                .addNamesAndIdentifiers(Mercator1SP.LATITUDE_OF_ORIGIN)
+                .setRemarks(remarks), 0.0);
+        /*
+         * Remove the EPSG name and identifier at least for the scale factor, because its meaning does not fit well
+         * in this context. The EPSG name is "Scale factor at natural origin" while actually the scale factor applied
+         * here would rather be at the standard parallel. We keep the OGC, ESRI and Proj.4 names because they are just
+         * "scale_factor" or "k", which is vague enough for the purpose of this non-standard parameter.
+         */
         SCALE_FACTOR = createScale(exceptEPSG(Mercator1SP.SCALE_FACTOR, builder)
-                .setRemarks(notFormalParameter("Mercator (variant A)")));
+                .rename(Citations.NETCDF,  (String[]) null)  // "scale_factor_at_projection_origin" is too specific.
+                .rename(Citations.GEOTIFF, (String[]) null)  // "ScaleAtNatOrigin" is too specific.
+                .setRemarks(remarks).setDeprecated(true));
 
-        PARAMETERS = builder
+        PARAMETERS = builder.setDeprecated(false)
             .addIdentifier(             "9805")
             .addName(                   "Mercator (variant B)")     // Starting from EPSG version 7.6
             .addName(                   "Mercator (2SP)")           // Prior to EPSG version 7.6
@@ -112,8 +103,8 @@ public final class Mercator2SP extends A
             .addIdentifier(Citations.S57,       "8")
             .createGroupForMapProjection(
                     STANDARD_PARALLEL,
-                    LATITUDE_OF_ORIGIN,     // Not formally a Mercator2SP parameter.
-                    CENTRAL_MERIDIAN,
+                    latitudeOfOrigin,       // Not formally a Mercator2SP parameter.
+                    Mercator1SP.CENTRAL_MERIDIAN,
                     SCALE_FACTOR,           // Not formally a Mercator2SP parameter.
                     FALSE_EASTING,
                     FALSE_NORTHING);

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MercatorSpherical.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MercatorSpherical.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MercatorSpherical.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MercatorSpherical.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -16,7 +16,6 @@
  */
 package org.apache.sis.internal.referencing.provider;
 
-import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.apache.sis.parameter.ParameterBuilder;
 
@@ -39,11 +38,6 @@ public final class MercatorSpherical ext
     private static final long serialVersionUID = 4761755206841656129L;
 
     /**
-     * The name of this projection method.
-     */
-    public static final String NAME = "Mercator (Spherical)";
-
-    /**
      * The EPSG identifier, to be preferred to the name when available.
      */
     public static final String IDENTIFIER = "1026";
@@ -54,25 +48,14 @@ public final class MercatorSpherical ext
     static final ParameterDescriptorGroup PARAMETERS;
     static {
         final ParameterBuilder builder = builder();
-        /*
-         * The "Latitude of 1st standard parallel" is not formally a parameter for this map projection.
-         * But we declare it (as an optional parameter) for compatibility with those who still use it.
-         */
-        final ParameterDescriptor<?> standardParallel = createLatitude(builder
-                .addNamesAndIdentifiers(Mercator2SP.STANDARD_PARALLEL)
-                .setRemarks(notFormalParameter("Mercator (variant B)"))
-                .setRequired(false), false);
-
         PARAMETERS = builder
             .addIdentifier(IDENTIFIER)
             .addDeprecatedIdentifier("9841", IDENTIFIER)
-            .addName(NAME)                                          // Starting from EPSG version 7.6
-            .addDeprecatedName("Mercator (1SP) (Spherical)", NAME)  // Prior to EPSG version 7.6
+            .addName("Mercator (Spherical)")                                          // Starting from EPSG version 7.6
+            .addDeprecatedName("Mercator (1SP) (Spherical)", "Mercator (Spherical)")  // Prior to EPSG version 7.6
             .createGroupForMapProjection(
-                    standardParallel,                   // Not formally a Mercator Spherical parameter.
                     Mercator1SP.LATITUDE_OF_ORIGIN,
                     Mercator1SP.CENTRAL_MERIDIAN,
-                    Mercator2SP.SCALE_FACTOR,           // Not formally a Mercator Spherical parameter.
                     FALSE_EASTING,
                     FALSE_NORTHING);
     }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MillerCylindrical.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MillerCylindrical.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MillerCylindrical.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MillerCylindrical.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -58,18 +58,13 @@ public final class MillerCylindrical ext
     private static final long serialVersionUID = -7682370461334391883L;
 
     /**
-     * The name of this operation method.
-     */
-    public static final String NAME = "Miller_Cylindrical";
-
-    /**
      * The group of all parameters expected by this coordinate operation.
      */
     private static final ParameterDescriptorGroup PARAMETERS;
     static {
         final ParameterBuilder builder = builder().setCodeSpace(Citations.OGC, Constants.OGC);
         PARAMETERS = builder
-            .addName      (NAME)
+            .addName      ("Miller_Cylindrical")
             .addName      (Citations.GEOTIFF,  "CT_MillerCylindrical")
             .addIdentifier(Citations.GEOTIFF,  "20")
             .addName      (Citations.PROJ4,    "mill")

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -37,11 +37,6 @@ public final class PseudoMercator extend
     private static final long serialVersionUID = -8126827491349984471L;
 
     /**
-     * The name of this operation method.
-     */
-    public static final String NAME = "Popular Visualisation Pseudo Mercator";
-
-    /**
      * The EPSG identifier, to be preferred to the name when available.
      */
     public static final String IDENTIFIER = "1024";
@@ -54,7 +49,7 @@ public final class PseudoMercator extend
         final ParameterBuilder builder = builder();
         PARAMETERS = builder
             .addIdentifier(IDENTIFIER)
-            .addName(NAME)
+            .addName("Popular Visualisation Pseudo Mercator")
             .createGroupForMapProjection(toArray(MercatorSpherical.PARAMETERS.descriptors()));
     }
 

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -18,6 +18,7 @@ package org.apache.sis.internal.referenc
 
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
+import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.parameter.ParameterBuilder;
 
 
@@ -42,17 +43,12 @@ public class RegionalMercator extends Ab
     private static final long serialVersionUID = 5957081563587752477L;
 
     /**
-     * The name of this projection method.
-     */
-    public static final String NAME = "Mercator (variant C)";
-
-    /**
      * The EPSG identifier, to be preferred to the name when available.
      */
     public static final String IDENTIFIER = "1044";
 
     /**
-     * The operation parameter descriptor for the <cite>Latitude of false origin</cite> parameter value.
+     * The operation parameter descriptor for the <cite>Latitude of false origin</cite> (φf) parameter value.
      * Valid values range is (-90 … 90)° and default value is 0°.
      */
     public static final ParameterDescriptor<Double> LATITUDE_OF_FALSE_ORIGIN;
@@ -76,24 +72,27 @@ public class RegionalMercator extends Ab
     static {
         final ParameterBuilder builder = builder();
 
-        LATITUDE_OF_FALSE_ORIGIN = createLatitude(builder
+        LATITUDE_OF_FALSE_ORIGIN = createLatitude(exceptEPSG(Mercator1SP.LATITUDE_OF_ORIGIN, builder
                 .addIdentifier("8821")
-                .addName("Latitude of false origin"), false);
+                .addName("Latitude of false origin"))
+                .rename(Citations.GEOTIFF, "FalseOriginLat"), false);
 
-        EASTING_AT_FALSE_ORIGIN = createShift(builder
+        EASTING_AT_FALSE_ORIGIN = createShift(exceptEPSG(FALSE_EASTING, builder
                 .addIdentifier("8826")
-                .addName("Easting at false origin"));
+                .addName("Easting at false origin"))
+                .rename(Citations.GEOTIFF, "FalseOriginEasting"));
 
-        NORTHING_AT_FALSE_ORIGIN = createShift(builder
+        NORTHING_AT_FALSE_ORIGIN = createShift(exceptEPSG(FALSE_NORTHING, builder
                 .addIdentifier("8827")
-                .addName("Northing at false origin"));
+                .addName("Northing at false origin"))
+                .rename(Citations.GEOTIFF, "FalseOriginNorthing"));
 
         PARAMETERS = builder
             .addIdentifier(IDENTIFIER)
-            .addName(NAME)
+            .addName("Mercator (variant C)")
             .createGroupForMapProjection(
                     Mercator2SP.STANDARD_PARALLEL,
-                    Mercator2SP.CENTRAL_MERIDIAN,
+                    Mercator1SP.CENTRAL_MERIDIAN,
                     LATITUDE_OF_FALSE_ORIGIN,
                     EASTING_AT_FALSE_ORIGIN,
                     NORTHING_AT_FALSE_ORIGIN);

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -813,7 +813,7 @@ public class ParameterFormat extends Tab
             if (aliases != null) { // Paranoiac check.
                 for (final GenericName alias : aliases) {
                     if (alias != null) { // Paranoiac check.
-                        final String codespace = NameToIdentifier.getCodespaceOrAuthority(alias, displayLocale);
+                        final String codespace = NameToIdentifier.getCodeSpace(alias, displayLocale);
                         if (isPreferredCodespace(codespace)) {
                             row = putIfAbsent(resources, row, columnIndices, codespace,
                                     alias.tip().toInternationalString().toString(displayLocale));

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterTableRow.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -30,7 +30,6 @@ import java.io.IOException;
 import java.text.Format;
 import java.text.FieldPosition;
 import javax.measure.unit.Unit;
-import org.opengis.util.NameSpace;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.Identifier;
@@ -151,14 +150,9 @@ final class ParameterTableRow {
             if (aliases != null) { // Paranoiac check.
                 for (GenericName alias : aliases) {
                     if (!isDeprecated(alias)) {
-                        String codespace = NameToIdentifier.getCodeSpace(alias, locale);
+                        final String codespace = NameToIdentifier.getCodeSpace(alias, locale);
                         if (codespace != null) {
                             alias = alias.tip();
-                        } else {
-                            final NameSpace scope = alias.scope();
-                            if (scope != null && !scope.isGlobal()) {
-                                codespace = NameToIdentifier.toString(scope.name().tip(), locale);
-                            }
                         }
                         if (preferredCodespaces == null || preferredCodespaces.contains(codespace)) {
                             addIdentifier(codespace, NameToIdentifier.toString(alias, locale));

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -119,7 +119,7 @@ import org.apache.sis.util.iso.DefaultNa
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.5
+ * @version 0.6
  * @module
  */
 @XmlType(name="IdentifiedObjectType", propOrder={
@@ -156,6 +156,17 @@ public class AbstractIdentifiedObject ex
     public static final String LOCALE_KEY = Errors.LOCALE_KEY;
 
     /**
+     * Optional key which can be given to the {@linkplain #AbstractIdentifiedObject(Map) constructor}
+     * for specifying the object is deprecated. If deprecated, then the replacement should be specified
+     * in the {@linkplain #getRemarks() remarks}.
+     *
+     * <div class="note"><b>Example:</b> "superseded by code XYZ".</div>
+     *
+     * @since 0.6
+     */
+    public static final String DEPRECATED_KEY = "deprecated";
+
+    /**
      * The name for this object or code. Shall never be {@code null}.
      *
      * <p><b>Consider this field as final!</b>
@@ -195,6 +206,13 @@ public class AbstractIdentifiedObject ex
     private final InternationalString remarks;
 
     /**
+     * {@code true} if this object is deprecated.
+     *
+     * @since 0.6
+     */
+    private final boolean deprecated;
+
+    /**
      * The cached hash code value, or 0 if not yet computed. This field is calculated only when
      * first needed. We do not declare it {@code volatile} because it is not a big deal if this
      * field is calculated many time, and the same value should be produced by all computations.
@@ -209,6 +227,7 @@ public class AbstractIdentifiedObject ex
      */
     AbstractIdentifiedObject() {
         remarks = null;
+        deprecated = false;
     }
 
     /**
@@ -274,6 +293,11 @@ public class AbstractIdentifiedObject ex
      *     <td>{@link #getRemarks()}</td>
      *   </tr>
      *   <tr>
+     *     <td>{@value #DEPRECATED_KEY}</td>
+     *     <td>{@link Boolean}</td>
+     *     <td>{@link #isDeprecated()}</td>
+     *   </tr>
+     *   <tr>
      *     <td>{@value #LOCALE_KEY}</td>
      *     <td>{@link Locale}</td>
      *     <td>(none)</td>
@@ -353,6 +377,18 @@ public class AbstractIdentifiedObject ex
         // "remarks": String or InternationalString
         // ----------------------------------------
         remarks = Types.toInternationalString(properties, REMARKS_KEY);
+
+        // ---------------------
+        // "deprecated": Boolean
+        // ---------------------
+        value = properties.get(DEPRECATED_KEY);
+        if (value == null) {
+            deprecated = false;
+        } else if (value instanceof Boolean) {
+            deprecated = (Boolean) value;
+        } else {
+            throw illegalPropertyType(properties, DEPRECATED_KEY, value);
+        }
     }
 
     /**
@@ -380,6 +416,7 @@ public class AbstractIdentifiedObject ex
         alias       = nonEmpty(object.getAlias()); // Favor null for empty set in case it is not Collections.EMPTY_SET
         identifiers = nonEmpty(object.getIdentifiers());
         remarks     =          object.getRemarks();
+        deprecated  = (object instanceof Deprecable) ? ((Deprecable) object).isDeprecated() : false;
     }
 
     /**
@@ -667,6 +704,8 @@ public class AbstractIdentifiedObject ex
 
     /**
      * Returns comments on or information about this object, including data source information.
+     * If this object {@linkplain #isDeprecated() is deprecated}, then the remarks should give
+     * indication about the replacement (e.g. <cite>"superceded by …"</cite>).
      *
      * @return The remarks, or {@code null} if none.
      */
@@ -677,44 +716,15 @@ public class AbstractIdentifiedObject ex
 
     /**
      * Returns {@code true} if this object is deprecated. Deprecated objects exist in some
-     * {@linkplain org.opengis.referencing.AuthorityFactory authority factories} like the
-     * EPSG database. Deprecated objects are usually obtained from a deprecated authority code.
-     * For this reason, the default implementation applies the following rules:
-     *
-     * <ul>
-     *   <li>If the {@linkplain #getName() name} is deprecated, then returns {@code true}.</li>
-     *   <li>Otherwise if <strong>all</strong> {@linkplain #getIdentifiers() identifiers}
-     *       are deprecated, ignoring the identifiers that are not instance of {@link Deprecable}
-     *       (because they can not be tested), then returns {@code true}.</li>
-     *   <li>Otherwise returns {@code false}.</li>
-     * </ul>
+     * {@linkplain org.opengis.referencing.AuthorityFactory authority factories} like the EPSG database.
+     * If this method returns {@code true}, then the {@linkplain #getRemarks() remarks} should give
+     * indication about the replacement (e.g. <cite>"superceded by …"</cite>).
      *
      * @return {@code true} if this object is deprecated.
-     *
-     * @see org.apache.sis.metadata.iso.ImmutableIdentifier#isDeprecated()
      */
     @Override
     public boolean isDeprecated() {
-        if (isDeprecated(name)) {
-            return true;
-        }
-        boolean isDeprecated = false;
-        for (final Identifier identifier : nonNull(identifiers)) {
-            if (identifier instanceof Deprecable) {
-                if (!((Deprecable) identifier).isDeprecated()) {
-                    return false;
-                }
-                isDeprecated = true;
-            }
-        }
-        return isDeprecated;
-    }
-
-    /**
-     * Returns {@code true} if the given identifier is deprecated.
-     */
-    private static boolean isDeprecated(final Identifier object) {
-        return (object instanceof Deprecable) && ((Deprecable) object).isDeprecated();
+        return deprecated;
     }
 
     /**

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -42,49 +42,40 @@ import org.apache.sis.internal.jdk8.JDK8
 
 
 /**
- * Base class of builders for various kind of {@link IdentifiedObject}. {@code Builder}s aim to make object creation
- * easier — they do not add any new functionality compared to {@link org.opengis.referencing.ObjectFactory}.
- * Builder methods like {@link #addName(CharSequence)} and {@link #addIdentifier(String)} provide convenient ways
- * to fill the {@link #properties} map, which will be given to the {@code ObjectFactory} methods when any
- * {@code createXXX(…)} method is invoked.
- *
- * <p>This base class provides methods for defining the {@link IdentifiedObject} properties shown below:</p>
+ * Base class of builders for various kind of {@link IdentifiedObject}. This class provides convenience methods
+ * for filling the {@link #properties} map to be given to an {@link org.opengis.referencing.ObjectFactory}.
+ * The main properties are:
  *
  * <ul class="verbose">
- *   <li><b>{@linkplain AbstractIdentifiedObject#getName() Name}:</b>
+ *   <li><b>{@linkplain AbstractIdentifiedObject#getName() Name}:</b><br>
  *       each {@code IdentifiedObject} shall have a name, which can be specified by a call to any of the
  *       {@link #addName(CharSequence) addName(…)} methods defined in this class.</li>
  *
- *   <li><b>{@linkplain AbstractIdentifiedObject#getAlias() Aliases}:</b>
- *       identified objects can optionally have an arbitrary amount of aliases, which are also specified
+ *   <li><b>{@linkplain AbstractIdentifiedObject#getAlias() Aliases}:</b><br>
+ *       {@code IdentifiedObject}s can optionally have an arbitrary amount of aliases, which are also specified
  *       by the {@code addName(…)} methods. Each call after the first one adds an alias.</li>
  *
- *   <li><b>{@linkplain AbstractIdentifiedObject#getIdentifiers() Identifiers}:</b>
- *       identified objects can also have an arbitrary amount of identifiers, which are specified by any
+ *   <li><b>{@linkplain AbstractIdentifiedObject#getIdentifiers() Identifiers}:</b><br>
+ *       {@code IdentifiedObject}s can also have an arbitrary amount of identifiers, which are specified by any
  *       of the {@link #addIdentifier(String) addIdentifier(…)} methods. Like names, more than one identifier
  *       can be added by invoking the method many time.</li>
  *
- *   <li><b>{@linkplain AbstractIdentifiedObject#getRemarks() Remarks}:</b>
- *       identified objects can have at most one remark, which is specified by the {@code setRemarks(…)}
- *       method.</li>
- * </ul>
- *
- * The names and identifiers cited in the above table can be built from {@link CharSequence} given to the
- * {@code addName(…)} or {@code addIdentifier(…)} methods combined with the following properties:
- *
- * <ul class="verbose">
- *   <li><b>{@linkplain ImmutableIdentifier#getCodeSpace() Code space}:</b>
- *       each {@code Identifier} name or code can be local to a code space defined by an authority.
+ *   <li><b>{@linkplain ImmutableIdentifier#getCodeSpace() Code space}:</b><br>
+ *       {@code IdentifiedObject} names and identifiers can be local to a code space defined by an authority.
  *       Both the authority and code space can be specified by the {@link #setCodeSpace(Citation, String)} method,
  *       and usually (but not necessarily) apply to all {@code Identifier} instances.</li>
  *
- *   <li><b>{@linkplain ImmutableIdentifier#getVersion() Version}:</b>
- *       identifiers can optionally have a version specified by the {@link #setVersion(String)} method.
+ *   <li><b>{@linkplain ImmutableIdentifier#getVersion() Version}:</b><br>
+ *       {@code Identifier}s can optionally have a version specified by the {@link #setVersion(String)} method.
  *       The version usually (but not necessarily) applies to all {@code Identifier} instances.</li>
  *
- *   <li><b>{@linkplain ImmutableIdentifier#getDescription() Description}:</b>
- *       identifiers can optionally have a description specified by the {@link #setDescription(CharSequence)} method.
+ *   <li><b>{@linkplain ImmutableIdentifier#getDescription() Description}:</b><br>
+ *       {@code Identifier}s can optionally have a description specified by the {@link #setDescription(CharSequence)} method.
  *       The description applies only to the next identifier to create.</li>
+ *
+ *   <li><b>{@linkplain AbstractIdentifiedObject#getRemarks() Remarks}:</b><br>
+ *       {@code IdentifiedObject}s can have at most one remark, which is specified by the
+ *       {@link #setRemarks(CharSequence) code setRemarks(…)} method.</li>
  * </ul>
  *
  * <div class="section">Namespaces and scopes</div>
@@ -311,7 +302,7 @@ public abstract class Builder<B extends
             return new ImmutableIdentifier(authority, getCodeSpace(), identifier, getVersion(), null);
         } else {
             // Do not use the version information since it applies to the default authority rather than the given one.
-            return new ImmutableIdentifier(authority, Citations.getUnicodeIdentifier(authority), identifier);
+            return new ImmutableIdentifier(authority, Citations.getCodeSpace(authority), identifier);
         }
     }
 
@@ -442,6 +433,31 @@ public abstract class Builder<B extends
     }
 
     /**
+     * Sets whether the next {@code IdentifiedObject}s to create shall be considered deprecated. Deprecated objects
+     * exist in some {@linkplain org.opengis.referencing.AuthorityFactory authority factories} like the EPSG database.
+     *
+     * <p>Note that this method does not apply to name and identifiers, which have their own
+     * {@code addDeprecatedFoo(…)} methods.</p>
+     *
+     * <p><b>Lifetime:</b>
+     * this property is kept unchanged until this {@code setDeprecated(…)} method is invoked again.</p>
+     *
+     * @param  deprecated {@code true} if the next names, identifiers and identified objects should be
+     *         considered deprecated, or {@code false} otherwise.
+     * @return {@code this}, for method call chaining.
+     *
+     * @see #addDeprecatedName(CharSequence, CharSequence)
+     * @see #addDeprecatedIdentifier(String, String)
+     * @see AbstractIdentifiedObject#isDeprecated()
+     *
+     * @since 0.6
+     */
+    public B setDeprecated(final boolean deprecated) {
+        properties.put(AbstractIdentifiedObject.DEPRECATED_KEY, deprecated);
+        return self();
+    }
+
+    /**
      * Adds an {@code IdentifiedObject} name given by a {@code String} or {@code InternationalString}.
      * The given string will be combined with the authority, {@link #setCodeSpace(Citation, String) code space}
      * and {@link #setVersion(String) version} information for creating the {@link Identifier} or {@link GenericName}
@@ -573,6 +589,9 @@ public abstract class Builder<B extends
      * @param  supersededBy The name to use instead of this one, or {@code null} if none.
      * @return {@code this}, for method call chaining.
      *
+     * @see #addDeprecatedIdentifier(String, String)
+     * @see #setDeprecated(boolean)
+     *
      * @since 0.6
      */
     public B addDeprecatedName(final CharSequence name, final CharSequence supersededBy) {
@@ -654,6 +673,9 @@ public abstract class Builder<B extends
      * @param  supersededBy The identifier to use instead of this one, or {@code null} if none.
      * @return {@code this}, for method call chaining.
      *
+     * @see #addDeprecatedName(CharSequence, CharSequence)
+     * @see #setDeprecated(boolean)
+     *
      * @since 0.6
      */
     public B addDeprecatedIdentifier(final String identifier, final String supersededBy) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/DeprecatedCode.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/DeprecatedCode.java?rev=1674333&r1=1674332&r2=1674333&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/DeprecatedCode.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/DeprecatedCode.java [UTF-8] Fri Apr 17 15:06:06 2015
@@ -16,8 +16,10 @@
  */
 package org.apache.sis.referencing;
 
+import org.opengis.util.InternationalString;
 import org.opengis.metadata.citation.Citation;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
+import org.apache.sis.util.Deprecable;
 import org.apache.sis.util.resources.Vocabulary;
 
 
@@ -30,13 +32,20 @@ import org.apache.sis.util.resources.Voc
  * @version 0.6
  * @module
  */
-final class DeprecatedCode extends ImmutableIdentifier {
+final class DeprecatedCode extends ImmutableIdentifier implements Deprecable {
     /**
      * For cross-version compatibility.
      */
     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.
@@ -44,8 +53,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,
-                Vocabulary.formatInternational(Vocabulary.Keys.SupersededBy_1, supersededBy));
+        super(authority, codeSpace, code, version, null);
+        remarks = Vocabulary.formatInternational(Vocabulary.Keys.SupersededBy_1, supersededBy);
     }
 
     /**
@@ -57,4 +66,16 @@ final class DeprecatedCode extends Immut
     public boolean isDeprecated() {
         return true;
     }
+
+    /**
+     * Information about the replacement for this identifier.
+     *
+     * <div class="note"><b>Example:</b> "superseded by code XYZ".</div>
+     *
+     * @return Information about the replacement for this identifier, or {@code null} if none.
+     */
+    @Override
+    public InternationalString getRemarks() {
+        return remarks;
+    }
 }



Mime
View raw message