sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1675728 - in /sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis: internal/referencing/ referencing/crs/
Date Thu, 23 Apr 2015 22:20:51 GMT
Author: desruisseaux
Date: Thu Apr 23 22:20:50 2015
New Revision: 1675728

URL: http://svn.apache.org/r1675728
Log:
Referencing: initial port of DefaultProjectedCRS.

Added:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
  (with props)
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java?rev=1675728&r1=1675727&r2=1675728&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
[UTF-8] Thu Apr 23 22:20:50 2015
@@ -19,6 +19,7 @@ package org.apache.sis.internal.referenc
 import java.util.Collection;
 import java.util.logging.Logger;
 import javax.measure.unit.Unit;
+import javax.measure.unit.NonSI;
 import javax.measure.quantity.Angle;
 import org.opengis.annotation.UML;
 import org.opengis.annotation.Specification;
@@ -36,6 +37,7 @@ import org.apache.sis.referencing.Common
 import org.apache.sis.referencing.datum.DefaultPrimeMeridian;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
 import org.apache.sis.referencing.cs.AxesConvention;
+import org.apache.sis.measure.Units;
 
 import static java.util.Collections.singletonMap;
 import static org.apache.sis.internal.util.Numerics.epsilonEqual;
@@ -106,6 +108,32 @@ public final class ReferencingUtilities
     }
 
     /**
+     * Returns the angular unit of the specified coordinate system.
+     * The preference will be given to the longitude axis, if found.
+     *
+     * @param  cs The coordinate system from which to get the angular unit, or {@code null}.
+     * @return The angular unit, of {@link NonSI#DEGREE_ANGLE} if no angular unit was found.
+     *
+     * @since 0.6
+     */
+    public static Unit<Angle> getAngularUnit(final CoordinateSystem cs) {
+        Unit<Angle> unit = NonSI.DEGREE_ANGLE;
+        if (cs != null) {
+            for (int i = cs.getDimension(); --i>=0;) {
+                final CoordinateSystemAxis axis = cs.getAxis(i);
+                final Unit<?> candidate = axis.getUnit();
+                if (Units.isAngular(candidate)) {
+                    unit = candidate.asType(Angle.class);
+                    if (AxisDirection.EAST.equals(AxisDirections.absolute(axis.getDirection())))
{
+                        break; // Found the longitude axis.
+                    }
+                }
+            }
+        }
+        return unit;
+    }
+
+    /**
      * Returns the unit used for all axes in the given coordinate system.
      * If not all axes use the same unit, then this method returns {@code null}.
      *

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java?rev=1675728&r1=1675727&r2=1675728&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
[UTF-8] Thu Apr 23 22:20:50 2015
@@ -47,9 +47,17 @@ import java.util.Objects;
 
 
 /**
- * Abstract coordinate reference system, usually defined by a coordinate system and a datum.
- * {@code AbstractCRS} can have an arbitrary number of dimensions. The actual dimension of
a
- * given instance can be determined as below:
+ * Coordinate reference system, defined by a {@linkplain AbstractCS coordinate system}
+ * and (usually) a {@linkplain org.apache.sis.referencing.datum.AbstractDatum datum}.
+ * A coordinate reference system (CRS) consists of an ordered sequence of
+ * {@linkplain org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis coordinate system
axes}
+ * that are related to the earth through the datum.
+ * Most coordinate reference system do not move relative to the earth, except for
+ * {@linkplain DefaultEngineeringCRS engineering coordinate reference systems}
+ * defined on moving platforms such as cars, ships, aircraft, and spacecraft.
+ *
+ * <p>Coordinate reference systems can have an arbitrary number of dimensions.
+ * The actual dimension of a given instance can be determined as below:</p>
  *
  * {@preformat java
  *   int dimension = crs.getCoordinateSystem().getDimension();
@@ -80,6 +88,7 @@ import java.util.Objects;
 @XmlType(name="AbstractCRSType")
 @XmlRootElement(name = "AbstractCRS")
 @XmlSeeAlso({
+    DefaultProjectedCRS.class,
     DefaultGeodeticCRS.class,
     DefaultVerticalCRS.class,
     DefaultTemporalCRS.class,

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java?rev=1675728&r1=1675727&r2=1675728&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
[UTF-8] Thu Apr 23 22:20:50 2015
@@ -226,14 +226,14 @@ public class DefaultImageCRS extends Abs
      * Used by JAXB only (invoked by reflection).
      */
     private void setAffineCS(final AffineCS cs) {
-        super.setCoordinateSystem("affineCS", cs);
+        setCoordinateSystem("affineCS", cs);
     }
 
     /**
      * Used by JAXB only (invoked by reflection).
      */
     private void setCartesianCS(final CartesianCS cs) {
-        super.setCoordinateSystem("cartesianCS", cs);
+        setCoordinateSystem("cartesianCS", cs);
     }
 
     /**

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java?rev=1675728&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
(added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
[UTF-8] Thu Apr 23 22:20:50 2015
@@ -0,0 +1,304 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.crs;
+
+import java.util.Map;
+import javax.measure.unit.Unit;
+import javax.measure.quantity.Angle;
+import javax.measure.quantity.Length;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import org.opengis.parameter.ParameterValue;
+import org.opengis.parameter.GeneralParameterValue;
+import org.opengis.parameter.GeneralParameterDescriptor;
+import org.opengis.referencing.crs.ProjectedCRS;
+import org.opengis.referencing.crs.GeographicCRS;
+import org.opengis.referencing.cs.CartesianCS;
+import org.opengis.referencing.cs.CoordinateSystem; // For javadoc
+import org.opengis.referencing.datum.Ellipsoid;
+import org.opengis.referencing.datum.GeodeticDatum;
+import org.opengis.referencing.operation.Conversion;
+import org.opengis.referencing.operation.Projection;
+import org.opengis.geometry.MismatchedDimensionException;
+import org.apache.sis.referencing.IdentifiedObjects;
+import org.apache.sis.referencing.operation.DefaultOperationMethod;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
+import org.apache.sis.internal.referencing.WKTUtilities;
+import org.apache.sis.internal.util.Constants;
+import org.apache.sis.io.wkt.Formatter;
+
+import static org.apache.sis.internal.referencing.WKTUtilities.toFormattable;
+
+
+/**
+ * A 2D coordinate reference system used to approximate the shape of the earth on a planar
surface.
+ * It is done in such a way that the distortion that is inherent to the approximation is
carefully
+ * controlled and known. Distortion correction is commonly applied to calculated bearings
and
+ * distances to produce values that are a close match to actual field values.
+ *
+ * <p><b>Used with coordinate system type:</b>
+ *   {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian}.
+ * </p>
+ *
+ * <div class="section">Immutability and thread safety</div>
+ * This class is immutable and thus thread-safe if the property <em>values</em>
(not necessarily the map itself),
+ * the coordinate system and the datum instances given to the constructor are also immutable.
Unless otherwise noted
+ * in the javadoc, this condition holds if all components were created using only SIS factories
and static constants.
+ *
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @since   0.6
+ * @version 0.6
+ * @module
+ */
+@XmlRootElement(name = "ProjectedCRS")
+public class DefaultProjectedCRS extends AbstractDerivedCRS implements ProjectedCRS {
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = -4502680112031773028L;
+
+    /**
+     * Constructs a new object in which every attributes are set to a default value.
+     * <strong>This is not a valid object.</strong> This constructor is strictly
+     * reserved to JAXB, which will assign values to the fields using reflexion.
+     */
+    private DefaultProjectedCRS() {
+    }
+
+    /**
+     * Creates a projected CRS from a defining conversion.
+     * The properties given in argument follow the same rules than for the
+     * {@linkplain AbstractCRS#AbstractCRS(Map, CoordinateSystem) super-class constructor}.
+     * The following table is a reminder of main (not all) properties:
+     *
+     * <table class="sis">
+     *   <caption>Recognized properties (non exhaustive list)</caption>
+     *   <tr>
+     *     <th>Property name</th>
+     *     <th>Value type</th>
+     *     <th>Returned by</th>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#NAME_KEY}</td>
+     *     <td>{@link org.opengis.metadata.Identifier} or {@link String}</td>
+     *     <td>{@link #getName()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#ALIAS_KEY}</td>
+     *     <td>{@link org.opengis.util.GenericName} or {@link CharSequence} (optionally
as array)</td>
+     *     <td>{@link #getAlias()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#IDENTIFIERS_KEY}</td>
+     *     <td>{@link org.opengis.metadata.Identifier} (optionally as array)</td>
+     *     <td>{@link #getIdentifiers()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td>
+     *     <td>{@link org.opengis.util.InternationalString} or {@link String}</td>
+     *     <td>{@link #getRemarks()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.datum.Datum#DOMAIN_OF_VALIDITY_KEY}</td>
+     *     <td>{@link org.opengis.metadata.extent.Extent}</td>
+     *     <td>{@link #getDomainOfValidity()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.referencing.datum.Datum#SCOPE_KEY}</td>
+     *     <td>{@link org.opengis.util.InternationalString} or {@link String}</td>
+     *     <td>{@link #getScope()}</td>
+     *   </tr>
+     * </table>
+     *
+     * @param  properties The properties to be given to the new derived CRS object.
+     * @param  baseCRS Coordinate reference system to base the derived CRS on.
+     * @param  conversionFromBase The conversion from the base CRS to this 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.
+     */
+    public DefaultProjectedCRS(final Map<String,?> properties,
+                               final Conversion    conversionFromBase,
+                               final GeographicCRS baseCRS,
+                               final CartesianCS   derivedCS)
+            throws MismatchedDimensionException
+    {
+        super(properties, baseCRS, conversionFromBase, derivedCS, Projection.class);
+    }
+
+    /**
+     * Constructs a new coordinate reference system with the same values than the specified
one.
+     * This copy constructor provides a way to convert an arbitrary implementation into a
SIS one
+     * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific
API.
+     *
+     * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
+     *
+     * @param crs The coordinate reference system to copy.
+     *
+     * @see #castOrCopy(ProjectedCRS)
+     */
+    protected DefaultProjectedCRS(final ProjectedCRS crs) {
+        super(crs);
+    }
+
+    /**
+     * Returns a SIS coordinate reference system implementation with the same values than
the given
+     * arbitrary implementation. If the given object is {@code null}, then this method returns
{@code null}.
+     * Otherwise if the given object is already a SIS implementation, then the given object
is returned unchanged.
+     * Otherwise a new SIS implementation is created and initialized to the attribute values
of the given object.
+     *
+     * @param  object The object to get as a SIS implementation, or {@code null} if none.
+     * @return A SIS implementation containing the values of the given object (may be the
+     *         given object itself), or {@code null} if the argument was null.
+     */
+    public static DefaultProjectedCRS castOrCopy(final ProjectedCRS object) {
+        return (object == null) || (object instanceof DefaultProjectedCRS)
+                ? (DefaultProjectedCRS) object : new DefaultProjectedCRS(object);
+    }
+
+    /**
+     * Returns the GeoAPI interface implemented by this class.
+     * The SIS implementation returns {@code ProjectedCRS.class}.
+     *
+     * <div class="note"><b>Note for implementors:</b>
+     * Subclasses usually do not need to override this method since GeoAPI does not define
{@code ProjectedCRS}
+     * sub-interface. Overriding possibility is left mostly for implementors who wish to
extend GeoAPI with
+     * their own set of interfaces.</div>
+     *
+     * @return {@code ProjectedCRS.class} or a user-defined sub-interface.
+     */
+    @Override
+    public Class<? extends ProjectedCRS> getInterface() {
+        return ProjectedCRS.class;
+    }
+
+    /**
+     * Returns the datum of the {@linkplain #getBaseCRS() base CRS}.
+     *
+     * @return The datum of the base CRS.
+     */
+    @Override
+    @XmlElement(name="geodeticDatum")
+    public GeodeticDatum getDatum() {
+        return (GeodeticDatum) super.getDatum();
+    }
+
+    /**
+     * Used by JAXB only (invoked by reflection).
+     */
+    private void setDatum(final GeodeticDatum datum) {
+        // TODO
+    }
+
+    /**
+     * Returns the base coordinate reference system, which must be geographic.
+     *
+     * @return The base CRS.
+     */
+    @Override
+    public GeographicCRS getBaseCRS() {
+        return (GeographicCRS) super.getBaseCRS();
+    }
+
+    /**
+     * Returns the map projection from the {@linkplain #getBaseCRS() base CRS} to this CRS.
+     *
+     * @return The map projection from base CRS to this CRS.
+     */
+    @Override
+    public Projection getConversionFromBase() {
+        return (Projection) super.getConversionFromBase();
+    }
+
+    /**
+     * Returns the coordinate system.
+     */
+    @Override
+    @XmlElement(name="cartesianCS")
+    public CartesianCS getCoordinateSystem() {
+        return (CartesianCS) super.getCoordinateSystem();
+    }
+
+    /**
+     * Used by JAXB only (invoked by reflection).
+     */
+    private void setCoordinateSystem(final CartesianCS cs) {
+        setCoordinateSystem("cartesianCS", cs);
+    }
+
+    /**
+     * Formats the inner part of the <cite>Well Known Text</cite> (WKT) representation
of this CRS.
+     *
+     * @return {@code "ProjCS"} (WKT 1).
+     */
+    @Override
+    protected String formatTo(final Formatter formatter) {
+        WKTUtilities.appendName(this, formatter, null);
+        final Conversion    conversion  = getConversionFromBase();
+        final GeographicCRS baseCRS     = getBaseCRS();
+        final Ellipsoid     ellipsoid   = getDatum().getEllipsoid();
+        final Unit<?>       unit        = ReferencingUtilities.getUnit(getCoordinateSystem());
+        final Unit<Angle>   geoUnit     = ReferencingUtilities.getAngularUnit(baseCRS.getCoordinateSystem());
+        final Unit<?>       linearUnit  = formatter.addContextualUnit(unit);
+        final Unit<Angle>   angularUnit = formatter.addContextualUnit(geoUnit);
+        final Unit<Length>  axisUnit    = ellipsoid.getAxisUnit();
+        formatter.newLine();
+        formatter.append(toFormattable(baseCRS));
+        formatter.newLine();
+        formatter.append(DefaultOperationMethod.castOrCopy(conversion));
+        formatter.newLine();
+        for (final GeneralParameterValue param : conversion.getParameterValues().values())
{
+            final GeneralParameterDescriptor desc = param.getDescriptor();
+            String name;
+            if (IdentifiedObjects.isHeuristicMatchForName(desc, name = Constants.SEMI_MAJOR)
||
+                IdentifiedObjects.isHeuristicMatchForName(desc, name = Constants.SEMI_MINOR))
+            {
+                /*
+                 * Do not format semi-major and semi-minor axis length in most cases,  since
those
+                 * informations are provided in the ellipsoid. An exception to this rule
occurs if
+                 * the lengths are different from the ones declared in the datum.
+                 */
+                if (param instanceof ParameterValue<?>) {
+                    final double value = ((ParameterValue<?>) param).doubleValue(axisUnit);
+                    final double expected = (name == Constants.SEMI_MINOR)   // using '=='
is okay here.
+                            ? ellipsoid.getSemiMinorAxis() : ellipsoid.getSemiMajorAxis();
+                    if (value == expected) {
+                        continue;
+                    }
+                }
+            }
+            WKTUtilities.append(param, formatter);
+        }
+        formatter.append(unit);
+        final CartesianCS cs = getCoordinateSystem();
+        final int dimension = cs.getDimension();
+        for (int i=0; i<dimension; i++) {
+            formatter.newLine();
+            formatter.append(toFormattable(cs.getAxis(i)));
+        }
+        if (unit == null) {
+            formatter.setInvalidWKT(this, null);
+        }
+        formatter.removeContextualUnit(unit);
+        formatter.removeContextualUnit(geoUnit);
+        formatter.addContextualUnit(angularUnit);
+        formatter.addContextualUnit(linearUnit);
+        formatter.newLine(); // For writing the Id[…] element on its own line.
+        return "ProjCS";
+    }
+}

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java?rev=1675728&r1=1675727&r2=1675728&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
[UTF-8] Thu Apr 23 22:20:50 2015
@@ -238,7 +238,7 @@ public class DefaultTemporalCRS extends
      * Used by JAXB only (invoked by reflection).
      */
     private void setCoordinateSystem(final TimeCS cs) {
-        super.setCoordinateSystem("timeCS", cs);
+        setCoordinateSystem("timeCS", cs);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java?rev=1675728&r1=1675727&r2=1675728&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
[UTF-8] Thu Apr 23 22:20:50 2015
@@ -209,7 +209,7 @@ public class DefaultVerticalCRS extends
      * Used by JAXB only (invoked by reflection).
      */
     private void setCoordinateSystem(final VerticalCS cs) {
-        super.setCoordinateSystem("verticalCS", cs);
+        setCoordinateSystem("verticalCS", cs);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java?rev=1675728&r1=1675727&r2=1675728&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
[UTF-8] Thu Apr 23 22:20:50 2015
@@ -20,6 +20,7 @@ import java.util.Map;
 import java.util.Comparator;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.crs.CompoundCRS;
+import org.opengis.referencing.crs.DerivedCRS;
 import org.opengis.referencing.crs.EngineeringCRS;
 import org.opengis.referencing.crs.GeocentricCRS;
 import org.opengis.referencing.crs.GeodeticCRS;
@@ -50,7 +51,7 @@ import org.apache.sis.referencing.cs.Axe
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 final class SubTypes implements Comparator<Object> {
@@ -105,6 +106,12 @@ final class SubTypes implements Comparat
      * @see AbstractCRS#castOrCopy(CoordinateReferenceSystem)
      */
     static AbstractCRS castOrCopy(final CoordinateReferenceSystem object) {
+        if (object instanceof DerivedCRS) {
+            return DefaultDerivedCRS.castOrCopy((DerivedCRS) object);
+        }
+        if (object instanceof ProjectedCRS) {
+            return DefaultProjectedCRS.castOrCopy((ProjectedCRS) object);
+        }
         if (object instanceof GeodeticCRS) {
             if (object instanceof GeographicCRS) {
                 return DefaultGeographicCRS.castOrCopy((GeographicCRS) object);

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java?rev=1675728&r1=1675727&r2=1675728&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java
[UTF-8] Thu Apr 23 22:20:50 2015
@@ -74,7 +74,7 @@
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Cédric Briançon (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 @XmlSchema(elementFormDefault= XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns = {



Mime
View raw message