sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1651674 [3/5] - in /sis/trunk: ./ application/sis-webapp/src/main/java/org/apache/sis/index/tree/ core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/ core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ core/s...
Date Wed, 14 Jan 2015 14:01:47 GMT
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -18,6 +18,7 @@ package org.apache.sis.referencing.crs;
 
 import java.util.Map;
 import java.util.EnumMap;
+import java.util.ConcurrentModificationException;
 import javax.measure.unit.Unit;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -28,7 +29,7 @@ import org.opengis.referencing.cs.Cartes
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.apache.sis.internal.metadata.ReferencingUtilities;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.referencing.AbstractReferenceSystem;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.cs.AxesConvention;
@@ -39,7 +40,7 @@ import org.apache.sis.io.wkt.Formatter;
 import static org.apache.sis.util.Utilities.deepEquals;
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.internal.referencing.WKTUtilities.toFormattable;
-import static org.apache.sis.internal.metadata.ReferencingUtilities.canSetProperty;
+import static org.apache.sis.internal.referencing.ReferencingUtilities.canSetProperty;
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
@@ -70,7 +71,7 @@ import org.apache.sis.internal.jdk7.Obje
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-1.2)
- * @version 0.4
+ * @version 0.5
  * @module
  *
  * @see AbstractCS
@@ -103,12 +104,12 @@ public class AbstractCRS extends Abstrac
     private CoordinateSystem coordinateSystem;
 
     /**
-     * Other coordinate reference systems derived from this CRS.
+     * Other coordinate reference systems computed from this CRS by the application of an axes convention.
      * Created only when first needed.
      *
      * @see #forConvention(AxesConvention)
      */
-    private transient Map<AxesConvention,AbstractCRS> derived;
+    private transient Map<AxesConvention,AbstractCRS> forConvention;
 
     /**
      * Constructs a new object in which every attributes are set to a null value.
@@ -306,7 +307,7 @@ public class AbstractCRS extends Abstrac
      * }
      *
      * However our attempts to apply this approach have not been conclusive.
-     * For an unknown reason, the unmarlshalled CS object was empty.</div>
+     * For an unknown reason, the unmarshalled CS object was empty.</div>
      *
      * @param  name The property name, used only in case of error message to format.
      * @throws IllegalStateException If the coordinate system has already been set.
@@ -318,15 +319,35 @@ public class AbstractCRS extends Abstrac
     }
 
     /**
-     * Returns the map of cached CRS for axes conventions.
-     * This method shall be invoked in a synchronized block.
+     * Returns the existing CRS for the given convention, or {@code null} if none.
      */
