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/02/10 16:56:58 UTC
svn commit: r1566666 - in /sis/branches/JDK7/core/sis-referencing/src:
main/java/org/apache/sis/parameter/ main/java/org/apache/sis/referencing/
main/java/org/apache/sis/referencing/cs/
test/java/org/apache/sis/referencing/cs/
Author: desruisseaux
Date: Mon Feb 10 15:56:58 2014
New Revision: 1566666
URL: http://svn.apache.org/r1566666
Log:
Move axis minimum and maximum values in the property map for consistency with the policy adopted in the rest of SIS
regarding ignorable / non-ignorable metadata. This is also consistent with the factory method in GeoAPI.
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java?rev=1566666&r1=1566665&r2=1566666&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java [UTF-8] Mon Feb 10 15:56:58 2014
@@ -170,6 +170,10 @@ public class DefaultParameterDescriptor<
* </tr>
* </table>
*
+ * Generally speaking, information provided in the {@code properties} map are considered ignorable metadata
+ * (except the parameter name) while information provided as explicit arguments may have an impact on coordinate
+ * transformation results. See {@link #equals(Object, ComparisonMode)} for more information.
+ *
* @param properties The properties to be given to the identified object.
* @param valueClass The class that describes the type of the parameter value.
* @param defaultValue The default value for the parameter, or {@code null} if none.
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java?rev=1566666&r1=1566665&r2=1566666&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java [UTF-8] Mon Feb 10 15:56:58 2014
@@ -320,6 +320,10 @@ final class StandardDefinitions {
break;
default: throw new AssertionError(code);
}
- return new DefaultCoordinateSystemAxis(properties(code, name, null, false), abrv, dir, unit, min, max, rm);
+ final Map<String,Object> properties = properties(code, name, null, false);
+ properties.put(DefaultCoordinateSystemAxis.MINIMUM_VALUE_KEY, min);
+ properties.put(DefaultCoordinateSystemAxis.MAXIMUM_VALUE_KEY, max);
+ properties.put(DefaultCoordinateSystemAxis.RANGE_MEANING_KEY, rm);
+ return new DefaultCoordinateSystemAxis(properties, abrv, dir, unit);
}
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1566666&r1=1566665&r2=1566666&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] Mon Feb 10 15:56:58 2014
@@ -51,6 +51,7 @@ import static java.lang.Double.NEGATIVE_
import static java.lang.Double.POSITIVE_INFINITY;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
import static org.apache.sis.util.CharSequences.trimWhitespaces;
+import static org.apache.sis.util.collection.Containers.property;
import static org.apache.sis.internal.metadata.MetadataUtilities.canSetProperty;
// Related to JDK7
@@ -96,6 +97,24 @@ public class DefaultCoordinateSystemAxis
private static final long serialVersionUID = -7883614853277827689L;
/**
+ * Key for the {@value} property to be given to the constructor.
+ * This is used for setting the value to be returned by {@link #getMinimumValue()}.
+ */
+ public static final String MINIMUM_VALUE_KEY = "minimumValue";
+
+ /**
+ * Key for the {@value} property to be given to the constructor.
+ * This is used for setting the value to be returned by {@link #getMaximumValue()}.
+ */
+ public static final String MAXIMUM_VALUE_KEY = "maximumValue";
+
+ /**
+ * Key for the {@value} property to be given to the constructor.
+ * This is used for setting the value to be returned by {@link #getRangeMeaning()}.
+ */
+ public static final String RANGE_MEANING_KEY = "rangeMeaning";
+
+ /**
* The identifier for axis of unknown name. We have to use this identifier when the axis direction changed,
* because such change often implies a name change too (e.g. "Westing" → "Easting"), and we can not always
* guess what the new name should be.
@@ -200,10 +219,9 @@ public class DefaultCoordinateSystemAxis
}
/**
- * Constructs an axis from a set of properties and a given range.
- * The properties map is given unchanged to the
- * {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}.
- * The following table is a reminder of main (not all) properties:
+ * Constructs an axis from a set of properties. The properties given in argument follow the same rules
+ * than for the {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}.
+ * Additionally, the following properties are understood by this constructor:
*
* <table class="sis">
* <tr>
@@ -212,6 +230,24 @@ public class DefaultCoordinateSystemAxis
* <th>Returned by</th>
* </tr>
* <tr>
+ * <td>{@value #MINIMUM_VALUE_KEY}</td>
+ * <td>{@link Number}</td>
+ * <td>{@link #getMinimumValue()}</td>
+ * </tr>
+ * <tr>
+ * <td>{@value #MAXIMUM_VALUE_KEY}</td>
+ * <td>{@link Number}</td>
+ * <td>{@link #getMaximumValue()}</td>
+ * </tr>
+ * <tr>
+ * <td>{@value #RANGE_MEANING_KEY}</td>
+ * <td>{@link RangeMeaning}</td>
+ * <td>{@link #getRangeMeaning()}</td>
+ * </tr>
+ * <tr>
+ * <th colspan="3" class="hsep">Defined in parent class (reminder)</th>
+ * </tr>
+ * <tr>
* <td>{@value org.opengis.referencing.IdentifiedObject#NAME_KEY}</td>
* <td>{@link ReferenceIdentifier} or {@link String}</td>
* <td>{@link #getName()}</td>
@@ -233,48 +269,13 @@ public class DefaultCoordinateSystemAxis
* </tr>
* </table>
*
- * @param properties The properties to be given to the identified object.
- * @param abbreviation The {@linkplain #getAbbreviation() abbreviation} used for this coordinate system axis.
- * @param direction The {@linkplain #getDirection() direction} of this coordinate system axis.
- * @param unit The {@linkplain #getUnit() unit of measure} used for this coordinate system axis.
- * @param minimumValue The minimum value normally allowed for this axis, or {@link Double#NEGATIVE_INFINITY} if none.
- * @param maximumValue The maximum value normally allowed for this axis, or {@link Double#POSITIVE_INFINITY} if none.
- * @param rangeMeaning The meaning of axis value range specified by the minimum and maximum values, or {@code null}
- * if it does not apply. Shall not be null if the minimum and maximum values are not infinite.
- */
- public DefaultCoordinateSystemAxis(final Map<String,?> properties,
- final String abbreviation,
- final AxisDirection direction,
- final Unit<?> unit,
- final double minimumValue,
- final double maximumValue,
- RangeMeaning rangeMeaning)
- {
- super(properties);
- this.abbreviation = abbreviation;
- this.direction = direction;
- this.unit = unit;
- this.minimumValue = minimumValue;
- this.maximumValue = maximumValue;
- ensureNonNull("abbreviation", abbreviation);
- ensureNonNull("direction", direction);
- ensureNonNull("unit", unit);
- if (!(minimumValue < maximumValue)) { // Use '!' for catching NaN
- throw new IllegalArgumentException(Errors.getResources(properties).getString(
- Errors.Keys.IllegalRange_2, minimumValue, maximumValue));
- }
- if ((minimumValue != NEGATIVE_INFINITY) || (maximumValue != POSITIVE_INFINITY)) {
- ensureNonNull("rangeMeaning", rangeMeaning);
- } else {
- rangeMeaning = null;
- }
- this.rangeMeaning = rangeMeaning;
- }
-
- /**
- * Constructs an axis from a set of properties and a range inferred from the axis unit and direction.
- * The properties map is the same than for the {@linkplain #DefaultCoordinateSystemAxis(Map, String,
- * AxisDirection, Unit, double, double, RangeMeaning) above constructor}.
+ * Generally speaking, information provided in the {@code properties} map are considered ignorable metadata
+ * (except the axis name) while information provided as explicit arguments may have an impact on coordinate
+ * transformation results. Exceptions to this rule are the {@code minimumValue} and {@code maximumValue} in
+ * the particular case where {@code rangeMeaning} is {@link RangeMeaning#WRAPAROUND}.
+ *
+ * <p>If no minimum, maximum and range meaning are specified, then this constructor will infer them
+ * from the axis unit and direction.</p>
*
* @param properties The properties to be given to the identified object.
* @param abbreviation The {@linkplain #getAbbreviation() abbreviation} used for this coordinate system axis.
@@ -286,8 +287,6 @@ public class DefaultCoordinateSystemAxis
final AxisDirection direction,
final Unit<?> unit)
{
- // NOTE: we would invoke this(properties, abbreviation, ...) instead if Oracle fixed
- // RFE #4093999 ("Relax constraint on placement of this()/super() call in constructors").
super(properties);
this.abbreviation = abbreviation;
this.direction = direction;
@@ -295,30 +294,46 @@ public class DefaultCoordinateSystemAxis
ensureNonNull("abbreviation", abbreviation);
ensureNonNull("direction", direction);
ensureNonNull("unit", unit);
- double min = NEGATIVE_INFINITY;
- double max = POSITIVE_INFINITY;
- RangeMeaning r = null;
- if (Units.isAngular(unit)) {
- final UnitConverter fromDegrees = NonSI.DEGREE_ANGLE.getConverterTo(unit.asType(Angle.class));
- final AxisDirection dir = AxisDirections.absolute(direction);
- if (dir.equals(AxisDirection.NORTH)) {
- min = fromDegrees.convert(Latitude.MIN_VALUE);
- max = fromDegrees.convert(Latitude.MAX_VALUE);
- r = RangeMeaning.EXACT;
- } else if (dir.equals(AxisDirection.EAST)) {
- min = fromDegrees.convert(Longitude.MIN_VALUE);
- max = fromDegrees.convert(Longitude.MAX_VALUE);
- r = RangeMeaning.WRAPAROUND; // 180°E wraps to 180°W
+ Number minimum = property(properties, MINIMUM_VALUE_KEY, Number.class);
+ Number maximum = property(properties, MAXIMUM_VALUE_KEY, Number.class);
+ RangeMeaning rm = property(properties, RANGE_MEANING_KEY, RangeMeaning.class);
+ if (minimum == null && maximum == null && rm == null) {
+ double min = Double.NEGATIVE_INFINITY;
+ double max = Double.POSITIVE_INFINITY;
+ if (Units.isAngular(unit)) {
+ final UnitConverter fromDegrees = NonSI.DEGREE_ANGLE.getConverterTo(unit.asType(Angle.class));
+ final AxisDirection dir = AxisDirections.absolute(direction);
+ if (dir.equals(AxisDirection.NORTH)) {
+ min = fromDegrees.convert(Latitude.MIN_VALUE);
+ max = fromDegrees.convert(Latitude.MAX_VALUE);
+ rm = RangeMeaning.EXACT;
+ } else if (dir.equals(AxisDirection.EAST)) {
+ min = fromDegrees.convert(Longitude.MIN_VALUE);
+ max = fromDegrees.convert(Longitude.MAX_VALUE);
+ rm = RangeMeaning.WRAPAROUND; // 180°E wraps to 180°W
+ }
+ if (min > max) {
+ final double t = min;
+ min = max;
+ max = t;
+ }
+ }
+ minimumValue = min;
+ maximumValue = max;
+ } else {
+ minimumValue = (minimum != null) ? minimum.doubleValue() : Double.NEGATIVE_INFINITY;
+ maximumValue = (maximum != null) ? maximum.doubleValue() : Double.POSITIVE_INFINITY;
+ if (!(minimumValue < maximumValue)) { // Use '!' for catching NaN
+ throw new IllegalArgumentException(Errors.getResources(properties).getString(
+ Errors.Keys.IllegalRange_2, minimumValue, maximumValue));
}
- if (min > max) {
- final double t = min;
- min = max;
- max = t;
+ if ((minimumValue != NEGATIVE_INFINITY) || (maximumValue != POSITIVE_INFINITY)) {
+ ensureNonNull(RANGE_MEANING_KEY, rm);
+ } else {
+ rm = null;
}
}
- minimumValue = min;
- maximumValue = max;
- rangeMeaning = r;
+ rangeMeaning = rm;
}
/**
@@ -589,6 +604,18 @@ public class DefaultCoordinateSystemAxis
/**
* Compares the specified object with this axis for equality.
+ * The strictness level is controlled by the second argument.
+ * This method compares the following properties in every cases:
+ *
+ * <ul>
+ * <li>{@link #getName()}</li>
+ * <li>{@link #getDirection()}</li>
+ * <li>{@link #getUnit()}</li>
+ * </ul>
+ *
+ * In the particular case where {@link #getRangeMeaning()} is {@code WRAPAROUND}, then {@link #getMinimumValue()}
+ * and {@link #getMaximumValue()} are considered non-ignorable metadata and will be compared for every modes.
+ * All other properties are compared only for modes stricter than {@link ComparisonMode#IGNORE_METADATA}.
*
* @param object The object to compare to {@code this}.
* @param mode {@link ComparisonMode#STRICT STRICT} for performing a strict comparison, or
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java?rev=1566666&r1=1566665&r2=1566666&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java [UTF-8] Mon Feb 10 15:56:58 2014
@@ -17,6 +17,7 @@
package org.apache.sis.referencing.cs;
import java.util.Map;
+import java.util.HashMap;
import java.util.Arrays;
import javax.measure.unit.Unit;
import javax.measure.unit.SI;
@@ -177,11 +178,11 @@ final class Normalizer implements Compar
newAbbr = "t";
}
}
- final Map<String,?> properties;
+ final Map<String,Object> properties = new HashMap<>();
if (newAbbr.equals(abbreviation)) {
- properties = IdentifiedObjects.getProperties(axis, EXCLUDES);
+ properties.putAll(IdentifiedObjects.getProperties(axis, EXCLUDES));
} else {
- properties = singletonMap(NAME_KEY, DefaultCoordinateSystemAxis.UNNAMED);
+ properties.put(NAME_KEY, DefaultCoordinateSystemAxis.UNNAMED);
}
/*
* Converts the axis range and build the new axis.
@@ -193,8 +194,10 @@ final class Normalizer implements Compar
// Use IllegalStateException because the public API is an AbstractCS member method.
throw new IllegalStateException(Errors.format(Errors.Keys.IllegalUnitFor_2, "axis", unit), e);
}
- return new DefaultCoordinateSystemAxis(properties, newAbbr, newDir, newUnit,
- c.convert(axis.getMinimumValue()), c.convert(axis.getMaximumValue()), axis.getRangeMeaning());
+ properties.put(DefaultCoordinateSystemAxis.MINIMUM_VALUE_KEY, c.convert(axis.getMinimumValue()));
+ properties.put(DefaultCoordinateSystemAxis.MAXIMUM_VALUE_KEY, c.convert(axis.getMaximumValue()));
+ properties.put(DefaultCoordinateSystemAxis.RANGE_MEANING_KEY, axis.getRangeMeaning());
+ return new DefaultCoordinateSystemAxis(properties, newAbbr, newDir, newUnit);
}
/**
@@ -256,8 +259,13 @@ final class Normalizer implements Compar
min -= offset;
max -= offset;
if (min < max) { // Paranoiac check, but also a way to filter NaN values when offset is infinite.
- axis = new DefaultCoordinateSystemAxis(IdentifiedObjects.getProperties(axis, EXCLUDES),
- axis.getAbbreviation(), axis.getDirection(), axis.getUnit(), min, max, rangeMeaning);
+ final Map<String,Object> properties = new HashMap<>();
+ properties.putAll(IdentifiedObjects.getProperties(axis, EXCLUDES));
+ properties.put(DefaultCoordinateSystemAxis.MINIMUM_VALUE_KEY, min);
+ properties.put(DefaultCoordinateSystemAxis.MAXIMUM_VALUE_KEY, max);
+ properties.put(DefaultCoordinateSystemAxis.RANGE_MEANING_KEY, rangeMeaning);
+ axis = new DefaultCoordinateSystemAxis(properties,
+ axis.getAbbreviation(), axis.getDirection(), axis.getUnit());
changed = true;
}
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java?rev=1566666&r1=1566665&r2=1566666&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java [UTF-8] Mon Feb 10 15:56:58 2014
@@ -27,6 +27,7 @@ import org.junit.Test;
import static java.util.Collections.singletonMap;
import static org.opengis.referencing.cs.CoordinateSystem.NAME_KEY;
+import static org.apache.sis.referencing.cs.CoordinateSystemsTest.STRICT;
import static org.apache.sis.test.Assert.*;
@@ -90,11 +91,18 @@ public final strictfp class AbstractCSTe
* Some expected axes, identical to the ones in HardCodedAxes except for name or units.
*/
final DefaultCoordinateSystemAxis EASTING = new DefaultCoordinateSystemAxis(
- singletonMap(NAME_KEY, Vocabulary.format(Vocabulary.Keys.Unnamed)), "E",
- AxisDirection.EAST, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, null);
+ singletonMap(NAME_KEY, Vocabulary.format(Vocabulary.Keys.Unnamed)), "E", AxisDirection.EAST, SI.METRE);
final DefaultCoordinateSystemAxis HEIGHT = new DefaultCoordinateSystemAxis(
- singletonMap(NAME_KEY, "Height"), "h",
- AxisDirection.UP, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, null);
+ singletonMap(NAME_KEY, "Height"), "h", AxisDirection.UP, SI.METRE);
+ /*
+ * Verifies the properties inferred by the constructor.
+ */
+ assertEquals("minimumValue", Double.NEGATIVE_INFINITY, EASTING.getMinimumValue(), STRICT);
+ assertEquals("maximumValue", Double.POSITIVE_INFINITY, EASTING.getMaximumValue(), STRICT);
+ assertNull ("rangeMeaning", EASTING.getRangeMeaning());
+ assertEquals("minimumValue", Double.NEGATIVE_INFINITY, HEIGHT.getMinimumValue(), STRICT);
+ assertEquals("maximumValue", Double.POSITIVE_INFINITY, HEIGHT.getMaximumValue(), STRICT);
+ assertNull ("rangeMeaning", HEIGHT.getRangeMeaning());
/*
* Test RIGHT_HANDED as a matter of principle before to test NORMALIZED.
*/
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java?rev=1566666&r1=1566665&r2=1566666&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java [UTF-8] Mon Feb 10 15:56:58 2014
@@ -53,7 +53,7 @@ public final strictfp class CoordinateSy
/**
* Tolerance threshold for strict floating point comparisons.
*/
- private static final double STRICT = 0;
+ static final double STRICT = 0;
/**
* Tests {@link CoordinateSystems#parseAxisDirection(String)}.
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java?rev=1566666&r1=1566665&r2=1566666&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] Mon Feb 10 15:56:58 2014
@@ -29,6 +29,7 @@ import org.junit.Test;
import static org.apache.sis.test.MetadataAssert.*;
import static org.apache.sis.referencing.cs.HardCodedAxes.*;
import static org.apache.sis.referencing.IdentifiedObjects.getProperties;
+import static org.apache.sis.referencing.cs.CoordinateSystemsTest.STRICT;
/**
@@ -120,10 +121,21 @@ public final strictfp class DefaultCoord
* (GEODETIC_LONGITUDE, GEODETIC_LATITUDE) except for the name.
*/
final DefaultCoordinateSystemAxis LONGITUDE = new DefaultCoordinateSystemAxis(getProperties(LONGITUDE_gon),
- "λ", AxisDirection.EAST, NonSI.DEGREE_ANGLE, -180, 180, RangeMeaning.WRAPAROUND);
+ "λ", AxisDirection.EAST, NonSI.DEGREE_ANGLE);
final DefaultCoordinateSystemAxis LATITUDE = new DefaultCoordinateSystemAxis(getProperties(LATITUDE_gon),
- "φ", AxisDirection.NORTH, NonSI.DEGREE_ANGLE, -90, 90, RangeMeaning.EXACT);
-
+ "φ", AxisDirection.NORTH, NonSI.DEGREE_ANGLE);
+ /*
+ * Verifies the properties inferred by the constructor.
+ */
+ assertEquals("minimumValue", -180, LONGITUDE.getMinimumValue(), STRICT);
+ assertEquals("maximumValue", +180, LONGITUDE.getMaximumValue(), STRICT);
+ assertEquals("rangeMeaning", RangeMeaning.WRAPAROUND, LONGITUDE.getRangeMeaning());
+ assertEquals("minimumValue", -90, LATITUDE.getMinimumValue(), STRICT);
+ assertEquals("maximumValue", +90, LATITUDE.getMaximumValue(), STRICT);
+ assertEquals("rangeMeaning", RangeMeaning.EXACT, LATITUDE.getRangeMeaning());
+ /*
+ * Those axes shall be considered different.
+ */
assertFalse("X", X .equals(GEOCENTRIC_X, ComparisonMode.IGNORE_METADATA));
assertFalse("Longitude", LONGITUDE.equals(GEODETIC_LONGITUDE, ComparisonMode.STRICT));
assertFalse("Longitude", LONGITUDE.equals(SPHERICAL_LONGITUDE, ComparisonMode.STRICT));
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java?rev=1566666&r1=1566665&r2=1566666&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] Mon Feb 10 15:56:58 2014
@@ -16,14 +16,14 @@
*/
package org.apache.sis.referencing.cs;
+import java.util.Map;
+import java.util.HashMap;
import javax.measure.unit.Unit;
import javax.measure.unit.SI;
import javax.measure.unit.NonSI;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.RangeMeaning;
-import static java.util.Collections.singletonMap;
-
/**
* Collection of axes for testing purpose.
@@ -419,8 +419,12 @@ public final strictfp class HardCodedAxe
final AxisDirection direction, final Unit<?> unit, final double minimum, final double maximum,
final RangeMeaning meaning)
{
- return new DefaultCoordinateSystemAxis(singletonMap(DefaultCoordinateSystemAxis.NAME_KEY, name),
- abbreviation, direction, unit, minimum, maximum, meaning);
+ final Map<String,Object> properties = new HashMap<>(8);
+ properties.put(DefaultCoordinateSystemAxis.NAME_KEY, name);
+ properties.put(DefaultCoordinateSystemAxis.MINIMUM_VALUE_KEY, minimum);
+ properties.put(DefaultCoordinateSystemAxis.MAXIMUM_VALUE_KEY, maximum);
+ properties.put(DefaultCoordinateSystemAxis.RANGE_MEANING_KEY, meaning);
+ return new DefaultCoordinateSystemAxis(properties, abbreviation, direction, unit);
}
/**