You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2014/01/15 23:05:01 UTC
svn commit: r1558587 [3/3] - in /sis/trunk: ./
core/sis-referencing/src/main/java/org/apache/sis/geometry/
core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/
core/sis-referencing/src/main/java/org/apache/sis/referencing/ core/sis-r...
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -21,13 +21,14 @@ import org.opengis.referencing.operation
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystem;
import org.apache.sis.referencing.operation.matrix.Matrices;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.measure.Angle;
+import org.apache.sis.measure.ElevationAngle;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static java.lang.StrictMath.*;
+import static java.lang.Double.NaN;
import static java.util.Collections.singletonMap;
import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
import static org.apache.sis.referencing.cs.CoordinateSystems.*;
@@ -42,12 +43,15 @@ import static org.apache.sis.test.Assert
* @version 0.4
* @module
*/
-@DependsOn(DirectionAlongMeridianTest.class)
+@DependsOn({
+ org.apache.sis.internal.referencing.AxisDirectionsTest.class,
+ DirectionAlongMeridianTest.class
+})
public final strictfp class CoordinateSystemsTest extends TestCase {
/**
* Tolerance threshold for strict floating point comparisons.
*/
- static final double STRICT = 0;
+ private static final double STRICT = 0;
/**
* Tests {@link CoordinateSystems#parseAxisDirection(String)}.
@@ -72,63 +76,33 @@ public final strictfp class CoordinateSy
}
/**
- * Tests the {@link CoordinateSystems#getCompassAngle(AxisDirection, AxisDirection)} method.
- */
- @Test
- public void testGetCompassAngle() {
- final AxisDirection[] compass = new AxisDirection[] {
- AxisDirection.NORTH,
- AxisDirection.NORTH_NORTH_EAST,
- AxisDirection.NORTH_EAST,
- AxisDirection.EAST_NORTH_EAST,
- AxisDirection.EAST,
- AxisDirection.EAST_SOUTH_EAST,
- AxisDirection.SOUTH_EAST,
- AxisDirection.SOUTH_SOUTH_EAST,
- AxisDirection.SOUTH,
- AxisDirection.SOUTH_SOUTH_WEST,
- AxisDirection.SOUTH_WEST,
- AxisDirection.WEST_SOUTH_WEST,
- AxisDirection.WEST,
- AxisDirection.WEST_NORTH_WEST,
- AxisDirection.NORTH_WEST,
- AxisDirection.NORTH_NORTH_WEST
- };
- assertEquals(compass.length, COMPASS_DIRECTION_COUNT);
- final int base = AxisDirection.NORTH.ordinal();
- final int h = compass.length / 2;
- for (int i=0; i<compass.length; i++) {
- final AxisDirection direction = compass[i];
- final AxisDirection opposite = AxisDirections.opposite(direction);
- final String message = direction.name();
- int io = i+h, in = i;
- if (i >= h) io -= COMPASS_DIRECTION_COUNT;
- if (i > h) in -= COMPASS_DIRECTION_COUNT;
- assertEquals(message, base + i, direction.ordinal());
- assertEquals(message, base + io, opposite.ordinal());
- assertEquals(message, 0, getCompassAngle(direction, direction));
- assertEquals(message, h, abs(getCompassAngle(direction, opposite)));
- assertEquals(message, in, getCompassAngle(direction, AxisDirection.NORTH));
- }
- }
-
- /**
* Tests {@link CoordinateSystems#angle(AxisDirection, AxisDirection)}.
*/
@Test
- @DependsOnMethod("testGetCompassAngle")
public void testAngle() {
- assertEquals( 0, angle(AxisDirection.EAST, AxisDirection.EAST), STRICT);
- assertEquals( +90, angle(AxisDirection.EAST, AxisDirection.NORTH), STRICT);
- assertEquals( -90, angle(AxisDirection.NORTH, AxisDirection.EAST), STRICT);
- assertEquals( +90, angle(AxisDirection.WEST, AxisDirection.SOUTH), STRICT);
- assertEquals( -90, angle(AxisDirection.SOUTH, AxisDirection.WEST), STRICT);
- assertEquals( -180, angle(AxisDirection.NORTH, AxisDirection.SOUTH), STRICT);
- assertEquals( 180, angle(AxisDirection.SOUTH, AxisDirection.NORTH), STRICT);
- assertEquals( 45, angle(AxisDirection.NORTH_EAST, AxisDirection.NORTH), STRICT);
- assertEquals( 22.5, angle(AxisDirection.NORTH_NORTH_EAST, AxisDirection.NORTH), STRICT);
- assertEquals(-22.5, angle(AxisDirection.NORTH_NORTH_WEST, AxisDirection.NORTH), STRICT);
- assertEquals( 45, angle(AxisDirection.SOUTH, AxisDirection.SOUTH_EAST), STRICT);
+ assertAngleEquals(false, 0, AxisDirection.EAST, AxisDirection.EAST);
+ assertAngleEquals(false, 90, AxisDirection.EAST, AxisDirection.NORTH);
+ assertAngleEquals(false, 90, AxisDirection.WEST, AxisDirection.SOUTH);
+ assertAngleEquals(false, 180, AxisDirection.SOUTH, AxisDirection.NORTH);
+ assertAngleEquals(false, 180, AxisDirection.WEST, AxisDirection.EAST);
+ assertAngleEquals(false, 45, AxisDirection.NORTH_EAST, AxisDirection.NORTH);
+ assertAngleEquals(false, 22.5, AxisDirection.NORTH_NORTH_EAST, AxisDirection.NORTH);
+ assertAngleEquals(false, 45, AxisDirection.SOUTH, AxisDirection.SOUTH_EAST);
+ assertAngleEquals(false, NaN, AxisDirection.NORTH, AxisDirection.FUTURE);
+ assertAngleEquals(true, 90, AxisDirection.SOUTH, AxisDirection.UP);
+ assertAngleEquals(true, -90, AxisDirection.SOUTH, AxisDirection.DOWN);
+ assertAngleEquals(false, 0, AxisDirection.UP, AxisDirection.UP);
+ assertAngleEquals(false, 0, AxisDirection.DOWN, AxisDirection.DOWN);
+ assertAngleEquals(false, 180, AxisDirection.DOWN, AxisDirection.UP);
+ assertAngleEquals(false, NaN, AxisDirection.DOWN, AxisDirection.FUTURE);
+ assertAngleEquals(false, 180, AxisDirection.DISPLAY_DOWN, AxisDirection.DISPLAY_UP);
+ assertAngleEquals(false, -90, AxisDirection.DISPLAY_RIGHT, AxisDirection.DISPLAY_DOWN);
+ assertAngleEquals(false, NaN, AxisDirection.DISPLAY_UP, AxisDirection.DOWN);
+ assertAngleEquals(false, NaN, AxisDirection.PAST, AxisDirection.FUTURE); // Not spatial directions.
+ assertAngleEquals(false, 90, AxisDirection.GEOCENTRIC_X, AxisDirection.GEOCENTRIC_Y);
+ assertAngleEquals(false, 90, AxisDirection.GEOCENTRIC_Y, AxisDirection.GEOCENTRIC_Z);
+ assertAngleEquals(false, 0, AxisDirection.GEOCENTRIC_Y, AxisDirection.GEOCENTRIC_Y);
+ assertAngleEquals(false, NaN, AxisDirection.GEOCENTRIC_Z, AxisDirection.UP);
}
/**
@@ -137,28 +111,50 @@ public final strictfp class CoordinateSy
@Test
@DependsOnMethod({"testParseAxisDirection", "testAngle"})
public void testAngleAlongMeridians() {
- compareAngle( 90.0, "West", "South");
- compareAngle(-90.0, "South", "West");
- compareAngle( 45.0, "South", "South-East");
- compareAngle(-22.5, "North-North-West", "North");
- compareAngle(-22.5, "North_North_West", "North");
- compareAngle(-22.5, "North North West", "North");
- compareAngle( 90.0, "North along 90 deg East", "North along 0 deg");
- compareAngle( 90.0, "South along 180 deg", "South along 90 deg West");
- compareAngle( 90, "North along 90°E", "North along 0°");
- compareAngle( 135, "North along 90°E", "North along 45°W");
- compareAngle( -135, "North along 45°W", "North along 90°E");
+ assertAngleEquals(false, 90.0, "West", "South");
+ assertAngleEquals(false, -90.0, "South", "West");
+ assertAngleEquals(false, 45.0, "South", "South-East");
+ assertAngleEquals(true, 90.0, "West", "Up");
+ assertAngleEquals(true, -90.0, "West", "Down");
+ assertAngleEquals(false, -22.5, "North-North-West", "North");
+ assertAngleEquals(false, -22.5, "North_North_West", "North");
+ assertAngleEquals(false, -22.5, "North North West", "North");
+ assertAngleEquals(false, 90.0, "North along 90 deg East", "North along 0 deg");
+ assertAngleEquals(false, 90.0, "South along 180 deg", "South along 90 deg West");
+ assertAngleEquals(false, 90.0, "North along 90°E", "North along 0°");
+ assertAngleEquals(false, 135.0, "North along 90°E", "North along 45°W");
+ assertAngleEquals(false, -135.0, "North along 45°W", "North along 90°E");
+ assertAngleEquals(true, 90.0, "North along 45°W", "Up");
+ assertAngleEquals(true, -90.0, "North along 45°W", "Down");
}
/**
- * Compare the angle between the specified directions.
- */
- private static void compareAngle(final double expected, final String source, final String target) {
+ * Asserts that the angle between the parsed directions is equals to the given value.
+ * This method tests also the angle by interchanging the axis directions.
+ */
+ private static void assertAngleEquals(final boolean isElevation, final double expected,
+ final String source, final String target)
+ {
final AxisDirection dir1 = parseAxisDirection(source);
final AxisDirection dir2 = parseAxisDirection(target);
assertNotNull(source, dir1);
assertNotNull(target, dir2);
- assertEquals(expected, angle(dir1, dir2), STRICT);
+ assertAngleEquals(isElevation, expected, dir1, dir2);
+ }
+
+ /**
+ * Asserts that the angle between the given directions is equals to the given value.
+ * This method tests also the angle by interchanging the given directions.
+ */
+ private static void assertAngleEquals(final boolean isElevation, final double expected,
+ final AxisDirection source, final AxisDirection target)
+ {
+ final Angle forward = angle(source, target);
+ final Angle inverse = angle(target, source);
+ assertEquals(isElevation, forward instanceof ElevationAngle);
+ assertEquals(isElevation, inverse instanceof ElevationAngle);
+ assertEquals(+expected, (forward != null) ? forward.degrees() : Double.NaN, STRICT);
+ assertEquals(-expected, (inverse != null) ? inverse.degrees() : Double.NaN, STRICT);
}
/**
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -38,7 +38,7 @@ import static org.apache.sis.test.TestUt
* @version 0.4
* @module
*/
-@DependsOn(DefaultCoordinateSystemAxisTest.class)
+@DependsOn(AbstractCSTest.class)
public final strictfp class DefaultCartesianCSTest extends XMLTestCase {
/**
* An XML file in this package containing a Cartesian coordinate system definition.
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -36,7 +36,7 @@ import static org.apache.sis.test.TestUt
* @version 0.4
* @module
*/
-@DependsOn(DefaultCoordinateSystemAxisTest.class)
+@DependsOn(AbstractCSTest.class)
public final strictfp class DefaultEllipsoidalCSTest extends XMLTestCase {
/**
* An XML file in this package containing an ellipsoidal coordinate system definition.
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -35,9 +35,9 @@ import static org.junit.Assert.*;
@DependsOn(org.apache.sis.internal.referencing.AxisDirectionsTest.class)
public final strictfp class DirectionAlongMeridianTest extends TestCase {
/**
- * For floating point comparisons.
+ * Tolerance threshold for strict floating point comparisons.
*/
- private static final double EPS = 1E-10;
+ private static final double STRICT = 0;
/**
* Tests the {@link DirectionAlongMeridian#parse(AxisDirection)} method.
@@ -99,8 +99,8 @@ public final strictfp class DirectionAlo
private static void assertOrdered(final String dir1, final String dir2) {
final DirectionAlongMeridian m1 = DirectionAlongMeridian.parse(dir1);
final DirectionAlongMeridian m2 = DirectionAlongMeridian.parse(dir2);
- assertEquals(+90, m1.getAngle(m2), EPS);
- assertEquals(-90, m2.getAngle(m1), EPS);
+ assertEquals(+90, m1.angle(m2), STRICT);
+ assertEquals(-90, m2.angle(m1), STRICT);
assertEquals( -1, m1.compareTo(m2));
assertEquals( +1, m2.compareTo(m1));
assertFalse (m1.equals(m2));
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -63,12 +63,17 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.datum.DefaultGeodeticDatumTest.class,
org.apache.sis.referencing.cs.DirectionAlongMeridianTest.class,
org.apache.sis.referencing.cs.DefaultCoordinateSystemAxisTest.class,
+ org.apache.sis.referencing.cs.NormalizerTest.class,
+ org.apache.sis.referencing.cs.AbstractCSTest.class,
org.apache.sis.referencing.cs.DefaultCartesianCSTest.class,
org.apache.sis.referencing.cs.DefaultEllipsoidalCSTest.class,
+ org.apache.sis.referencing.cs.DefaultCompoundCSTest.class,
org.apache.sis.referencing.cs.CoordinateSystemsTest.class,
+ org.apache.sis.referencing.crs.AbstractCRSTest.class,
org.apache.sis.referencing.crs.DefaultGeodeticCRSTest.class,
org.apache.sis.referencing.StandardDefinitionsTest.class,
org.apache.sis.referencing.GeodeticObjectsTest.class,
+ org.apache.sis.referencing.CRSTest.class,
org.apache.sis.geometry.AbstractDirectPositionTest.class,
org.apache.sis.geometry.GeneralDirectPositionTest.class,
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/UnmodifiableArrayList.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/UnmodifiableArrayList.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/UnmodifiableArrayList.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/UnmodifiableArrayList.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -18,6 +18,8 @@ package org.apache.sis.internal.util;
import java.io.Serializable;
import java.util.AbstractList;
+import java.util.Arrays;
+import java.lang.reflect.Array;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.collection.CheckedContainer;
@@ -69,7 +71,7 @@ public class UnmodifiableArrayList<E> ex
/**
* The wrapped array.
*/
- private final E[] array;
+ final E[] array;
/**
* Creates a new instance wrapping the given array. A direct reference to the given array is
@@ -167,6 +169,8 @@ public class UnmodifiableArrayList<E> ex
/**
* Returns the list size.
+ *
+ * @return The size of this list.
*/
@Override
public int size() {
@@ -192,6 +196,9 @@ public class UnmodifiableArrayList<E> ex
/**
* Returns the element at the specified index.
+ *
+ * @param index The index of the element to get.
+ * @return The element at the given index.
*/
@Override
public E get(final int index) {
@@ -355,11 +362,21 @@ public class UnmodifiableArrayList<E> ex
ArgumentChecks.ensureValidIndex(size, index);
return super.get(index + lower);
}
+
+ /**
+ * Returns a copy of the backing array section viewed by this sublist.
+ */
+ @Override
+ public E[] toArray() {
+ return Arrays.copyOfRange(array, lower, lower + size);
+ }
}
/**
* Returns a copy of the backing array. Note that the array type is {@code E[]} rather than {@code Object[]}.
* This is not what {@code ArrayList} does, but is not forbidden by {@link List#toArray()} javadoc neither.
+ *
+ * @return A copy of the wrapped array.
*/
@Override
public E[] toArray() {
@@ -367,6 +384,35 @@ public class UnmodifiableArrayList<E> ex
}
/**
+ * Copies the backing array in the given one if the list fits in the given array.
+ * If the list does not fit in the given array, returns the collection in a new array.
+ *
+ * @param <T> The type of array element.
+ * @param dest The array where to copy the elements if the list can fits in the array.
+ * @return The given array, or a newly created array if this list is larger than the given array.
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T[] toArray(T[] dest) {
+ final int size = size();
+ if (dest.length != size) {
+ if (dest.length < size) {
+ /*
+ * We are cheating here since the array component may not be assignable to T.
+ * But if this assumption is wrong, then the call to System.arraycopy(…) later
+ * will thrown an ArrayStoreException, which is the exception type required by
+ * the Collection.toArray(T[]) javadoc.
+ */
+ dest = (T[]) Array.newInstance(dest.getClass().getComponentType(), size);
+ } else {
+ dest[size] = null; // Required by Collection.toArray(T[]) javadoc.
+ }
+ }
+ System.arraycopy(array, lower(), dest, 0, size);
+ return dest;
+ }
+
+ /**
* Compares this list with the given object for equality.
*
* @param object The object to compare with this list.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -30,9 +30,20 @@ import static org.apache.sis.math.MathFu
/**
- * An angle in decimal degrees. An angle is the amount of rotation needed to bring one line or
- * plane into coincidence with another, generally measured in degrees, sexagesimal degrees or
- * grads.
+ * An angle in decimal degrees. An angle is the amount of rotation needed to bring one line or plane
+ * into coincidence with another. Various kind of angles are used in geographic information systems,
+ * some of them having a specialized class in Apache SIS:
+ *
+ * <ul>
+ * <li>{@linkplain Latitude} is an angle ranging from 0° at the equator to 90° at the poles.</li>
+ * <li>{@linkplain Longitude} is an angle measured east-west from a prime meridian (usually Greenwich, but not necessarily).</li>
+ * <li><cite>Azimuth</cite> is a direction given by an angle between 0° and 360° measured clockwise from North.</li>
+ * <li><cite>Bearing</cite> is a direction given by an angle between 0° and 90° in a quadrant defined by a cardinal direction.</li>
+ * <li><cite>Bearing</cite> is also sometime used in navigation for an angle relative to the vessel forward direction.</li>
+ * <li><cite>Deflection angle</cite> is the angle between a line and the prolongation of a preceding line.</li>
+ * <li><cite>Interior angle</cite> is an angle measured between two lines of sight.</li>
+ * <li>{@linkplain ElevationAngle Elevation angle} is the angular height from the horizontal plane to an object above the horizon.</li>
+ * </ul>
*
* {@section Formatting angles}
* The recommended way to format angles is to instantiate an {@link AngleFormat} once, then to
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -195,7 +195,7 @@ public class AngleFormat extends Format
private static final int[] SYMBOLS = {'D', 'M', 'S', '#', '?'};
/**
- * Defines constants that are used as attribute keys in the iterator returned from
+ * Constants that are used as attribute keys in the iterator returned from
* {@link AngleFormat#formatToCharacterIterator(Object)}.
*
* @author Martin Desruisseaux (Geomatys)
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -20,6 +20,27 @@ package org.apache.sis.measure;
/**
* A latitude angle in decimal degrees.
* Positive latitudes are North, while negative latitudes are South.
+ * The latitude symbol is the Greek lower-case letter phi (φ).
+ *
+ * <p>Because the Earth is not a perfect sphere, there is small differences in the latitude values of a point
+ * depending on how the latitude is defined:</p>
+ *
+ * <ul>
+ * <li><cite>Geodetic latitude</cite> is the angle between the equatorial plane and a line perpendicular
+ * to the {@linkplain org.apache.sis.referencing.datum.DefaultEllipsoid ellipsoid} surface.</li>
+ * <li><cite>Geocentric latitude</cite> is the angle between the equatorial plane and a line going from
+ * the Earth center. It differs from geodetic latitude by less than 11 angular minutes.</li>
+ * <li><cite>Astronomical latitude</cite> is the angle between the equatorial plane and a line given
+ * by the direction of a plumb line (the "true vertical").</li>
+ * <li>Above list is not exhaustive. There is also <cite>geomagnetic latitude</cite>, <i>etc.</i></li>
+ * </ul>
+ *
+ * The kind of latitude is unspecified by this {@code Latitude} class, and rather depends on the context:
+ * the latitude is <cite>geodetic</cite> if the coordinate reference system is
+ * {@linkplain org.apache.sis.referencing.crs.DefaultGeographicCRS geographic},
+ * or <cite>geocentric</cite> if the coordinate reference system is
+ * {@linkplain org.apache.sis.referencing.crs.DefaultGeocentricCRS geocentric}.
+ * If the context is unknown, then geodetic latitude can usually be assumed.
*
* {@section Immutability and thread safety}
* This final class is immutable and thus inherently thread-safe.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -20,6 +20,12 @@ package org.apache.sis.measure;
/**
* A longitude angle in decimal degrees.
* Positive longitudes are East, while negative longitudes are West.
+ * The longitude symbol is the Greek lower-case letter lambda (λ).
+ *
+ * <p>Longitudes are not necessarily relative to the Greenwich meridian. The
+ * {@linkplain org.apache.sis.referencing.datum.DefaultPrimeMeridian prime meridian}
+ * depends on the context, typically specified through the geodetic datum of a
+ * {@linkplain org.apache.sis.referencing.crs.DefaultGeographicCRS geographic CRS}.</p>
*
* {@section Immutability and thread safety}
* This final class is immutable and thus inherently thread-safe.
@@ -74,7 +80,7 @@ public final class Longitude extends Ang
*
* @param string A string to be converted to a {@code Longitude}.
* @throws NumberFormatException if the string does not contain a parsable angle,
- * or represents a latitude angle.
+ * or represents a longitude angle.
*
* @see AngleFormat#parse(String)
*/
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -123,7 +123,7 @@ public class RangeFormat extends Format
private static final int UNIT_FIELD = 2;
/**
- * Defines constants that are used as attribute keys in the iterator returned from
+ * Constants that are used as attribute keys in the iterator returned from
* {@link RangeFormat#formatToCharacterIterator(Object)}.
*
* @author Martin Desruisseaux (Geomatys)
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -371,6 +371,11 @@ public final class Errors extends Indexe
public static final short MismatchedMatrixSize_4 = 60;
/**
+ * No authority was specified for code “{0}”. The expected syntax is “AUTHORITY:CODE”.
+ */
+ public static final short MissingAuthority_1 = 135;
+
+ /**
* This operation requires the “{0}” module.
*/
public static final short MissingRequiredModule_1 = 61;
@@ -416,6 +421,11 @@ public final class Errors extends Indexe
public static final short NoConvergenceForPoints_2 = 69;
/**
+ * No code “{2}” from authority “{0}” found for object of type ‘{1}’.
+ */
+ public static final short NoSuchAuthorityCode_3 = 137;
+
+ /**
* Element “{0}” has not been found.
*/
public static final short NoSuchElement_1 = 70;
@@ -631,6 +641,11 @@ public final class Errors extends Indexe
public static final short UnexpectedFileFormat_2 = 111;
/**
+ * Authority “{0}” is unknown.
+ */
+ public static final short UnknownAuthority_1 = 136;
+
+ /**
* Axis direction “{0}” is unknown.
*/
public static final short UnknownAxisDirection_1 = 112;
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Wed Jan 15 22:04:59 2014
@@ -85,6 +85,7 @@ MismatchedCRS = The
MismatchedDimension_2 = Mismatched object dimensions: {0}D and {1}D.
MismatchedDimension_3 = Argument \u2018{0}\u2019 has {2} dimension{2,choice,1#|2#s}, while {1} was expected.
MismatchedMatrixSize_4 = Mismatched matrix sizes: expected {0}\u00d7{1} but got {2}\u00d7{3}.
+MissingAuthority_1 = No authority was specified for code \u201c{0}\u201d. The expected syntax is \u201cAUTHORITY:CODE\u201d.
MissingRequiredModule_1 = This operation requires the \u201c{0}\u201d module.
MissingSchemeInURI = Missing scheme in URI.
MissingValueForOption_1 = Missing value for option \u201c{0}\u201d.
@@ -116,6 +117,7 @@ NotAPrimitiveWrapper_1 = Clas
NotASkewSymmetricMatrix = Matrix is not skew-symmetric.
NotAUnicodeIdentifier_1 = Text \u201c{0}\u201d is not a Unicode identifier.
NotComparableClass_1 = Class \u2018{0}\u2019 is not a comparable.
+NoSuchAuthorityCode_3 = No code \u201c{2}\u201d from authority \u201c{0}\u201d found for object of type \u2018{1}\u2019.
NoSuchElement_1 = Element \u201c{0}\u201d has not been found.
NoSuchProperty_2 = No property named \u201c{0}\u201d has been found in \u201c{1}\u201d.
NoUnit = No unit of measurement has been specified.
@@ -138,6 +140,7 @@ UnexpectedChange_1 = Unex
UnexpectedEndOfFile_1 = Unexpected end of file while reading \u201c{0}\u201d.
UnexpectedEndOfString_1 = More characters were expected at the end of \u201c{0}\u201d.
UnexpectedFileFormat_2 = File \u201c{1}\u201d seems to be encoded in an other format than {0}.
+UnknownAuthority_1 = Authority \u201c{0}\u201d is unknown.
UnknownAxisDirection_1 = Axis direction \u201c{0}\u201d is unknown.
UnknownCommand_1 = Command \u201c{0}\u201d is not recognized.
UnknownEnumValue_1 = Unknown enumeration value: {0}.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Wed Jan 15 22:04:59 2014
@@ -75,6 +75,7 @@ MismatchedCRS = Le s
MismatchedDimension_2 = Les dimensions des objets ({0}D et {1}D) ne concordent pas.
MismatchedDimension_3 = L\u2019argument \u2018{0}\u2019 a {2} dimension{2,choice,1#|2#s}, alors qu\u2019on en attendait {1}.
MismatchedMatrixSize_4 = Une matrice de taille de {0}\u00d7{1} \u00e9tait attendue mais la matrice donn\u00e9es est de taille {2}\u00d7{3}.
+MissingAuthority_1 = Aucune autorit\u00e9 n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e pour le code \u201c{0}\u201d. Le format attendu est \u201cAUTORIT\u00c9:CODE\u201d.
MissingRequiredModule_1 = Cette op\u00e9ration requiert le module \u201c{0}\u201d.
MissingSchemeInURI = Il manque le sch\u00e9ma d\u2019URI.
MissingValueForOption_1 = Aucune valeur n\u2019a \u00e9t\u00e9 d\u00e9finie pour l\u2019option \u201c{0}\u201d.
@@ -106,6 +107,7 @@ NotAPrimitiveWrapper_1 = La c
NotASkewSymmetricMatrix = La matrice n\u2019est pas antisym\u00e9trique.
NotAUnicodeIdentifier_1 = Le texte \u201c{0}\u201d n\u2019est pas un identifiant Unicode.
NotComparableClass_1 = La classe \u2018{0}\u2019 n\u2019est pas comparable.
+NoSuchAuthorityCode_3 = Aucun code \u201c{2}\u201d de l\u2019autorit\u00e9 \u201c{0}\u201d n\u2019a \u00e9t\u00e9 trouv\u00e9 pour un objet de type \u2018{1}\u2019.
NoSuchElement_1 = L\u2019\u00e9lement \u201c{0}\u201d n\u2019a pas \u00e9t\u00e9 trouv\u00e9.
NoSuchProperty_2 = Aucune propri\u00e9t\u00e9 nomm\u00e9e \u201c{0}\u201d n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u201c{1}\u201d.
NoUnit = Aucune unit\u00e9 de mesure n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e.
@@ -127,6 +129,7 @@ UnexpectedChange_1 = Chan
UnexpectedEndOfFile_1 = Fin de fichier inattendue lors de la lecture de \u201c{0}\u201d.
UnexpectedEndOfString_1 = D\u2019autres caract\u00e8res \u00e9taient attendus \u00e0 la fin du texte \u201c{0}\u201d.
UnexpectedFileFormat_2 = Le fichier \u201c{1}\u201d semble \u00eatre encod\u00e9 dans un autre format que {0}.
+UnknownAuthority_1 = L\u2019autorit\u00e9 \u201c{0}\u201d n\u2019est pas reconnue.
UnknownAxisDirection_1 = La direction d\u2019axe \u201c{0}\u201d n\u2019est pas reconnue.
UnknownCommand_1 = La commande \u201c{0}\u201d n\u2019est pas reconnue.
UnknownEnumValue_1 = Valeur d\u2019\u00e9num\u00e9ration inconnue: {0}.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -345,6 +345,11 @@ public final class Vocabulary extends In
public static final short UnavailableContent = 57;
/**
+ * Unnamed
+ */
+ public static final short Unnamed = 65;
+
+ /**
* Untitled
*/
public static final short Untitled = 58;
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties [ISO-8859-1] Wed Jan 15 22:04:59 2014
@@ -71,6 +71,7 @@ Time_1 = {0} time
Timezone = Timezone
TruncatedJulian = Truncated Julian
Type = Type
+Unnamed = Unnamed
Untitled = Untitled
UnavailableContent = Unavailable content.
UserHome = User home directory
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties [ISO-8859-1] Wed Jan 15 22:04:59 2014
@@ -71,6 +71,7 @@ Time_1 = Heure {0}
Timezone = Fuseau horaire
TruncatedJulian = Julien tronqu\u00e9
Type = Type
+Unnamed = Sans nom
Untitled = Sans titre
UnavailableContent = Contenu non-disponible.
UserHome = R\u00e9pertoire de l'utilisateur
Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java?rev=1558587&r1=1558586&r2=1558587&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java [UTF-8] Wed Jan 15 22:04:59 2014
@@ -327,21 +327,24 @@ public final strictfp class CharSequence
@Test
public void testIsAcronymForWords() {
/*
- * Following should be accepted as acronyms...
+ * Following shall be accepted as acronyms...
*/
assertTrue(isAcronymForWords("OGC", "Open Geospatial Consortium"));
assertTrue(isAcronymForWords("O.G.C.", "Open Geospatial Consortium"));
assertTrue(isAcronymForWords("OpGeoCon", "Open Geospatial Consortium"));
assertTrue(isAcronymForWords("Open Geospatial Consortium", "Open Geospatial Consortium"));
assertTrue(isAcronymForWords("ogc", "Open Geospatial Consortium"));
+ assertTrue(isAcronymForWords("E", "EAST"));
+ assertTrue(isAcronymForWords("ENE", "EAST_NORTH_EAST"));
/*
- * Following should be rejected...
+ * Following shall be rejected...
*/
assertFalse(isAcronymForWords("ORC", "Open Geospatial Consortium"));
assertFalse(isAcronymForWords("O.C.G.", "Open Geospatial Consortium"));
assertFalse(isAcronymForWords("OGC2", "Open Geospatial Consortium"));
assertFalse(isAcronymForWords("OG", "Open Geospatial Consortium"));
assertFalse(isAcronymForWords("GC", "Open Geospatial Consortium"));
+ assertFalse(isAcronymForWords("ENE", "NORTH_EAST"));
/*
* Following are mapping of EPSG table names from MS-Access to ANSI SQL.
* All those items must be recognized as acroynms - this is requred by DirectEpsgFactory.
@@ -369,7 +372,7 @@ public final strictfp class CharSequence
assertTrue(isAcronymForWords("deprecation", "[Deprecation]"));
assertFalse(isAcronymForWords(null, "[Deprecation]"));
/*
- * It is important the the following is not recognized as an acronym,
+ * It is important the following is not recognized as an acronym,
* otherwise it leads to a confusion in DirectEpsgFactory.
*/
assertFalse(isAcronymForWords("coordoperation", "[Coordinate_Operation Method]"));