-    final Map<AxesConvention,AbstractCRS> derived() {
+    final AbstractCRS getCached(final AxesConvention convention) {
         assert Thread.holdsLock(this);
-        if (derived == null) {
-            derived = new EnumMap<AxesConvention,AbstractCRS>(AxesConvention.class);
+        return (forConvention != null) ? forConvention.get(convention) : null;
+    }
+
+    /**
+     * Sets the CRS for the given axes convention.
+     *
+     * @param crs The CRS to cache.
+     * @return The cached CRS. May be different than the given {@code crs} if an existing instance has been found.
+     */
+    final AbstractCRS setCached(final AxesConvention convention, AbstractCRS crs) {
+        assert Thread.holdsLock(this);
+        if (forConvention == null) {
+            forConvention = new EnumMap<AxesConvention,AbstractCRS>(AxesConvention.class);
+        } else if (crs != this) {
+            for (final AbstractCRS existing : forConvention.values()) {
+                if (crs.equals(existing)) {
+                    crs = existing;
+                    break;
+                }
+            }
+        }
+        if (forConvention.put(convention, crs) != null) {
+            throw new ConcurrentModificationException(); // Should never happen, unless we have a synchronization bug.
         }
-        return derived;
+        return crs;
     }
 
     /**
@@ -340,8 +361,7 @@ public class AbstractCRS extends Abstrac
      */
     public synchronized AbstractCRS forConvention(final AxesConvention convention) {
         ensureNonNull("convention", convention);
-        final Map<AxesConvention,AbstractCRS> derived = derived();
-        AbstractCRS crs = derived.get(convention);
+        AbstractCRS crs = getCached(convention);
         if (crs == null) {
             final AbstractCS cs = AbstractCS.castOrCopy(coordinateSystem);
             final AbstractCS candidate = cs.forConvention(convention);
@@ -349,14 +369,8 @@ public class AbstractCRS extends Abstrac
                 crs = this;
             } else {
                 crs = createSameType(IdentifiedObjects.getProperties(this, IDENTIFIERS_KEY), candidate);
-                for (final AbstractCRS existing : derived.values()) {
-                    if (crs.equals(existing)) {
-                        crs = existing;
-                        break;
-                    }
-                }
             }
-            derived.put(convention, crs);
+            crs = setCached(convention, crs);
         }
         return crs;
     }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -34,7 +34,7 @@ import org.apache.sis.referencing.cs.Def
 import org.apache.sis.referencing.AbstractReferenceSystem;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.internal.referencing.WKTUtilities;
-import org.apache.sis.internal.metadata.ReferencingUtilities;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
 import org.apache.sis.util.collection.CheckedContainer;
 import org.apache.sis.util.resources.Errors;
@@ -328,18 +328,21 @@ public class DefaultCompoundCRS extends
     /**
      * {@inheritDoc}
      *
+     * <p>If the given convention is {@link AxesConvention#CONVENTIONALLY_ORIENTED} or
+     * {@link AxesConvention#NORMALIZED}, then this method will also reorder the components
+     * with horizontal CRS (geodetic or projected) first, then vertical CRS, then temporal CRS.</p>
+     *
      * @return {@inheritDoc}
      */
     @Override
     public synchronized DefaultCompoundCRS forConvention(final AxesConvention convention) {
         ensureNonNull("convention", convention);
-        final Map<AxesConvention,AbstractCRS> derived = derived();
-        DefaultCompoundCRS crs = (DefaultCompoundCRS) derived.get(convention);
+        DefaultCompoundCRS crs = (DefaultCompoundCRS) getCached(convention);
         if (crs == null) {
             crs = this;
             boolean changed = false;
-            final List<? extends CoordinateReferenceSystem> components =
-                    (convention != AxesConvention.NORMALIZED) ? this.components : singles;
+            final boolean reorderCRS = convention.ordinal() <= AxesConvention.CONVENTIONALLY_ORIENTED.ordinal();
+            final List<? extends CoordinateReferenceSystem> components = reorderCRS ? singles : this.components;
             final CoordinateReferenceSystem[] newComponents = new CoordinateReferenceSystem[components.size()];
             for (int i=0; i<newComponents.length; i++) {
                 CoordinateReferenceSystem component = components.get(i);
@@ -351,12 +354,12 @@ public class DefaultCompoundCRS extends
                 newComponents[i] = component;
             }
             if (changed) {
-                if (convention == AxesConvention.NORMALIZED) {
+                if (reorderCRS) {
                     Arrays.sort(newComponents, SubTypes.BY_TYPE); // This array typically has less than 4 elements.
                 }
                 crs = new DefaultCompoundCRS(IdentifiedObjects.getProperties(this, IDENTIFIERS_KEY), newComponents);
             }
-            derived.put(convention, crs);
+            crs = (DefaultCompoundCRS) setCached(convention, crs);
         }
         return crs;
     }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -31,8 +31,8 @@ import org.apache.sis.metadata.iso.Immut
 import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.referencing.AbstractReferenceSystem;
 import org.apache.sis.io.wkt.Formatter;
-
 import org.apache.sis.measure.Longitude;
+
 import static org.apache.sis.internal.referencing.HardCoded.CRS;
 import static org.apache.sis.internal.referencing.HardCoded.EPSG;
 import static org.apache.sis.internal.referencing.HardCoded.CRS27;

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -33,7 +33,7 @@ import org.opengis.referencing.cs.AxisDi
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
-import org.apache.sis.internal.metadata.ReferencingUtilities;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.referencing.AxisDirections;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.ComparisonMode;
@@ -64,7 +64,7 @@ import static org.apache.sis.util.Utilit
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-2.0)
- * @version 0.4
+ * @version 0.5
  * @module
  *
  * @see DefaultCoordinateSystemAxis
@@ -325,8 +325,7 @@ public class AbstractCS extends Abstract
 
     /**
      * Returns a coordinate system equivalent to this one but with axes rearranged according the given convention.
-     * If this coordinate system is already compatible with the given convention, then this method returns
-     * {@code this}.
+     * If this coordinate system is already compatible with the given convention, then this method returns {@code this}.
      *
      * @param  convention The axes convention for which a coordinate system is desired.
      * @return A coordinate system compatible with the given convention (may be {@code this}).
@@ -341,9 +340,10 @@ public class AbstractCS extends Abstract
         AbstractCS cs = derived.get(convention);
         if (cs == null) {
             switch (convention) {
-                case NORMALIZED:     cs = Normalizer.normalize(this, true);  break;
-                case RIGHT_HANDED:   cs = Normalizer.normalize(this, false); break;
-                case POSITIVE_RANGE: cs = Normalizer.shiftAxisRange(this);   break;
+                case NORMALIZED:              cs = Normalizer.normalize(this, true,  true);  break;
+                case CONVENTIONALLY_ORIENTED: cs = Normalizer.normalize(this, true,  false); break;
+                case RIGHT_HANDED:            cs = Normalizer.normalize(this, false, false); break;
+                case POSITIVE_RANGE:          cs = Normalizer.shiftAxisRange(this);          break;
                 default: throw new AssertionError(convention);
             }
             for (final AbstractCS existing : derived.values()) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -17,20 +17,63 @@
 package org.apache.sis.referencing.cs;
 
 import org.opengis.referencing.cs.AxisDirection; // For javadoc
-import org.opengis.referencing.cs.CoordinateSystem;
 
 
 /**
  * High-level characteristics about the axes of a coordinate system.
  * This enumeration provides a convenient way to identify some common axes conventions like
- * (<var>latitude</var>, <var>longitude</var>) versus (<var>longitude</var>, <var>latitude</var>) axis order,
- * or [-180 … +180]° versus [0 … 360]° longitude range.
+ * axis order or range of longitude values. Apache SIS Coordinate System objects can be made
+ * compliant to a given convention by calls to their {@code forConvention(AxesConvention)} method.
  *
- * <p>Enumeration values are inferred from the properties of given {@link CoordinateSystem} instances.
- * This enumeration does not add new information and does not aim to cover all possible conventions – it is
- * only a convenience for identifying some common patterns.</p>
+ * <p>The following table summarizes the coordinate system aspects that may be modified by each enum value,
+ * with an example of change applied by the enum. Blank cells mean that the property is not changed by the
+ * enum value.</p>
+ *
+ * <table class="sis">
+ *   <caption>Coordinate system properties changed by enum values</caption>
+ *   <tr>
+ *     <th>Property</th>
+ *     <th>Example</th>
+ *     <th>{@linkplain #NORMALIZED              Normalized}</th>
+ *     <th>{@linkplain #CONVENTIONALLY_ORIENTED Conventionally<br>oriented}</th>
+ *     <th>{@linkplain #RIGHT_HANDED            Right<br>handed}</th>
+ *     <th>{@linkplain #POSITIVE_RANGE          Positive<br>range}</th>
+ *   </tr>
+ *   <tr>
+ *     <td>Axis order</td>
+ *     <td>(<var>longitude</var>, <var>latitude</var>)</td>
+ *     <td style="text-align:center">✔</td>
+ *     <td style="text-align:center">✔</td>
+ *     <td style="text-align:center">✔</td>
+ *     <td></td>
+ *   </tr>
+ *   <tr>
+ *     <td>Axis direction</td>
+ *     <td>({@linkplain AxisDirection#EAST east}, {@linkplain AxisDirection#NORTH north})</td>
+ *     <td style="text-align:center">✔</td>
+ *     <td style="text-align:center">✔</td>
+ *     <td></td>
+ *     <td></td>
+ *   </tr>
+ *   <tr>
+ *     <td>Unit of measurement</td>
+ *     <td>Angular degrees &amp; metres</td>
+ *     <td style="text-align:center">✔</td>
+ *     <td></td>
+ *     <td></td>
+ *     <td></td>
+ *   </tr>
+ *   <tr>
+ *     <td>Range of values</td>
+ *     <td>[0 … 360]° of longitude</td>
+ *     <td></td>
+ *     <td></td>
+ *     <td></td>
+ *     <td style="text-align:center">✔</td>
+ *   </tr>
+ * </table>
  *
- * {@section Axis order}
+ * {@section Discussion on axis order}
  * The axis order is specified by the authority (typically a national agency) defining the Coordinate Reference System
  * (CRS). The order depends on the CRS type and the country defining the CRS. In the case of geographic CRS, the
  * (<var>latitude</var>, <var>longitude</var>) axis order is widely used by geographers and pilotes for centuries.
@@ -46,23 +89,7 @@ import org.opengis.referencing.cs.Coordi
  * {@link org.apache.sis.referencing.CRS#forCode(String)} method. The actual axis order can be verified after the CRS
  * creation with {@code System.out.println(crs)}. If (<var>x</var>,<var>y</var>) axis order is wanted for compatibility
  * with older OGC specifications or other softwares, CRS forced to "longitude first" axis order can be created using the
- * {@link #RIGHT_HANDED} or {@link #NORMALIZED} enumeration value.</p>
- *
- * {@section Normalized coordinate systems}
- * <cite>Right-handed</cite> coordinate systems have a precise meaning in Apache SIS.
- * However SIS defines also <cite>normalized</cite> coordinate systems in a more heuristic way.
- * A similar concept appears in the Web Map Services (WMS) 1.3 specification, quoted here:
- *
- * <div class="note"><b>6.7.2 Map CS</b> —
- * The usual orientation of the Map CS shall be such that the <var>i</var> axis is parallel to the East-to-West axis
- * of the Layer CRS and increases Eastward, and the <var>j</var> axis is parallel to the North-to-South axis of the
- * Layer CRS and increases Southward. This orientation will not be possible in some cases, as (for example) in an
- * orthographic projection over the South Pole. The convention to be followed is that, wherever possible, East shall
- * be to the right edge and North shall be toward the upper edge of the Map CS.</div>
- *
- * In addition to WMS, Apache SIS uses normalized coordinate systems in map projections.
- * More information are provided in the <cite>Axis units and directions</cite> section of
- * {@linkplain org.apache.sis.referencing.operation.projection map projection package}.
+ * {@link #CONVENTIONALLY_ORIENTED} or {@link #NORMALIZED} enumeration value.</p>
  *
  * {@section Range of longitude values}
  * Most geographic CRS have a longitude axis defined in the [-180 … +180]° range. All map projections in Apache SIS are
@@ -74,69 +101,116 @@ import org.opengis.referencing.cs.Coordi
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4 (derived from geotk-3.20)
- * @version 0.4
+ * @version 0.5
  * @module
  *
  * @see AbstractCS#forConvention(AxesConvention)
+ * @see org.apache.sis.referencing.crs.AbstractCRS#forConvention(AxesConvention)
  */
 public enum AxesConvention {
     /**
-     * Axes order, direction and units are forced to commonly used pre-defined values.
-     * This enum identifies the following changes to apply on a coordinate system:
+     * Axes order, direction and units of measure are forced to commonly used pre-defined values.
+     * This enum represents the following changes to apply on a coordinate system:
      *
      * <ul>
-     *   <li>Directions opposites to the following ones are replaced by their "forward" counterpart
-     *       (e.g. {@code SOUTH} → {@code NORTH}):
+     *   <li>Axes are oriented and ordered as defined for {@link #CONVENTIONALLY_ORIENTED} coordinate systems.</li>
+     *   <li>Known units are normalized (this list may be expanded in future SIS versions):
      *     <ul>
-     *       <li>{@link AxisDirection#EAST EAST}, {@link AxisDirection#NORTH NORTH},
-     *           {@link AxisDirection#UP UP}, {@link AxisDirection#FUTURE FUTURE} —
-     *           commonly used (<var>x</var>, <var>y</var>, <var>z</var>, <var>t</var>) directions for coordinates.</li>
-     *       <li>{@link AxisDirection#DISPLAY_RIGHT DISPLAY_RIGHT}, {@link AxisDirection#DISPLAY_DOWN DISPLAY_DOWN} —
-     *           commonly used (<var>x</var>, <var>y</var>) directions for screen devices.</li>
-     *       <li>{@link AxisDirection#ROW_POSITIVE ROW_POSITIVE},
-     *           {@link AxisDirection#COLUMN_POSITIVE COLUMN_POSITIVE} — indices in grids or matrices.</li>
+     *       <li>Angular units are set to {@link javax.measure.unit.NonSI#DEGREE_ANGLE}.</li>
+     *       <li>Linear units are set to {@link javax.measure.unit.SI#METRE}.</li>
+     *       <li>Temporal units are set to {@link javax.measure.unit.NonSI#DAY}.</li>
      *     </ul>
      *   </li>
-     *   <li>Axes with the new directions are reordered for a <cite>right-handed</cite> coordinate system.</li>
-     *   <li>Angular units are set to {@link javax.measure.unit.NonSI#DEGREE_ANGLE}.</li>
-     *   <li>Linear units are set to {@link javax.measure.unit.SI#METRE}.</li>
-     *   <li>Temporal units are set to {@link javax.measure.unit.NonSI#DAY}.</li>
      * </ul>
      *
-     * <div class="note"><b>Note:</b>
-     * The rules for normalized coordinate systems may be adjusted in future SIS versions based on experience gained.
-     * For more predictable results, consider using the {@link #RIGHT_HANDED} enum instead.</div>
+     * Current implementation does not normalize longitude values to the [-180 … +180]° range and does not set
+     * the {@linkplain org.apache.sis.referencing.datum.DefaultGeodeticDatum#getPrimeMeridian() prime meridian}
+     * to Greenwich. However those rules may be adjusted in future SIS versions based on experience gained.
+     * For more predictable results, consider using {@link #CONVENTIONALLY_ORIENTED} or {@link #RIGHT_HANDED} instead.
+     *
+     * <div class="note"><b>Rational:</b>
+     * The reason why we do not yet normalize the range and the prime meridian is because doing so
+     * would cause the conversion between old and new coordinate systems to be non-affine for axes
+     * having {@link org.opengis.referencing.cs.RangeMeaning#WRAPAROUND}. Furthermore changing the
+     * prime meridian would be a datum change rather than a coordinate system change, and datum
+     * changes are more difficult to handle by coordinate operation factories.
+     * </div>
      *
      * @see org.apache.sis.referencing.CommonCRS#normalizedGeographic()
      */
     NORMALIZED,
 
     /**
-     * Axes are reordered for a <cite>right-handed</cite> coordinate system. Directions, ranges and units are unchanged.
-     * In the two-dimensional case, the handedness is defined from the point of view of an observer above the plane of
-     * the system.
-     *
-     * <p>This enum is often used for deriving a coordinate system with the (<var>longitude</var>, <var>latitude</var>)
-     * or (<var>x</var>,<var>y</var>) axis order. While it works in many cases, note that a right-handed coordinate system
-     * does not guarantee that longitude or <var>x</var> axis will be first in every cases. The most notable exception
-     * is the (North, West) case.</p>
-     *
-     * <div class="note"><b>Note:</b>
-     * We do not provide a "<cite>longitude or <var>x</var> axis first</cite>" enumeration value because such
-     * criterion is hard to apply to inter-cardinal directions and has no meaning for map projections over a pole,
-     * while the right-handed rule can apply everywhere.</div>
-     *
-     * <div class="note"><b>Example:</b>
-     * The following table lists some axis orientations in the first column, and
-     * how those axes are reordered in a right-handed coordinate system (second column):
+     * Axes are oriented toward conventional directions and ordered for a {@linkplain #RIGHT_HANDED right-handed}
+     * coordinate system. Ranges of ordinate values and units of measurement are unchanged.
+     *
+     * <p>More specifically, directions opposites to the following ones are replaced by their "forward" counterpart
+     * (e.g. {@code SOUTH} → {@code NORTH}):</p>
+     *
+     * <table class="sis">
+     *   <caption>Axis directions used by convention</caption>
+     *   <tr>
+     *     <th>Preferred {@link AxisDirection}</th>
+     *     <th>Purpose</th>
+     *   </tr><tr>
+     *     <td>{@link AxisDirection#EAST EAST}, {@link AxisDirection#NORTH NORTH},
+     *         {@link AxisDirection#UP UP}, {@link AxisDirection#FUTURE FUTURE}</td>
+     *     <td>Commonly used (<var>x</var>, <var>y</var>, <var>z</var>, <var>t</var>) directions for coordinates.</td>
+     *   </tr><tr>
+     *     <td>{@link AxisDirection#DISPLAY_RIGHT DISPLAY_RIGHT}, {@link AxisDirection#DISPLAY_DOWN DISPLAY_DOWN}</td>
+     *     <td>Commonly used (<var>x</var>, <var>y</var>) directions for screen devices.</td>
+     *   </tr><tr>
+     *     <td>{@link AxisDirection#ROW_POSITIVE ROW_POSITIVE},
+     *         {@link AxisDirection#COLUMN_POSITIVE COLUMN_POSITIVE}</td>
+     *     <td>Indices in grids or matrices.</td>
+     *   </tr>
+     * </table>
+     *
+     * Then, axes are ordered for {@link #RIGHT_HANDED} coordinate system.
+     *
+     * {@section Usage}
+     * This enum is often used for deriving a coordinate system with the (<var>longitude</var>, <var>latitude</var>) or
+     * (<var>x</var>,<var>y</var>) axis order. We do not provide a "<cite>longitude or <var>x</var> axis first</cite>"
+     * enumeration value because such criterion is hard to apply to inter-cardinal directions and has no meaning for
+     * map projections over a pole, while the right-handed rule can apply everywhere.
+     *
+     * <p><cite>Right-handed</cite> coordinate systems have a precise meaning in Apache SIS.
+     * However <cite>conventionally oriented</cite> coordinate systems have a looser definition.
+     * A similar concept appears in the Web Map Services (WMS) 1.3 specification, quoted here:</p>
+     *
+     * <div class="note"><b>6.7.2 Map CS</b> —
+     * The usual orientation of the Map CS shall be such that the <var>i</var> axis is parallel to the East-to-West axis
+     * of the Layer CRS and increases Eastward, and the <var>j</var> axis is parallel to the North-to-South axis of the
+     * Layer CRS and increases Southward. This orientation will not be possible in some cases, as (for example) in an
+     * orthographic projection over the South Pole. The convention to be followed is that, wherever possible, East shall
+     * be to the right edge and North shall be toward the upper edge of the Map CS.</div>
+     *
+     * @since 0.5
+     */
+    CONVENTIONALLY_ORIENTED,
+
+    /**
+     * Axes are ordered for a <cite>right-handed</cite> coordinate system. Axis directions, ranges or ordinate values
+     * and units of measurement are unchanged. In the two-dimensional case, the handedness is defined from the point
+     * of view of an observer above the plane of the system.
+     *
+     * <p>Note that a right-handed coordinate system does not guarantee that longitude or <var>x</var> axis
+     * will be first in every cases. The most notable exception is the case of (West, North) orientations.
+     * The following table lists that case, together with other common axis orientations.
+     * The axes orientations implied by this {@code RIGHT_HANDED} enum is shown,
+     * together with {@link #CONVENTIONALLY_ORIENTED} axes for reference:</p>
+     *
+     * <div class="note">
      * <table class="sis">
      *   <caption>Examples of left-handed and right-handed coordinate systems</caption>
-     *   <tr><th>Left-handed</th>   <th>Right-handed</th>  <th>Remarks</th></tr>
-     *   <tr><td>(North, East)</td> <td>(East, North)</td> <td>This is the most common case.</td></tr>
-     *   <tr><td>(West, North)</td> <td>(North, West)</td> <td>This right-handed system has latitude first.</td></tr>
-     *   <tr><td>(South, West)</td> <td>(West, South)</td> <td>Used for the mapping of southern Africa.</td></tr>
-     *   <tr><td>(South along 0°,<br>South along 90° West)</td>
-     *       <td>(South along 90° West,<br>South along 0°)</td> <td>Can be used for the mapping of North pole.</td></tr>
+     *   <tr><th>Left-handed</th> <th>Right-handed</th> <th>Conventionally oriented</th> <th>Remarks</th></tr>
+     *   <tr><td>North, East</td> <td>East, North</td> <td>East, North</td> <td>This is the most common case.</td></tr>
+     *   <tr><td>West, North</td> <td>North, West</td> <td>East, North</td> <td>This right-handed system has latitude first.</td></tr>
+     *   <tr><td>South, West</td> <td>West, South</td> <td>East, North</td> <td>Used for the mapping of southern Africa.</td></tr>
+     *   <tr><td>South along 0°,<br>South along 90° West</td>
+     *       <td>South along 90° West,<br>South along 0°</td>
+     *       <td>(Same as right-handed)</td>
+     *       <td>Can be used for the mapping of North pole.</td></tr>
      * </table></div>
      *
      * @see org.apache.sis.referencing.cs.CoordinateSystems#angle(AxisDirection, AxisDirection)
@@ -146,12 +220,24 @@ public enum AxesConvention {
 
     /**
      * Axes having a <cite>wraparound</cite>
-     * {@linkplain org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#getRangeMeaning() range meaning}
-     * are shifted to their ranges of positive values. The unit and range period are unchanged.
+     * {@linkplain org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#getRangeMeaning() range meaning} are
+     * shifted to their ranges of positive values. The units of measurement and range period (difference between
+     * {@linkplain org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#getMaximumValue() maximum} and
+     * {@linkplain org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#getMinimumValue() minimum value})
+     * are unchanged.
+     *
+     * <p>Note that projecting geometry objects from the old to the new coordinate system may require
+     * a non-affine conversion. Some geometries may need to be separated in two parts, and others may
+     * need to be merged.</p>
      *
-     * <p>The most frequent usage of this enum is for shifting longitude values from the [-180 … +180]° range
+     * {@section Usage}
+     * The most frequent usage of this enum is for shifting longitude values from the [-180 … +180]° range
      * to the [0 … 360]° range. However this enum could also be used with climatological calendars if their
-     * time axis has a wrapround range meaning.</p>
+     * time axis has a wrapround range meaning.
+     *
+     * <p>Note that conversions from an coordinate system using the [-180 … +180]° range to a coordinate system
+     * using the [0 … 360]° range may not be affine. For example the data in the West hemisphere ([-180 … 0]°)
+     * may need to move on the right side of the East hemisphere ([180 … 360]°).</p>
      *
      * @see org.opengis.referencing.cs.RangeMeaning#WRAPAROUND
      */

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -48,7 +48,7 @@ import org.apache.sis.internal.jaxb.Cont
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.io.wkt.ElementKind;
-import org.apache.sis.internal.metadata.ReferencingUtilities;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
 
 import static java.lang.Double.doubleToLongBits;
 import static java.lang.Double.NEGATIVE_INFINITY;

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -48,7 +48,7 @@ import static org.opengis.referencing.Id
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-2.2)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 final class Normalizer implements Comparable<Normalizer> {
@@ -127,9 +127,10 @@ final class Normalizer implements Compar
      * but with normalized axis direction and unit of measurement.
      *
      * @param  axis The axis to normalize.
+     * @param  normalizeUnits {@code true} for normalizing units.
      * @return An axis using normalized direction unit, or {@code axis} if the given axis already uses the given unit.
      */
-    static CoordinateSystemAxis normalize(final CoordinateSystemAxis axis) {
+    static CoordinateSystemAxis normalize(final CoordinateSystemAxis axis, final boolean normalizeUnits) {
         /*
          * Normalize the axis direction. For now we do not touch to inter-cardinal directions (e.g. "North-East")
          * because it is not clear which normalization policy would match common usage.
@@ -144,12 +145,16 @@ final class Normalizer implements Compar
          * Normalize unit of measurement.
          */
         final Unit<?> unit = axis.getUnit(), newUnit;
-        if (Units.isLinear(unit)) {
-            newUnit = SI.METRE;
-        } else if (Units.isAngular(unit)) {
-            newUnit = NonSI.DEGREE_ANGLE;
-        } else if (Units.isTemporal(unit)) {
-            newUnit = NonSI.DAY;
+        if (normalizeUnits) {
+            if (Units.isLinear(unit)) {
+                newUnit = SI.METRE;
+            } else if (Units.isAngular(unit)) {
+                newUnit = NonSI.DEGREE_ANGLE;
+            } else if (Units.isTemporal(unit)) {
+                newUnit = NonSI.DAY;
+            } else {
+                newUnit = unit;
+            }
         } else {
             newUnit = unit;
         }
@@ -206,17 +211,18 @@ final class Normalizer implements Compar
      * If no axis change is needed, then this method returns {@code cs} unchanged.
      *
      * @param  cs The coordinate system to normalize.
-     * @param  allowAxisChanges {@code true} for normalizing axis directions and units.
+     * @param  normalizeAxes  {@code true} for normalizing axis directions.
+     * @param  normalizeUnits {@code true} for normalizing units (currently ignored if {@code normalizeAxes} is {@code false}).
      * @return The normalized coordinate system.
      */
-    static AbstractCS normalize(final AbstractCS cs, final boolean allowAxisChanges) {
+    static AbstractCS normalize(final AbstractCS cs, final boolean normalizeAxes, final boolean normalizeUnits) {
         boolean changed = false;
         final int dimension = cs.getDimension();
         final CoordinateSystemAxis[] axes = new CoordinateSystemAxis[dimension];
         for (int i=0; i<dimension; i++) {
             CoordinateSystemAxis axis = cs.getAxis(i);
-            if (allowAxisChanges) {
-                changed |= (axis != (axis = normalize(axis)));
+            if (normalizeAxes) {
+                changed |= (axis != (axis = normalize(axis, normalizeUnits)));
             }
             axes[i] = axis;
         }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -35,7 +35,7 @@ import org.apache.sis.internal.metadata.
 
 import static org.apache.sis.util.Utilities.deepEquals;
 import static org.apache.sis.util.collection.Containers.property;
-import static org.apache.sis.internal.metadata.ReferencingUtilities.canSetProperty;
+import static org.apache.sis.internal.referencing.ReferencingUtilities.canSetProperty;
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -41,13 +41,13 @@ import org.apache.sis.internal.jdk7.Obje
 
 
 /**
- * Parameters for a geographic transformation between two datum.
+ * Parameters for a geographic transformation between two datum having the same prime meridian.
  * Bursa-Wolf parameters are also known as <cite>Helmert transformation parameters</cite>.
  * For an explanation of their purpose, see the <cite>Bursa-Wolf parameters</cite> section
  * of {@link DefaultGeodeticDatum} class javadoc.
  *
  * <p>The Bursa-Wolf parameters shall be applied to geocentric coordinates,
- * where the <var>X</var> axis points towards the Greenwich Prime Meridian,
+ * where the <var>X</var> axis points towards the Prime Meridian (usually Greenwich),
  * the <var>Y</var> axis points East, and the <var>Z</var> axis points North.</p>
  *
  * <div class="note"><b>Note:</b>
@@ -97,17 +97,21 @@ import org.apache.sis.internal.jdk7.Obje
  * {@section Source and target geodetic datum}
  * The <var>source datum</var> in above coordinates transformation is the {@link DefaultGeodeticDatum} instance
  * that contain this {@code BursaWolfParameters}. It can be any datum, including datum that are valid only locally.
- * The <var>{@linkplain #getTargetDatum() target datum}</var> is specified at construction time and often fixed to
- * WGS 84 for the needs of the {@code TOWGS84[…]} element in <cite>Well Known Text</cite> (WKT 1) representation.
+ * The <var>{@linkplain #getTargetDatum() target datum}</var> is specified at construction time and is often,
+ * but not necessarily, the <cite>World Geodetic System 1984</cite> (WGS 84) datum.
+ *
+ * <p>If the source and target datum does not have the same {@linkplain DefaultGeodeticDatum#getPrimeMeridian()
+ * prime meridian}, then it is user's responsibility to apply longitude rotation before to use the Bursa-Wolf
+ * parameters.</p>
  *
  * {@section When Bursa-Wolf parameters are used}
  * {@code BursaWolfParameters} are used in three contexts:
  * <ol>
  *   <li>Created as a step while creating a {@linkplain org.apache.sis.referencing.operation.DefaultCoordinateOperation
  *       coordinate operation} from the EPSG database.</li>
- *   <li>Associated to a {@link DefaultGeodeticDatum} for the sole needs of the WKT 1 {@code TOWGS84[…]} element.
- *       In this case, only Bursa-Wolf parameters having a WGS 84 {@linkplain #getTargetDatum() target datum} are
- *       useful.</li>
+ *   <li>Associated to a {@link DefaultGeodeticDatum} with the WGS 84 {@linkplain #getTargetDatum() target datum} for
+ *       providing the parameter values to display in the {@code TOWGS84[…]} element of <cite>Well Known Text</cite>
+ *       (WKT) version 1. Note that WKT version 2 does not have {@code TOWGS84[…]} element anymore.</li>
  *   <li>Specified at {@code DefaultGeodeticDatum} construction time for arbitrary target datum.
  *       Apache SIS will ignore those Bursa-Wolf parameters, except as a fallback if no parameters
  *       can been found in the EPSG database for a given pair of source and target CRS.</li>
@@ -358,6 +362,10 @@ public class BursaWolfParameters extends
      * Those geocentric coordinates are typically converted from geographic coordinates
      * in the region or timeframe given by {@link #getDomainOfValidity()}.
      *
+     * <p>If the source datum and the {@linkplain #getTargetDatum() target datum} do not use the same
+     * {@linkplain DefaultGeodeticDatum#getPrimeMeridian() prime meridian}, then it is caller's responsibility
+     * to apply longitude rotation before to use the matrix returned by this method.</p>
+     *
      * {@section Time-dependent transformation}
      * Some transformations use parameters that vary with time (e.g. operation method EPSG:1053).
      * Users can optionally specify a date for which the transformation is desired.

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -33,7 +33,7 @@ import org.apache.sis.internal.util.Nume
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.gco.Measure;
 import org.apache.sis.internal.jaxb.referencing.SecondDefiningParameter;
-import org.apache.sis.internal.metadata.ReferencingUtilities;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.referencing.Formulas;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.AbstractIdentifiedObject;

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -59,26 +59,33 @@ import org.apache.sis.internal.jdk7.Obje
  * Associating Bursa-Wolf parameters to geodetic datum is known as the <cite>early-binding</cite> approach.
  * A recommended alternative, discussed below, is the <cite>late-binding</cite> approach.
  *
- * <p>There is different methods for transforming coordinates from one geodetic datum to an other datum,
- * and Bursa-Wolf parameters are used with some of them. However different set of parameters may exist
- * for the same pair of (<var>source</var>, <var>target</var>) datum, so it is often not sufficient to
- * know those datum. The (<var>source</var>, <var>target</var>) pair of CRS are often necessary,
- * sometime together with the geographic extent of the coordinates to transform.</p>
+ * <p>The Bursa-Wolf parameters serve two purposes:</p>
+ * <ol>
+ *   <li><p><b>Fallback for datum shifts</b><br>
+ *     There is different methods for transforming coordinates from one geodetic datum to an other datum,
+ *     and Bursa-Wolf parameters are used with some of them. However different set of parameters may exist
+ *     for the same pair of (<var>source</var>, <var>target</var>) datum, so it is often not sufficient to
+ *     know those datum. The (<var>source</var>, <var>target</var>) pair of CRS are often necessary,
+ *     sometime together with the geographic extent of the coordinates to transform.</p>
  *
- * <p>Apache SIS searches for datum shift methods (including Bursa-Wolf parameters) in the EPSG database when a
- * {@link org.opengis.referencing.operation.CoordinateOperation} or a
- * {@link org.opengis.referencing.operation.MathTransform} is requested for a pair of CRS.
- * This is known as the <cite>late-binding</cite> approach.
- * If a datum shift method is found in the database, it will have precedence over any {@code BursaWolfParameters}
- * instance associated to this {@code DefaultGeodeticDatum}. Only if no datum shift method is found in the database,
- * then the {@code BursaWolfParameters} associated to the datum may be used as a fallback.</p>
+ *     <p>Apache SIS searches for datum shift methods (including Bursa-Wolf parameters) in the EPSG database when a
+ *     {@link org.opengis.referencing.operation.CoordinateOperation} or a
+ *     {@link org.opengis.referencing.operation.MathTransform} is requested for a pair of CRS.
+ *     This is known as the <cite>late-binding</cite> approach.
+ *     If a datum shift method is found in the database, it will have precedence over any {@code BursaWolfParameters}
+ *     instance associated to this {@code DefaultGeodeticDatum}. Only if no datum shift method is found in the database,
+ *     then the {@code BursaWolfParameters} associated to the datum may be used as a fallback.</p>
+ *   </li>
  *
- * <p>The Bursa-Wolf parameters association serves an other purpose: when a CRS is formatted in the older
- * <cite>Well Known Text</cite> (WKT 1) format, the formatted string may contain a {@code TOWGS84[…]} element
- * with the parameter values of the transformation to the WGS 84 datum. This element is provided as a help
- * for other Geographic Information Systems that support only the <cite>early-binding</cite> approach.
- * Apache SIS usually does not need the {@code TOWGS84} element, except as a fallback for datum that
- * do not exist in the EPSG database.</p>
+ *   <li><p><b>WKT version 1 formatting</b><br>
+ *     The Bursa-Wolf parameters association serves an other purpose: when a CRS is formatted in the older
+ *     <cite>Well Known Text</cite> (WKT 1) format, the formatted string may contain a {@code TOWGS84[…]} element
+ *     with the parameter values of the transformation to the WGS 84 datum. This element is provided as a help
+ *     for other Geographic Information Systems that support only the <cite>early-binding</cite> approach.
+ *     Apache SIS usually does not need the {@code TOWGS84} element, except as a fallback for datum that
+ *     do not exist in the EPSG database.</p>
+ *   </li>
+ * </ol>
  *
  * {@section Creating new geodetic datum instances}
  * New instances can be created either directly by specifying all information to a factory method (choices 3
@@ -111,7 +118,7 @@ import org.apache.sis.internal.jdk7.Obje
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-1.2)
- * @version 0.4
+ * @version 0.5
  * @module
  *
  * @see DefaultEllipsoid
@@ -272,8 +279,8 @@ public class DefaultGeodeticDatum extend
         super(datum);
         ellipsoid     = datum.getEllipsoid();
         primeMeridian = datum.getPrimeMeridian();
-        bursaWolf     = (datum instanceof DefaultGeodeticDatum) ?
-                        ((DefaultGeodeticDatum) datum).bursaWolf : null;
+        bursaWolf     = (datum instanceof DefaultGeodeticDatum) ? ((DefaultGeodeticDatum) datum).bursaWolf : null;
+        // No need to clone the 'bursaWolf' array since it is read only.
     }
 
     /**
@@ -329,7 +336,7 @@ public class DefaultGeodeticDatum extend
 
     /**
      * Returns all Bursa-Wolf parameters specified in the {@code properties} map at construction time.
-     * For a discussion about what Bursa-Wolf parameters are, see the class javadoc.
+     * See class javadoc for a discussion about Bursa-Wolf parameters.
      *
      * @return The Bursa-Wolf parameters, or an empty array if none.
      */
@@ -346,31 +353,36 @@ public class DefaultGeodeticDatum extend
 
     /**
      * Returns the position vector transformation (geocentric domain) to the specified datum.
-     * This method performs the search in the following order:
+     * If the returned matrix is non-null, then the transformation is represented by an affine transform which can be
+     * applied on <strong>geocentric</strong> coordinates. This is identified in the EPSG database as operation method
+     * 1033 – <cite>Position Vector transformation (geocentric domain)</cite>, or
+     * 1053 – <cite>Time-dependent Position Vector transformation</cite>.
      *
-     * <ul>
+     * <p>If this datum and the given {@code targetDatum} do not use the same
+     * {@linkplain #getPrimeMeridian() prime meridian}, then it is caller's responsibility
+     * to apply longitude rotation before to use the matrix returned by this method.</p>
+     *
+     * <p><b>Search order</b><br>
+     * This method performs the search in the following order:</p>
+     * <ol>
      *   <li>If this {@code GeodeticDatum} contains {@code BursaWolfParameters} having the given
      *       {@linkplain BursaWolfParameters#getTargetDatum() target datum} (ignoring metadata),
      *       then the matrix will be built from those parameters.</li>
      *   <li>Otherwise if the other datum contains {@code BursaWolfParameters} having this datum
      *       as their target (ignoring metadata), then the matrix will be built from those parameters
      *       and {@linkplain MatrixSIS#inverse() inverted}.</li>
-     *   <li>Otherwise this method returns {@code null}.</li>
-     * </ul>
+     * </ol>
      *
+     * <p><b>Multi-occurrences resolution</b><br>
      * If more than one {@code BursaWolfParameters} instance is found in any of the above steps, then the one having
      * the largest intersection between its {@linkplain BursaWolfParameters#getDomainOfValidity() domain of validity}
      * and the given extent will be selected. If more than one instance have the same intersection, then the first
-     * occurrence is selected.
+     * occurrence is selected.</p>
      *
-     * <p>If the given extent contains a {@linkplain org.opengis.metadata.extent.TemporalExtent temporal extent},
+     * <p><b>Time-dependent parameters</b><br>
+     * If the given extent contains a {@linkplain org.opengis.metadata.extent.TemporalExtent temporal extent},
      * then the instant located midway between start and end time will be taken as the date where to evaluate the
-     * Bursa-Wolf parameters. This apply only to {@linkplain TimeDependentBWP time-dependent parameters}.</p>
-     *
-     * <p>If the returned matrix is non-null, then the transformation is represented by an affine transform which can be
-     * applied on <strong>geocentric</strong> coordinates. This is identified in the EPSG database as operation method
-     * 1033 – <cite>Position Vector transformation (geocentric domain)</cite>, or
-     * 1053 – <cite>Time-dependent Position Vector transformation</cite>.</p>
+     * Bursa-Wolf parameters. This is relevant only to {@linkplain TimeDependentBWP time-dependent parameters}.</p>
      *
      * @param  targetDatum The target datum.
      * @param  areaOfInterest The geographic and temporal extent where the transformation should be valid, or {@code null}.

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -36,7 +36,7 @@ import org.apache.sis.util.ComparisonMod
 
 import static org.apache.sis.util.ArgumentChecks.ensureFinite;
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
-import static org.apache.sis.internal.metadata.ReferencingUtilities.canSetProperty;
+import static org.apache.sis.internal.referencing.ReferencingUtilities.canSetProperty;
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java [iso-8859-1] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -33,7 +33,7 @@ import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.io.wkt.FormattableObject;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
-import static org.apache.sis.internal.metadata.ReferencingUtilities.canSetProperty;
+import static org.apache.sis.internal.referencing.ReferencingUtilities.canSetProperty;
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
@@ -53,7 +53,7 @@ import org.apache.sis.internal.jdk7.Obje
  *       {@link org.apache.sis.referencing.CommonCRS.Temporal#datum()}.</li>
  *   <li>Create a {@code TemporalDatum} from an identifier in a database by invoking
  *       {@link org.opengis.referencing.datum.DatumAuthorityFactory#createTemporalDatum(String)}.</li>
- *   <li>Create a {@code TemporalDatum} by invoking the {@code createTemporalDatum(…)}
+ *   <li>Create a {@code TemporalDatum} by invoking the {@code createTemporalDatum(…)}
  *       method defined in the {@link org.opengis.referencing.datum.DatumFactory} interface.</li>
  *   <li>Create a {@code DefaultTemporalDatum} by invoking the
  *       {@linkplain #DefaultTemporalDatum(Map, Date) constructor}.</li>
@@ -279,7 +279,7 @@ public class DefaultTemporalDatum extend
     }
 
     /**
-     * Formats this datum as a <cite>Well Known Text</cite> {@code TimeDatum[…]} element.
+     * Formats this datum as a <cite>Well Known Text</cite> {@code TimeDatum[…]} element.
      *
      * <div class="note"><b>Compatibility note:</b>
      * {@code TimeDatum} is defined in the WKT 2 specification only.</div>
@@ -297,7 +297,7 @@ public class DefaultTemporalDatum extend
     }
 
     /**
-     * The {@code TIMEORIGIN[…]} element inside an {@code TDATUM[…]}.
+     * The {@code TIMEORIGIN[…]} element inside an {@code TDATUM[…]}.
      */
     private static final class Origin extends FormattableObject {
         /** The value of the origin to format. */

Propchange: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Wed Jan 14 14:01:44 2015
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -32,7 +32,7 @@ import org.apache.sis.internal.jaxb.Lega
 import org.apache.sis.internal.referencing.VerticalDatumTypes;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
-import static org.apache.sis.internal.metadata.ReferencingUtilities.canSetProperty;
+import static org.apache.sis.internal.referencing.ReferencingUtilities.canSetProperty;
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -33,6 +33,8 @@
  *   <li>{@link org.apache.sis.referencing.datum.DefaultEllipsoid#getAuthalicRadius()}</li>
  *   <li>{@link org.apache.sis.referencing.datum.DefaultEllipsoid#getEccentricity()}</li>
  *   <li>{@link org.apache.sis.referencing.datum.DefaultEllipsoid#orthodromicDistance(double, double, double, double)}</li>
+ *   <li>{@link org.apache.sis.referencing.datum.DefaultPrimeMeridian#getGreenwichLongitude(javax.measure.unit.Unit)
+ *       DefaultPrimeMeridian.getGreenwichLongitude(Unit)}</li>
  *   <li>{@link org.apache.sis.referencing.datum.DefaultGeodeticDatum#getBursaWolfParameters()}</li>
  *   <li>{@link org.apache.sis.referencing.datum.DefaultGeodeticDatum#getPositionVectorTransformation
  *       DefaultGeodeticDatum.getPositionVectorTransformation(GeodeticDatum, Extent)}</li>

Propchange: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Wed Jan 14 14:01:44 2015
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MismatchedMatrixSizeException.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Wed Jan 14 14:01:44 2015
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/NoninvertibleMatrixException.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Wed Jan 14 14:01:44 2015
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/package-info.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Wed Jan 14 14:01:44 2015
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/provider/Affine.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Wed Jan 14 14:01:44 2015
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1D.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1D.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1D.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1D.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -89,9 +89,9 @@ final class ExponentialTransform1D exten
      * Constructs a new exponential transform which is the inverse of the supplied logarithmic transform.
      */
     ExponentialTransform1D(final LogarithmicTransform1D inverse) {
-        this.base    = inverse.getBase();
-        this.lnBase  = inverse.getLogBase();
-        this.scale   = Math.pow(base, -inverse.getOffset());
+        this.base    = inverse.base();
+        this.lnBase  = inverse.lnBase();
+        this.scale   = inverse.pow(-inverse.offset());
         this.inverse = inverse;
     }
 
@@ -248,26 +248,23 @@ final class ExponentialTransform1D exten
      * to this {@code ExponentialTransform1D}.
      *
      * @param  other The math transform to apply.
-     * @param  applyOtherFirst {@code true} if the transformation order is {@code other}
-     *         followed by {@code this}, or {@code false} if the transformation order is
-     *         {@code this} followed by {@code other}.
-     * @return The combined math transform, or {@code null} if no optimized combined
-     *         transform is available.
+     * @param  applyOtherFirst {@code true} if the transformation order is {@code other} followed by {@code this},
+     *         or {@code false} if the transformation order is {@code this} followed by {@code other}.
+     * @return The combined math transform, or {@code null} if no optimized combined transform is available.
      */
     final MathTransform concatenateLog(final LogarithmicTransform1D other, final boolean applyOtherFirst) {
+        final double newScale = lnBase / other.lnBase();
         if (applyOtherFirst) {
-            return MathTransforms.concatenate(
-                    PowerTransform1D.create(lnBase / other.getLogBase()),
-                    LinearTransform1D.create(scale * Math.pow(base, other.getOffset()), 0));
+            return MathTransforms.concatenate(PowerTransform1D.create(newScale),
+                    LinearTransform1D.create(scale * Math.pow(base, other.offset()), 0));
         } else {
-            final double newScale = lnBase / other.getLogBase();
             final double newOffset;
             if (scale > 0) {
-                newOffset = other.log(scale) + other.getOffset();
+                newOffset = other.log(scale) + other.offset();
             } else {
                 // Maybe the Math.log(...) argument will become
                 // positive if we rewrite the equation that way...
-                newOffset = other.log(scale * other.getOffset() * other.getLogBase());
+                newOffset = other.log(scale * other.offset() * other.lnBase());
             }
             if (!Double.isNaN(newOffset)) {
                 return LinearTransform1D.create(newScale, newOffset);
@@ -281,8 +278,8 @@ final class ExponentialTransform1D exten
      */
     @Override
     protected int computeHashCode() {
-        return Numerics.hashCode(Double.doubleToLongBits(base) +
-                            31 * Double.doubleToLongBits(scale)) ^ super.computeHashCode();
+        return Numerics.hashCode(Double.doubleToLongBits(base)
+                + 31 * Double.doubleToLongBits(scale)) ^ super.computeHashCode();
     }
 
     /**

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -20,6 +20,7 @@ import java.io.Serializable;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransform1D;
 import org.apache.sis.internal.util.Numerics;
+import org.apache.sis.math.MathFunctions;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.ComparisonMode;
 
@@ -32,7 +33,7 @@ import org.apache.sis.util.ComparisonMod
  * <p>Logarithms in bases other than <var>e</var> or 10 are computed by concatenating a linear transform,
  * using the following mathematical identity:</p>
  *
- * <blockquote>    log<sub>base</sub>(<var>x</var>) = ln(<var>x</var>) / ln(base)    </blockquote>
+ * <blockquote>log<sub>base</sub>(<var>x</var>) = ln(<var>x</var>) / ln(base)</blockquote>
  *
  * {@section Serialization}
  * Serialized instances of this class are not guaranteed to be compatible with future SIS versions.
@@ -80,8 +81,9 @@ class LogarithmicTransform1D extends Abs
         ArgumentChecks.ensureStrictlyPositive("base", base);
         if (base == 10) {
             return Base10.create(offset);
+        } else {
+            return NATURAL.concatenate(1 / Math.log(base), offset);
         }
-        return NATURAL.concatenate(1 / Math.log(base), offset);
     }
 
     /**
@@ -110,11 +112,9 @@ class LogarithmicTransform1D extends Abs
      * {@link LinearTransform1D} and {@link ExponentialTransform1D}.
      *
      * @param  other The math transform to apply.
-     * @param  applyOtherFirst {@code true} if the transformation order is {@code other}
-     *         followed by {@code this}, or {@code false} if the transformation order is
-     *         {@code this} followed by {@code other}.
-     * @return The combined math transform, or {@code null} if no optimized combined
-     *         transform is available.
+     * @param  applyOtherFirst {@code true} if the transformation order is {@code other} followed by {@code this},
+     *         or {@code false} if the transformation order is {@code this} followed by {@code other}.
+     * @return The combined math transform, or {@code null} if no optimized combined transform is available.
      */
     @Override
     final MathTransform concatenate(final MathTransform other, final boolean applyOtherFirst) {
@@ -122,12 +122,12 @@ class LogarithmicTransform1D extends Abs
             final LinearTransform1D linear = (LinearTransform1D) other;
             if (applyOtherFirst) {
                 if (linear.offset == 0 && linear.scale > 0) {
-                    return create(getBase(), Math.log(linear.scale) / getLogBase() + getOffset());
+                    return create(base(), transform(linear.scale));
                 }
             } else {
-                final double newBase = Math.pow(getBase(), 1 / linear.scale);
+                final double newBase = pow(1 / linear.scale);
                 if (!Double.isNaN(newBase)) {
-                    return create(newBase, linear.scale * getOffset() + linear.offset);
+                    return create(newBase, linear.transform(offset()));
                 }
             }
         } else if (other instanceof ExponentialTransform1D) {
@@ -151,22 +151,22 @@ class LogarithmicTransform1D extends Abs
     /**
      * Returns the base of this logarithmic function.
      */
-    double getBase() {
+    double base() {
         return Math.E;
     }
 
     /**
      * Returns the natural logarithm of the base of this logarithmic function.
-     * More specifically, returns <code>{@linkplain Math#log(double) Math.log}({@linkplain #getBase()})</code>.
+     * More specifically, returns <code>{@linkplain Math#log(double) Math.log}({@link #base()})</code>.
      */
-    double getLogBase() {
+    double lnBase() {
         return 1;
     }
 
     /**
      * Returns the offset applied after this logarithmic function.
      */
-    double getOffset() {
+    double offset() {
         return 0;
     }
 
@@ -179,7 +179,17 @@ class LogarithmicTransform1D extends Abs
     }
 
     /**
-     * Returns the logarithm of the given value in the base given to this transform constructor.
+     * Returns the base of this logarithmic transform raised to the given power.
+     *
+     * @param value The power to raise the base.
+     * @return The base of this transform raised to the given power.
+     */
+    double pow(final double value) {
+        return Math.exp(value);
+    }
+
+    /**
+     * Returns the logarithm of the given value in the base of this logarithmic transform.
      * This method is similar to {@link #transform(double)} except that the offset is not added.
      *
      * @param  value The value for which to compute the log.
@@ -300,19 +310,19 @@ class LogarithmicTransform1D extends Abs
 
         /** {@inheritDoc} */
         @Override
-        double getBase() {
+        double base() {
             return 10;
         }
 
         /** {@inheritDoc} */
         @Override
-        double getLogBase() {
+        double lnBase() {
             return LOG_10;
         }
 
         /** {@inheritDoc} */
         @Override
-        double getOffset() {
+        double offset() {
             return offset;
         }
 
@@ -324,6 +334,12 @@ class LogarithmicTransform1D extends Abs
 
         /** {@inheritDoc} */
         @Override
+        double pow(final double value) {
+            return MathFunctions.pow10(value);
+        }
+
+        /** {@inheritDoc} */
+        @Override
         double log(final double value) {
             return Math.log10(value);
         }
@@ -345,7 +361,7 @@ class LogarithmicTransform1D extends Abs
                 srcOff += numPts;
                 dstOff += numPts;
                 while (--numPts >= 0) {
-                    dstPts[--dstOff] = Math.log10(srcPts[srcOff++]) + offset;
+                    dstPts[--dstOff] = Math.log10(srcPts[--srcOff]) + offset;
                 }
             }
         }
@@ -361,7 +377,7 @@ class LogarithmicTransform1D extends Abs
                 srcOff += numPts;
                 dstOff += numPts;
                 while (--numPts >= 0) {
-                    dstPts[--dstOff] = (float) (Math.log10(srcPts[srcOff++]) + offset);
+                    dstPts[--dstOff] = (float) (Math.log10(srcPts[--srcOff]) + offset);
                 }
             }
         }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -246,8 +246,8 @@ public class TransferFunction implements
         } else if (function instanceof LogarithmicTransform1D) {
             final LogarithmicTransform1D f = (LogarithmicTransform1D) function;
             type   = TransferFunctionType.LOGARITHMIC;
-            base   = f.getBase();
-            offset = f.getOffset();
+            base   = f.base();
+            offset = f.offset();
             scale  = 1;
         } else {
             /*

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/EnvelopesTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/EnvelopesTest.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/EnvelopesTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/EnvelopesTest.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -34,8 +34,17 @@ import static org.opengis.test.Validator
  * @version 0.3
  * @module
  */
-@DependsOn(GeneralEnvelopeTest.class)
+@DependsOn({
+    GeneralEnvelopeTest.class,
+    CurveExtremumTest.class
+})
 public final strictfp class EnvelopesTest extends TestCase {
+
+    /*
+     * Tests of the 'transform' methods are not yet ported because they need more MathTransform
+     * implementations. Those tests will be ported in a future Apache SIS version.
+     */
+
     /**
      * Tests {@link Envelopes#fromWKT(CharSequence)}. This test is provided as a matter of principle,
      * but the real test is done by {@link GeneralEnvelopeTest#testWktParsing()}.

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -40,7 +40,7 @@ import static org.apache.sis.geometry.Ab
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Johann Sorel (Geomatys)
  * @since   0.3 (derived from geotk-2.4)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 @DependsOn(AbstractEnvelopeTest.class)
@@ -527,6 +527,18 @@ public strictfp class GeneralEnvelopeTes
     }
 
     /**
+     * Tests {@link GeneralEnvelope#translate(double...)}.
+     *
+     * @since 0.5
+     */
+    @Test
+    public void testTranslate() {
+        final GeneralEnvelope envelope = new GeneralEnvelope(new double[] {4, 5}, new double[] {8, 7});
+        envelope.translate(2, -4);
+        assertEnvelopeEquals(envelope, 6, 1, 10, 3);
+    }
+
+    /**
      * Tests the {@link GeneralEnvelope#toString()} method.
      */
     @Test

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -33,7 +33,7 @@ import static org.opengis.referencing.cs
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4 (derived from geotk-3.00)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 public final strictfp class AxisDirectionsTest extends TestCase {
@@ -333,4 +333,28 @@ public final strictfp class AxisDirectio
         assertEquals(1, AxisDirections.indexOfColinear(HardCodedCS.GEODETIC_3D, AxisDirection.NORTH));
         assertEquals(1, AxisDirections.indexOfColinear(HardCodedCS.GEODETIC_3D, AxisDirection.SOUTH));
     }
+
+    /**
+     * Tests {@link AxisDirections#indexOfColinear(CoordinateSystem, CoordinateSystem)}.
+     *
+     * @since 0.5
+     */
+    @Test
+    public void testIndexOfColinearCS() {
+        assertEquals(0, AxisDirections.indexOfColinear(
+                HardCodedCS.GEODETIC_3D,
+                HardCodedCS.GEODETIC_2D));
+
+        assertEquals(2, AxisDirections.indexOfColinear(
+                HardCodedCS.GEODETIC_3D,
+                HardCodedCS.ELLIPSOIDAL_HEIGHT));
+
+        assertEquals(2, AxisDirections.indexOfColinear(
+                HardCodedCS.GEODETIC_3D,
+                HardCodedCS.DEPTH));
+
+        assertEquals(-1, AxisDirections.indexOfColinear(
+                HardCodedCS.GEODETIC_3D,
+                HardCodedCS.DAYS));
+    }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/FormulasTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/FormulasTest.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/FormulasTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/FormulasTest.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -27,7 +27,7 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.5
  * @module
  */
 public final strictfp class FormulasTest extends TestCase {
@@ -40,6 +40,18 @@ public final strictfp class FormulasTest
     }
 
     /**
+     * Tests {@link Formulas#pow3(int)}.
+     *
+     * @since 0.5
+     */
+    @Test
+    public void testPow3() {
+        for (int n=0; n<=8; n++) {
+            assertEquals((int) Math.round(Math.pow(3, n)), Formulas.pow3(n));
+        }
+    }
+
+    /**
      * Tests {@link Formulas#isPoleToPole(double, double)}.
      */
     @Test

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -17,8 +17,10 @@
 package org.apache.sis.referencing;
 
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.crs.GeodeticCRS;
 import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.util.FactoryException;
+import org.apache.sis.referencing.crs.DefaultCompoundCRS;
 import org.apache.sis.referencing.crs.HardCodedCRS;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
@@ -33,7 +35,7 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn({
@@ -41,6 +43,11 @@ import static org.apache.sis.test.Assert
 })
 public final strictfp class CRSTest extends TestCase {
     /**
+     * Tolerance threshold for strict floating point comparisons.
+     */
+    private static final double STRICT = 0;
+
+    /**
      * Asserts that the result of {@link CRS#forCode(String)} is the given CRS.
      */
     private static void verifyForCode(final SingleCRS expected, final String code) throws FactoryException {
@@ -153,4 +160,83 @@ public final strictfp class CRSTest exte
         assertSame(HardCodedCRS.TIME, CRS.getTemporalComponent(HardCodedCRS.TIME));
         assertSame(HardCodedCRS.TIME, CRS.getTemporalComponent(HardCodedCRS.GEOID_4D));
     }
+
+    /**
+     * Tests {@link CRS#getComponentAt(CoordinateReferenceSystem, int, int)}.
+     *
+     * @since 0.5
+     */
+    @Test
+    public void testGetComponentAt() {
+        testGetComponentAt(
+                null, // Null because our CRS has no component for the 'x' axis alone.
+                null, // Null because our CRS has no component for the 'y' axis alone.
+                HardCodedCRS.GRAVITY_RELATED_HEIGHT,
+                HardCodedCRS.TIME,
+                HardCodedCRS.WGS84,
+                null, // Null because our CRS has no (x,y,z) component.
+                HardCodedCRS.GEOID_4D);
+        /*
+         * The above tests was for the standard (x,y,z,t) flat view.
+         * Now test again, but with a more hierarchical structure: ((x,y,z),t)
+         */
+        testGetComponentAt(
+                null, // Null because our CRS has no component for the 'x' axis alone.
+                null, // Null because our CRS has no component for the 'y' axis alone.
+                HardCodedCRS.GRAVITY_RELATED_HEIGHT,
+                HardCodedCRS.TIME,
+                HardCodedCRS.WGS84,
+                HardCodedCRS.GEOID_3D,
+                new DefaultCompoundCRS(IdentifiedObjects.getProperties(HardCodedCRS.GEOID_4D),
+                        HardCodedCRS.GEOID_3D, HardCodedCRS.TIME));
+    }
+
+    /**
+     * Tests {@link CRS#getComponentAt(CoordinateReferenceSystem, int, int)} on a (x,y,z,t)
+     * coordinate reference system having 4 dimensions. All arguments given to this method
+     * except the last one are the expected components, which may be {@code null}.
+     */
+    private static void testGetComponentAt(
+            final CoordinateReferenceSystem x,
+            final CoordinateReferenceSystem y,
+            final CoordinateReferenceSystem z,
+            final CoordinateReferenceSystem t,
+            final CoordinateReferenceSystem xy,
+            final CoordinateReferenceSystem xyz,
+            final CoordinateReferenceSystem xyzt)
+    {
+        assertSame("[0…4]", xyzt, CRS.getComponentAt(xyzt, 0, 4));
+        assertSame("[0…3]", xyz,  CRS.getComponentAt(xyzt, 0, 3));
+        assertSame("[0…2]", xy,   CRS.getComponentAt(xyzt, 0, 2));
+        assertSame("[0…1]", x,    CRS.getComponentAt(xyzt, 0, 1));
+        assertSame("[1…2]", y,    CRS.getComponentAt(xyzt, 1, 2));
+        assertSame("[2…3]", z,    CRS.getComponentAt(xyzt, 2, 3));
+        assertSame("[3…4]", t,    CRS.getComponentAt(xyzt, 3, 4));
+        assertNull("[1…3]",       CRS.getComponentAt(xyzt, 1, 3));
+        assertNull("[1…4]",       CRS.getComponentAt(xyzt, 1, 4));
+        assertNull("[2…4]",       CRS.getComponentAt(xyzt, 2, 4));
+        assertNull("[4…4]",       CRS.getComponentAt(xyzt, 4, 4));
+
+        if (xyz != null) {
+            assertSame("[0…3]", xyz, CRS.getComponentAt(xyz, 0, 3));
+            assertSame("[0…2]", xy,  CRS.getComponentAt(xyz, 0, 2));
+            assertSame("[0…1]", x,   CRS.getComponentAt(xyz, 0, 1));
+            assertSame("[1…2]", y,   CRS.getComponentAt(xyz, 1, 2));
+            assertSame("[2…3]", z,   CRS.getComponentAt(xyz, 2, 3));
+        }
+        if (xy != null) {
+            assertSame("[0…2]", xy, CRS.getComponentAt(xy, 0, 2));
+            assertSame("[0…1]", x,  CRS.getComponentAt(xy, 0, 1));
+            assertSame("[1…2]", y,  CRS.getComponentAt(xy, 1, 2));
+        }
+    }
+
+    /**
+     * Tests {@link CRS#getGreenwichLongitude(GeodeticCRS)}.
+     */
+    @Test
+    public void testGetGreenwichLongitude() {
+        assertEquals(0,          CRS.getGreenwichLongitude(HardCodedCRS.WGS84), STRICT);
+        assertEquals(2.33722917, CRS.getGreenwichLongitude(HardCodedCRS.NTF),   1E-12);
+    }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -33,16 +33,16 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn(org.apache.sis.referencing.cs.AbstractCSTest.class)
 public final strictfp class AbstractCRSTest extends TestCase {
     /**
-     * Tests {@link AbstractCRS#forConvention(AxesConvention)}.
+     * Tests {@link AbstractCRS#forConvention(AxesConvention)} with {@link AxesConvention#RIGHT_HANDED}.
      */
     @Test
-    public void testForConvention() {
+    public void testForRightHandedConvention() {
         final AbstractCRS toTest, expected, actual;
         toTest   =  new AbstractCRS(singletonMap(NAME_KEY, "My CRS"),
                     new AbstractCS (singletonMap(NAME_KEY, "My strange CS"),
@@ -54,8 +54,10 @@ public final strictfp class AbstractCRST
 
         assertEquals("forConvention(RIGHT_HANDED)", expected, actual);
         assertSame(actual,   toTest  .forConvention(AxesConvention.RIGHT_HANDED));
+        assertSame(actual,   toTest  .forConvention(AxesConvention.CONVENTIONALLY_ORIENTED));
         assertSame(actual,   toTest  .forConvention(AxesConvention.NORMALIZED));
         assertSame(expected, expected.forConvention(AxesConvention.RIGHT_HANDED));
+        assertSame(expected, expected.forConvention(AxesConvention.CONVENTIONALLY_ORIENTED));
         assertSame(expected, expected.forConvention(AxesConvention.NORMALIZED));
     }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java?rev=1651674&r1=1651673&r2=1651674&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] Wed Jan 14 14:01:44 2015
@@ -38,7 +38,7 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4 (derived from geotk-3.20)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn({
@@ -75,12 +75,12 @@ public final strictfp class DefaultGeogr
 
     /**
      * Tests the {@link DefaultGeographicCRS#forConvention(AxesConvention)} method
-     * for {@link AxesConvention#NORMALIZED}.
+     * for {@link AxesConvention#CONVENTIONALLY_ORIENTED}.
      */
     @Test
-    public void testNormalize() {
+    public void testConventionalOrientation() {
         final DefaultGeographicCRS crs = DefaultGeographicCRS.castOrCopy(CommonCRS.WGS84.geographic3D());
-        final DefaultGeographicCRS normalized = crs.forConvention(AxesConvention.NORMALIZED);
+        final DefaultGeographicCRS normalized = crs.forConvention(AxesConvention.CONVENTIONALLY_ORIENTED);
         assertNotSame(crs, normalized);
         final EllipsoidalCS cs = normalized.getCoordinateSystem();
         final EllipsoidalCS ref = crs.getCoordinateSystem();



Mime
View raw message