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 2016/10/13 13:50:42 UTC
svn commit: r1764677 [2/9] - in /sis/branches/JDK7: ./
application/sis-console/src/main/java/org/apache/sis/console/ core/
core/sis-feature/src/main/java/org/apache/sis/feature/builder/
core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metad...
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -32,15 +32,13 @@ import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.ParsePosition;
import java.text.ParseException;
-import javax.measure.unit.Unit;
-import javax.measure.unit.UnitFormat;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
+import javax.measure.Unit;
import javax.measure.quantity.Angle;
import javax.measure.quantity.Length;
-import javax.measure.quantity.Quantity;
-import javax.measure.quantity.Duration;
-import javax.measure.converter.ConversionException;
+import javax.measure.Quantity;
+import javax.measure.quantity.Time;
+import javax.measure.format.ParserException;
+import javax.measure.IncommensurableException;
import org.opengis.util.Factory;
import org.opengis.metadata.Identifier;
@@ -58,6 +56,7 @@ import org.opengis.referencing.datum.*;
import org.opengis.referencing.operation.*;
import org.apache.sis.measure.Units;
+import org.apache.sis.measure.UnitFormat;
import org.apache.sis.metadata.iso.ImmutableIdentifier;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.metadata.iso.extent.DefaultExtent;
@@ -92,7 +91,7 @@ import static java.util.Collections.sing
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Johann Sorel (Geomatys)
* @since 0.6
- * @version 0.7
+ * @version 0.8
* @module
*/
class GeodeticObjectParser extends MathTransformParser implements Comparator<CoordinateSystemAxis> {
@@ -132,7 +131,7 @@ class GeodeticObjectParser extends MathT
/**
* During WKT 1 parsing, {@code true} means that {@code PRIMEM} and {@code PARAMETER} angular units
- * need to be forced to {@code NonSI.DEGREE_ANGLE} instead than inferred from the context.
+ * need to be forced to {@code Units.DEGREE} instead than inferred from the context.
* Note that this rule does not apply to {@code AXIS} elements
*
* <p>This flag is ignored during WKT 2 parsing.</p>
@@ -194,9 +193,9 @@ class GeodeticObjectParser extends MathT
* Do not change the method signature even if it doesn't break the compilation, unless the
* reflection code is also updated.</p>
*
- * @param defaultProperties Default properties to give to the object to create.
- * @param factories An object implementing {@link DatumFactory}, {@link CSFactory} and {@link CRSFactory}.
- * @param mtFactory The factory to use to create {@link MathTransform} objects.
+ * @param defaultProperties default properties to give to the object to create.
+ * @param factories an object implementing {@link DatumFactory}, {@link CSFactory} and {@link CRSFactory}.
+ * @param mtFactory the factory to use to create {@link MathTransform} objects.
*/
public GeodeticObjectParser(final Map<String,?> defaultProperties,
final ObjectFactory factories, final MathTransformFactory mtFactory)
@@ -217,14 +216,14 @@ class GeodeticObjectParser extends MathT
* Constructs a parser for the specified set of symbols using the specified set of factories.
* This constructor is for {@link WKTFormat} usage only.
*
- * @param symbols The set of symbols to use.
- * @param fragments Reference to the {@link WKTFormat#fragments} map, or an empty map if none.
- * @param numberFormat The number format provided by {@link WKTFormat}, or {@code null} for a default format.
- * @param dateFormat The date format provided by {@link WKTFormat}, or {@code null} for a default format.
- * @param unitFormat The unit format provided by {@link WKTFormat}, or {@code null} for a default format.
- * @param convention The WKT convention to use.
- * @param errorLocale The locale for error messages (not for parsing), or {@code null} for the system default.
- * @param factories On input, the factories to use. On output, the factories used. Can be null.
+ * @param symbols the set of symbols to use.
+ * @param fragments reference to the {@link WKTFormat#fragments} map, or an empty map if none.
+ * @param numberFormat the number format provided by {@link WKTFormat}, or {@code null} for a default format.
+ * @param dateFormat the date format provided by {@link WKTFormat}, or {@code null} for a default format.
+ * @param unitFormat the unit format provided by {@link WKTFormat}, or {@code null} for a default format.
+ * @param convention the WKT convention to use.
+ * @param errorLocale the locale for error messages (not for parsing), or {@code null} for the system default.
+ * @param factories on input, the factories to use. On output, the factories used. Can be null.
*/
GeodeticObjectParser(final Symbols symbols, final Map<String,Element> fragments,
final NumberFormat numberFormat, final DateFormat dateFormat, final UnitFormat unitFormat,
@@ -274,9 +273,9 @@ class GeodeticObjectParser extends MathT
/**
* Parses a <cite>Well Know Text</cite> (WKT).
*
- * @param text The text to be parsed.
- * @param position The position to start parsing from.
- * @return The parsed object.
+ * @param text the text to be parsed.
+ * @param position the position to start parsing from.
+ * @return the parsed object.
* @throws ParseException if the string can not be parsed.
*/
@Override
@@ -320,8 +319,8 @@ class GeodeticObjectParser extends MathT
/**
* Parses the next element in the specified <cite>Well Know Text</cite> (WKT) tree.
*
- * @param element The element to be parsed.
- * @return The object.
+ * @param element the element to be parsed.
+ * @return the parsed object.
* @throws ParseException if the element can not be parsed.
*/
@Override
@@ -335,8 +334,8 @@ class GeodeticObjectParser extends MathT
return value;
}
Object object;
- if ((object = parseAxis (FIRST, element, null, SI.METRE)) == null &&
- (object = parsePrimeMeridian (FIRST, element, false, NonSI.DEGREE_ANGLE)) == null &&
+ if ((object = parseAxis (FIRST, element, null, Units.METRE )) == null &&
+ (object = parsePrimeMeridian (FIRST, element, false, Units.DEGREE)) == null &&
(object = parseDatum (FIRST, element, null )) == null &&
(object = parseEllipsoid (FIRST, element )) == null &&
(object = parseToWGS84 (FIRST, element )) == null &&
@@ -355,9 +354,9 @@ class GeodeticObjectParser extends MathT
/**
* Parses a coordinate reference system element.
*
- * @param element The parent element.
- * @param mandatory {@code true} if a CRS must be present, or {@code false} if optional.
- * @return The next element as a {@code CoordinateReferenceSystem} object.
+ * @param element the parent element.
+ * @param mandatory {@code true} if a CRS must be present, or {@code false} if optional.
+ * @return the next element as a {@code CoordinateReferenceSystem} object.
* @throws ParseException if the next element can not be parsed.
*/
private CoordinateReferenceSystem parseCoordinateReferenceSystem(final Element element, final boolean mandatory)
@@ -384,10 +383,10 @@ class GeodeticObjectParser extends MathT
/**
* Parses a coordinate reference system wrapped in an element of the given name.
*
- * @param parent The parent element containing the CRS to parse.
+ * @param parent the parent element containing the CRS to parse.
* @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
* @param keyword "SourceCRS", "TargetCRS" or "InterpolationCRS".
- * @return The coordinate reference system, or {@code null} if none.
+ * @return the coordinate reference system, or {@code null} if none.
* @throws ParseException if the CRS can not be parsed.
*/
private CoordinateReferenceSystem parseCoordinateReferenceSystem(final Element parent, final int mode,
@@ -406,8 +405,8 @@ class GeodeticObjectParser extends MathT
* Returns the value associated to {@link IdentifiedObject#IDENTIFIERS_KEY} as an {@code Identifier} object.
* This method shall accept all value types that {@link #parseMetadataAndClose(Element, Object)} may store.
*
- * @param identifier The {@link #properties} value, or {@code null}.
- * @return The identifier, or {@code null} if the given value was null.
+ * @param identifier the {@link #properties} value, or {@code null}.
+ * @return the identifier, or {@code null} if the given value was null.
*/
private static Identifier toIdentifier(final Object identifier) {
return (identifier instanceof Identifier[]) ? ((Identifier[]) identifier)[0] : (Identifier) identifier;
@@ -427,10 +426,10 @@ class GeodeticObjectParser extends MathT
* we will use the name of the enclosed datum. Indeed, it is not uncommon to have the same name for
* a geographic CRS and its geodetic datum.
*
- * @param parent The parent element.
- * @param name The name of the parent object being parsed.
- * @param fallback The fallback to use if {@code name} is empty.
- * @return A properties map with the parent name and the optional authority code.
+ * @param parent the parent element.
+ * @param name the name of the parent object being parsed.
+ * @param fallback the fallback to use if {@code name} is empty.
+ * @return a properties map with the parent name and the optional authority code.
* @throws ParseException if an element can not be parsed.
*/
@SuppressWarnings("ReturnOfCollectionOrArrayField")
@@ -539,9 +538,9 @@ class GeodeticObjectParser extends MathT
while ((element = parent.pullElement(OPTIONAL, WKTKeywords.VerticalExtent)) != null) {
final double minimum = element.pullDouble("minimum");
final double maximum = element.pullDouble("maximum");
- Unit<Length> unit = parseScaledUnit(element, WKTKeywords.LengthUnit, SI.METRE);
+ Unit<Length> unit = parseScaledUnit(element, WKTKeywords.LengthUnit, Units.METRE);
element.close(ignoredElements);
- if (unit == null) unit = SI.METRE;
+ if (unit == null) unit = Units.METRE;
if (extent == null) extent = new DefaultExtent();
verticalElements = new VerticalInfo(verticalElements, extent, minimum, maximum, unit).resolve(verticalCRS);
}
@@ -615,17 +614,17 @@ class GeodeticObjectParser extends MathT
* Unit was a mandatory element in WKT 1, but became optional in WKT 2 because the unit may be specified
* in each {@code AXIS[\u2026]} element instead than for the whole coordinate system.
*
- * @param parent The parent element.
- * @param keyword The unit keyword (e.g. {@code "LengthUnit"} or {@code "AngleUnit"}).
- * @param baseUnit The base unit, usually {@code SI.METRE} or {@code SI.RADIAN}.
- * @return The {@code "UNIT"} element as an {@link Unit} object, or {@code null} if none.
+ * @param parent the parent element.
+ * @param keyword the unit keyword (e.g. {@code "LengthUnit"} or {@code "AngleUnit"}).
+ * @param baseUnit the base unit, usually {@code Units.METRE} or {@code Units.RADIAN}.
+ * @return the {@code "UNIT"} element as an {@link Unit} object, or {@code null} if none.
* @throws ParseException if the {@code "UNIT"} can not be parsed.
*
* @todo Authority code is currently discarded after parsing. We may consider to create a subclass of
* {@link Unit} which implements {@link IdentifiedObject} in a future version.
*/
@SuppressWarnings("unchecked")
- private <Q extends Quantity> Unit<Q> parseScaledUnit(final Element parent,
+ private <Q extends Quantity<Q>> Unit<Q> parseScaledUnit(final Element parent,
final String keyword, final Unit<Q> baseUnit) throws ParseException
{
final Element element = parent.pullElement(OPTIONAL, keyword, WKTKeywords.Unit);
@@ -645,7 +644,7 @@ class GeodeticObjectParser extends MathT
* 2) if the new unit is not equivalent to the old one (i.e. different scale factor), log a warning.
*/
if (verify != null) {
- if (!baseUnit.toSI().equals(verify.toSI())) {
+ if (!baseUnit.getSystemUnit().equals(verify.getSystemUnit())) {
warning(parent, element, Errors.formatInternational(Errors.Keys.InconsistentUnitsForCS_1, verify), null);
} else if (Math.abs(unit.getConverterTo(unit = (Unit<Q>) verify).convert(1) - 1) > Numerics.COMPARISON_THRESHOLD) {
warning(parent, element, Errors.formatInternational(Errors.Keys.UnexpectedScaleFactorForUnit_2, verify, factor), null);
@@ -661,14 +660,14 @@ class GeodeticObjectParser extends MathT
if (verify == null) {
try {
verify = parseUnit(name);
- } catch (IllegalArgumentException | ParseException e) {
+ } catch (ParserException | ParseException e) {
log(new LogRecord(Level.FINE, e.toString()));
}
if (verify != null) try {
if (Math.abs(verify.getConverterToAny(unit).convert(1) - 1) > Numerics.COMPARISON_THRESHOLD) {
warning(parent, element, Errors.formatInternational(Errors.Keys.UnexpectedScaleFactorForUnit_2, verify, factor), null);
}
- } catch (ConversionException e) {
+ } catch (IncommensurableException e) {
throw (ParseException) new LocalizedParseException(errorLocale,
Errors.Keys.InconsistentUnitsForCS_1, new Object[] {verify}, element.offset).initCause(e);
}
@@ -706,13 +705,13 @@ class GeodeticObjectParser extends MathT
* <li>Otherwise if {@code dimension is 3}, then the CS is assumed to be for a geocentric CRS.</li>
* </ul>
*
- * @param parent The parent element.
- * @param type The expected type (Cartesian | ellipsoidal | vertical | etc\u2026), or null�if unknown.
- * @param dimension The minimal number of dimensions. Can be 1 if unknown.
- * @param isWKT1 {@code true} if the parent element is an element from the WKT 1 standard.
- * @param defaultUnit The contextual unit (usually {@code SI.METRE} or {@code SI.RADIAN}), or {@code null} if unknown.
- * @param datum The datum of the enclosing CRS, or {@code null} if unknown.
- * @return The {@code "CS"}, {@code "UNIT"} and/or {@code "AXIS"} elements as a Coordinate System, or {@code null}.
+ * @param parent the parent element.
+ * @param type the expected type (Cartesian | ellipsoidal | vertical | etc\u2026), or null�if unknown.
+ * @param dimension the minimal number of dimensions. Can be 1 if unknown.
+ * @param isWKT1 {@code true} if the parent element is an element from the WKT 1 standard.
+ * @param defaultUnit the contextual unit (usually {@code Units.METRE} or {@code Units.RADIAN}), or {@code null} if unknown.
+ * @param datum the datum of the enclosing CRS, or {@code null} if unknown.
+ * @return the {@code "CS"}, {@code "UNIT"} and/or {@code "AXIS"} elements as a Coordinate System, or {@code null}.
* @throws ParseException if an element can not be parsed.
* @throws FactoryException if the factory can not create the coordinate system.
*/
@@ -815,7 +814,7 @@ class GeodeticObjectParser extends MathT
if (dimension >= 3) { // Non-standard but SIS is tolerant to this case.
z = "h";
nz = AxisNames.ELLIPSOIDAL_HEIGHT;
- unit = SI.METRE;
+ unit = Units.METRE;
}
break;
}
@@ -841,7 +840,7 @@ class GeodeticObjectParser extends MathT
direction = AxisDirection.UP;
z = "h";
nz = AxisNames.ELLIPSOIDAL_HEIGHT;
- unit = SI.METRE;
+ unit = Units.METRE;
}
break;
}
@@ -1013,12 +1012,12 @@ class GeodeticObjectParser extends MathT
* AXIS["Easting (E(X))", EAST]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @param csType The coordinate system type (Cartesian | ellipsoidal | vertical | etc\u2026), or null�if unknown.
- * @param defaultUnit The contextual unit (usually {@code SI.METRE} or {@code SI.RADIAN}), or {@code null} if unknown.
- * @return The {@code "AXIS"} element as a {@link CoordinateSystemAxis} object, or {@code null}
- * if the axis was not required and there is no axis object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @param csType the coordinate system type (Cartesian | ellipsoidal | vertical | etc\u2026), or null�if unknown.
+ * @param defaultUnit the contextual unit (usually {@code Units.METRE} or {@code Units.RADIAN}), or {@code null} if unknown.
+ * @return the {@code "AXIS"} element as a {@link CoordinateSystemAxis} object,
+ * or {@code null} if the axis was not required and there is no axis object.
* @throws ParseException if the {@code "AXIS"} element can not be parsed.
*/
private CoordinateSystemAxis parseAxis(final int mode, final Element parent, final String csType,
@@ -1048,10 +1047,10 @@ class GeodeticObjectParser extends MathT
final Element meridian = element.pullElement(OPTIONAL, WKTKeywords.Meridian);
if (meridian != null) {
double angle = meridian.pullDouble("meridian");
- final Unit<Angle> m = parseScaledUnit(meridian, WKTKeywords.AngleUnit, SI.RADIAN);
+ final Unit<Angle> m = parseScaledUnit(meridian, WKTKeywords.AngleUnit, Units.RADIAN);
meridian.close(ignoredElements);
if (m != null) {
- angle = m.getConverterTo(NonSI.DEGREE_ANGLE).convert(angle);
+ angle = m.getConverterTo(Units.DEGREE).convert(angle);
}
direction = referencing.directionAlongMeridian(direction, angle);
}
@@ -1119,8 +1118,8 @@ class GeodeticObjectParser extends MathT
* some axes have an {@code ORDER} element (which is illegal according ISO 19162), then those axes will
* be sorted before the axes without {@code ORDER} element.
*
- * @param o1 The first axis to compare.
- * @param o2 The second axis to compare.
+ * @param o1 the first axis to compare.
+ * @param o2 the second axis to compare.
* @return -1 if {@code o1} should be before {@code o2},
* +1 if {@code o2} should be before {@code o1}, or
* 0 if undetermined (no axis order change).
@@ -1150,11 +1149,11 @@ class GeodeticObjectParser extends MathT
* PRIMEM["<name>", <longitude> {,<authority>}]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @param isWKT1 {@code true} if this method is invoked while parsing a WKT 1 element.
- * @param angularUnit The contextual unit.
- * @return The {@code "PrimeMeridian"} element as a {@link PrimeMeridian} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @param isWKT1 {@code true} if this method is invoked while parsing a WKT 1 element.
+ * @param angularUnit the contextual unit.
+ * @return the {@code "PrimeMeridian"} element as a {@link PrimeMeridian} object.
* @throws ParseException if the {@code "PrimeMeridian"} element can not be parsed.
*
* @see org.apache.sis.referencing.datum.DefaultPrimeMeridian#formatTo(Formatter)
@@ -1163,7 +1162,7 @@ class GeodeticObjectParser extends MathT
throws ParseException
{
if (isWKT1 && usesCommonUnits) {
- angularUnit = NonSI.DEGREE_ANGLE;
+ angularUnit = Units.DEGREE;
}
final Element element = parent.pullElement(mode, WKTKeywords.PrimeMeridian, WKTKeywords.PrimeM);
if (element == null) {
@@ -1171,7 +1170,7 @@ class GeodeticObjectParser extends MathT
}
final String name = element.pullString("name");
final double longitude = element.pullDouble("longitude");
- final Unit<Angle> unit = parseScaledUnit(element, WKTKeywords.AngleUnit, SI.RADIAN);
+ final Unit<Angle> unit = parseScaledUnit(element, WKTKeywords.AngleUnit, Units.RADIAN);
if (unit != null) {
angularUnit = unit;
} else if (angularUnit == null) {
@@ -1192,9 +1191,9 @@ class GeodeticObjectParser extends MathT
* TOWGS84[<dx>, <dy>, <dz>, <ex>, <ey>, <ez>, <ppm>]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @return The {@code "TOWGS84"} element as a {@link org.apache.sis.referencing.datum.BursaWolfParameters} object,
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @return the {@code "TOWGS84"} element as a {@link org.apache.sis.referencing.datum.BursaWolfParameters} object,
* or {@code null} if no {@code "TOWGS84"} has been found.
* @throws ParseException if the {@code "TOWGS84"} can not be parsed.
*/
@@ -1224,9 +1223,9 @@ class GeodeticObjectParser extends MathT
* SPHEROID["<name>", <semi-major axis>, <inverse flattening> {,<authority>}]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @return The {@code "Ellipsoid"} element as an {@link Ellipsoid} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @return the {@code "Ellipsoid"} element as an {@link Ellipsoid} object.
* @throws ParseException if the {@code "Ellipsoid"} element can not be parsed.
*
* @see org.apache.sis.referencing.datum.DefaultEllipsoid#formatTo(Formatter)
@@ -1239,9 +1238,9 @@ class GeodeticObjectParser extends MathT
final String name = element.pullString("name");
final double semiMajorAxis = element.pullDouble("semiMajorAxis");
double inverseFlattening = element.pullDouble("inverseFlattening");
- Unit<Length> unit = parseScaledUnit(element, WKTKeywords.LengthUnit, SI.METRE);
+ Unit<Length> unit = parseScaledUnit(element, WKTKeywords.LengthUnit, Units.METRE);
if (unit == null) {
- unit = SI.METRE;
+ unit = Units.METRE;
}
final Map<String,?> properties = parseMetadataAndClose(element, name, null);
try {
@@ -1271,9 +1270,9 @@ class GeodeticObjectParser extends MathT
/**
* Parses a {@code "Method"} (WKT 2) element, without the parameters.
*
- * @param parent The parent element.
- * @param keywords The element keywords.
- * @return The operation method.
+ * @param parent the parent element.
+ * @param keywords the element keywords.
+ * @return the operation method.
* @throws ParseException if the {@code "Method"} element can not be parsed.
*/
private OperationMethod parseMethod(final Element parent, final String... keywords) throws ParseException {
@@ -1319,12 +1318,12 @@ class GeodeticObjectParser extends MathT
* element which is itself inside the {@code ProjectedCRS} element. This is different than WKT 1, which
* puts this element right into the the {@code ProjectedCRS} element without {@code Conversion} wrapper.
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @param wrapper "Conversion" or "DerivingConversion" wrapper name, or null if parsing a WKT 1.
- * @param defaultUnit The unit (usually linear) of the parent element, or {@code null}.
- * @param defaultAngularUnit The angular unit of the sibling {@code GeographicCRS} element, or {@code null}.
- * @return The {@code "Method"} element and its parameters as a defining conversion.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @param wrapper "Conversion" or "DerivingConversion" wrapper name, or null if parsing a WKT 1.
+ * @param defaultUnit the unit (usually linear) of the parent element, or {@code null}.
+ * @param defaultAngularUnit the angular unit of the sibling {@code GeographicCRS} element, or {@code null}.
+ * @return the {@code "Method"} element and its parameters as a defining conversion.
* @throws ParseException if the {@code "Method"} element can not be parsed.
*/
private Conversion parseDerivingConversion(final int mode, Element parent, final String wrapper,
@@ -1389,10 +1388,10 @@ class GeodeticObjectParser extends MathT
* DATUM["<name>", <spheroid> {,<to wgs84>} {,<authority>}]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @param meridian the prime meridian, or {@code null} for Greenwich.
- * @return The {@code "Datum"} element as a {@link GeodeticDatum} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @param meridian the prime meridian, or {@code null} for Greenwich.
+ * @return the {@code "Datum"} element as a {@link GeodeticDatum} object.
* @throws ParseException if the {@code "Datum"} element can not be parsed.
*
* @see org.apache.sis.referencing.datum.DefaultGeodeticDatum#formatTo(Formatter)
@@ -1429,10 +1428,10 @@ class GeodeticObjectParser extends MathT
* VERT_DATUM["<name>", <datum type> {,<authority>}]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @param isWKT1 {@code true} if the parent is a WKT 1 element.
- * @return The {@code "VerticalDatum"} element as a {@link VerticalDatum} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @param isWKT1 {@code true} if the parent is a WKT 1 element.
+ * @return the {@code "VerticalDatum"} element as a {@link VerticalDatum} object.
* @throws ParseException if the {@code "VerticalDatum"} element can not be parsed.
*/
private VerticalDatum parseVerticalDatum(final int mode, final Element parent, final boolean isWKT1)
@@ -1467,9 +1466,9 @@ class GeodeticObjectParser extends MathT
* TimeDatum["<name>", TimeOrigin[<time origin>] {,<authority>}]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @return The {@code "TimeDatum"} element as a {@link TemporalDatum} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @return the {@code "TimeDatum"} element as a {@link TemporalDatum} object.
* @throws ParseException if the {@code "TimeDatum"} element can not be parsed.
*/
private TemporalDatum parseTimeDatum(final int mode, final Element parent) throws ParseException {
@@ -1495,9 +1494,9 @@ class GeodeticObjectParser extends MathT
* ParametricDatum["<name>", Anchor[...] {,<authority>}]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @return The {@code "ParametricDatum"} element as a {@link ParametricDatum} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @return the {@code "ParametricDatum"} element as a {@link ParametricDatum} object.
* @throws ParseException if the {@code "ParametricDatum"} element can not be parsed.
*/
private ParametricDatum parseParametricDatum(final int mode, final Element parent) throws ParseException {
@@ -1525,10 +1524,10 @@ class GeodeticObjectParser extends MathT
*
* The datum type (WKT 1 only) is currently ignored.
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @param isWKT1 {@code true} if the parent is a WKT 1 element.
- * @return The {@code "EngineeringDatum"} element as an {@link EngineeringDatum} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @param isWKT1 {@code true} if the parent is a WKT 1 element.
+ * @return the {@code "EngineeringDatum"} element as an {@link EngineeringDatum} object.
* @throws ParseException if the {@code "EngineeringDatum"} element can not be parsed.
*/
private EngineeringDatum parseEngineeringDatum(final int mode, final Element parent, final boolean isWKT1) throws ParseException {
@@ -1554,9 +1553,9 @@ class GeodeticObjectParser extends MathT
* Parses an {@code "ImageDatum"} (WKT 2) element. The syntax is given by
* <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#81">WKT 2 specification �12.2</a>.
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @return The {@code "ImageDatum"} element as an {@link ImageDatum} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @return the {@code "ImageDatum"} element as an {@link ImageDatum} object.
* @throws ParseException if the {@code "ImageDatum"} element can not be parsed.
*/
private ImageDatum parseImageDatum(final int mode, final Element parent) throws ParseException {
@@ -1584,10 +1583,10 @@ class GeodeticObjectParser extends MathT
* LOCAL_CS["<name>", <local datum>, <unit>, <axis>, {,<axis>}* {,<authority>}]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @param isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
- * @return The {@code "EngineeringCRS"} element as an {@link EngineeringCRS} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @param isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
+ * @return the {@code "EngineeringCRS"} element as an {@link EngineeringCRS} object.
* @throws ParseException if the {@code "EngineeringCRS"} element can not be parsed.
*/
private SingleCRS parseEngineeringCRS(final int mode, final Element parent, final boolean isBaseCRS)
@@ -1657,9 +1656,9 @@ class GeodeticObjectParser extends MathT
* Parses an {@code "ImageCRS"} (WKT 2) element. The syntax is given by
* <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#79">WKT 2 specification �12</a>.
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @return The {@code "ImageCRS"} element as an {@link ImageCRS} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @return the {@code "ImageCRS"} element as an {@link ImageCRS} object.
* @throws ParseException if the {@code "ImageCRS"} element can not be parsed.
*/
private ImageCRS parseImageCRS(final int mode, final Element parent) throws ParseException {
@@ -1699,12 +1698,12 @@ class GeodeticObjectParser extends MathT
* GEOCCS["<name>", <datum>, <prime meridian>, <linear unit> {,<axis> ,<axis> ,<axis>} {,<authority>}]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @param dimension The minimal number of dimensions (usually 2).
- * @param csType The default coordinate system type, or {@code null} if unknown.
- * Should be non-null only when parsing a {@link GeneralDerivedCRS#getBaseCRS()} component.
- * @return The {@code "GeodeticCRS"} element as a {@link GeographicCRS} or {@link GeocentricCRS} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @param dimension the minimal number of dimensions (usually 2).
+ * @param csType the default coordinate system type, or {@code null} if unknown.
+ * Should be non-null only when parsing a {@link GeneralDerivedCRS#getBaseCRS()} component.
+ * @return the {@code "GeodeticCRS"} element as a {@link GeographicCRS} or {@link GeocentricCRS} object.
* @throws ParseException if the {@code "GeodeticCRS"} element can not be parsed.
*
* @see org.apache.sis.referencing.crs.DefaultGeographicCRS#formatTo(Formatter)
@@ -1749,7 +1748,7 @@ class GeodeticObjectParser extends MathT
if (Units.isAngular(csUnit)) {
angularUnit = csUnit.asType(Angle.class);
} else {
- angularUnit = NonSI.DEGREE_ANGLE;
+ angularUnit = Units.DEGREE;
if (csUnit == null) {
/*
* A UNIT[\u2026] is mandatory either in the CoordinateSystem as a whole (csUnit != null),
@@ -1758,7 +1757,7 @@ class GeodeticObjectParser extends MathT
* We recognize those cases by a non-null 'csType' given in argument to this method.
*/
if (WKTKeywords.ellipsoidal.equals(csType)) {
- csUnit = NonSI.DEGREE_ANGLE; // For BaseGeodCRS in ProjectedCRS.
+ csUnit = Units.DEGREE; // For BaseGeodCRS in ProjectedCRS.
}
}
}
@@ -1770,7 +1769,7 @@ class GeodeticObjectParser extends MathT
*/
isWKT1 = true;
csType = WKTKeywords.ellipsoidal;
- angularUnit = parseScaledUnit(element, WKTKeywords.AngleUnit, SI.RADIAN);
+ angularUnit = parseScaledUnit(element, WKTKeywords.AngleUnit, Units.RADIAN);
csUnit = angularUnit;
dimension = 2;
break;
@@ -1781,8 +1780,8 @@ class GeodeticObjectParser extends MathT
*/
isWKT1 = true;
csType = WKTKeywords.Cartesian;
- angularUnit = NonSI.DEGREE_ANGLE;
- csUnit = parseScaledUnit(element, WKTKeywords.LengthUnit, SI.METRE);
+ angularUnit = Units.DEGREE;
+ csUnit = parseScaledUnit(element, WKTKeywords.LengthUnit, Units.METRE);
dimension = 3;
break;
}
@@ -1866,10 +1865,10 @@ class GeodeticObjectParser extends MathT
* VERT_CS["<name>", <vert datum>, <linear unit>, {<axis>,} {,<authority>}]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @param isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
- * @return The {@code "VerticalCRS"} element as a {@link VerticalCRS} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @param isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
+ * @return the {@code "VerticalCRS"} element as a {@link VerticalCRS} object.
* @throws ParseException if the {@code "VerticalCRS"} element can not be parsed.
*/
@SuppressWarnings("null")
@@ -1951,10 +1950,10 @@ class GeodeticObjectParser extends MathT
/**
* Parses {@code "TimeCRS"} element.
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @param isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
- * @return The {@code "TimeCRS"} element as a {@link TemporalCRS} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @param isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
+ * @return the {@code "TimeCRS"} element as a {@link TemporalCRS} object.
* @throws ParseException if the {@code "TimeCRS"} element can not be parsed.
*/
private SingleCRS parseTimeCRS(final int mode, final Element parent, final boolean isBaseCRS)
@@ -1964,8 +1963,8 @@ class GeodeticObjectParser extends MathT
if (element == null) {
return null;
}
- final String name = element.pullString("name");
- final Unit<Duration> unit = parseScaledUnit(element, WKTKeywords.TimeUnit, SI.SECOND);
+ final String name = element.pullString("name");
+ final Unit<Time> unit = parseScaledUnit(element, WKTKeywords.TimeUnit, Units.SECOND);
/*
* A TemporalCRS can be either a "normal" one (with a non-null datum), or a DerivedCRS of kind TemporalCRS.
* In the later case, the datum is null and we have instead DerivingConversion element from a BaseTimeCRS.
@@ -2011,10 +2010,10 @@ class GeodeticObjectParser extends MathT
/**
* Parses {@code "ParametricCRS"} element.
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @param isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
- * @return The {@code "ParametricCRS"} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @param isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
+ * @return the {@code "ParametricCRS"} object.
* @throws ParseException if the {@code "ParametricCRS"} element can not be parsed.
*/
private SingleCRS parseParametricCRS(final int mode, final Element parent, final boolean isBaseCRS)
@@ -2079,10 +2078,10 @@ class GeodeticObjectParser extends MathT
* <linear unit> {,<twin axes>}{,<authority>}]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @param isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
- * @return The {@code "ProjectedCRS"} element as a {@link ProjectedCRS} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @param isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
+ * @return the {@code "ProjectedCRS"} element as a {@link ProjectedCRS} object.
* @throws ParseException if the {@code "ProjectedCRS"} element can not be parsed.
*/
private ProjectedCRS parseProjectedCRS(final int mode, final Element parent, final boolean isBaseCRS)
@@ -2114,15 +2113,15 @@ class GeodeticObjectParser extends MathT
* - lengths shall be given in the unit for the projected CRS axes.
* - angles shall be given in the unit for the base geographic CRS of the projected CRS.
*/
- Unit<Length> csUnit = parseScaledUnit(element, WKTKeywords.LengthUnit, SI.METRE);
+ Unit<Length> csUnit = parseScaledUnit(element, WKTKeywords.LengthUnit, Units.METRE);
final Unit<Length> linearUnit;
final Unit<Angle> angularUnit;
if (isWKT1 && usesCommonUnits) {
- linearUnit = SI.METRE;
- angularUnit = NonSI.DEGREE_ANGLE;
+ linearUnit = Units.METRE;
+ angularUnit = Units.DEGREE;
} else {
linearUnit = csUnit;
- angularUnit = AxisDirections.getAngularUnit(geoCRS.getCoordinateSystem(), NonSI.DEGREE_ANGLE);
+ angularUnit = AxisDirections.getAngularUnit(geoCRS.getCoordinateSystem(), Units.DEGREE);
}
final Conversion conversion = parseDerivingConversion(MANDATORY, element,
isWKT1 ? null : WKTKeywords.Conversion, linearUnit, angularUnit);
@@ -2135,7 +2134,7 @@ class GeodeticObjectParser extends MathT
* in the WKT of base CRS. In this case only, we will default to metre.
*/
if (csUnit == null && isBaseCRS) {
- csUnit = SI.METRE;
+ csUnit = Units.METRE;
}
final CoordinateSystem cs;
try {
@@ -2163,9 +2162,9 @@ class GeodeticObjectParser extends MathT
* In the particular case where there is a geographic CRS and an ellipsoidal height,
* this method rather build a three-dimensional geographic CRS.
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @return The {@code "CompoundCRS"} element as a {@link CompoundCRS} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @return the {@code "CompoundCRS"} element as a {@link CompoundCRS} object.
* @throws ParseException if the {@code "CompoundCRS"} element can not be parsed.
*/
private CoordinateReferenceSystem parseCompoundCRS(final int mode, final Element parent) throws ParseException {
@@ -2195,9 +2194,9 @@ class GeodeticObjectParser extends MathT
* FITTED_CS["<name>", <to base>, <base cs>]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @return The {@code "FITTED_CS"} element as a {@link CompoundCRS} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @return the {@code "FITTED_CS"} element as a {@link CompoundCRS} object.
* @throws ParseException if the {@code "COMPD_CS"} element can not be parsed.
*/
private DerivedCRS parseFittedCS(final int mode, final Element parent) throws ParseException {
@@ -2228,7 +2227,7 @@ class GeodeticObjectParser extends MathT
buffer.append(number);
axes[i] = csFactory.createCoordinateSystemAxis(
singletonMap(CoordinateSystemAxis.NAME_KEY, buffer.toString()),
- number, AxisDirection.OTHER, Unit.ONE);
+ number, AxisDirection.OTHER, Units.ONE);
}
final Map<String,Object> properties = parseMetadataAndClose(element, name, baseCRS);
final CoordinateSystem derivedCS = referencing.createAbstractCS(
@@ -2248,9 +2247,9 @@ class GeodeticObjectParser extends MathT
* Parses a {@code "CoordinateOperation"} element. The syntax is given by
* <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#113">WKT 2 specification �17</a>.
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @return The {@code "CoordinateOperation"} element as a {@link CoordinateOperation} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @return the {@code "CoordinateOperation"} element as a {@link CoordinateOperation} object.
* @throws ParseException if the {@code "CoordinateOperation"} element can not be parsed.
*/
private CoordinateOperation parseOperation(final int mode, final Element parent) throws ParseException {
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -22,10 +22,9 @@ import java.util.Locale;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.ParseException;
-import javax.measure.unit.SI;
-import javax.measure.unit.Unit;
-import javax.measure.unit.UnitFormat;
+import javax.measure.Unit;
import javax.measure.quantity.Angle;
+import javax.measure.format.ParserException;
import org.opengis.util.FactoryException;
import org.opengis.util.NoSuchIdentifierException;
import org.opengis.parameter.ParameterValue;
@@ -43,6 +42,7 @@ import org.apache.sis.internal.metadata.
import org.apache.sis.internal.util.LocalizedParseException;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.measure.Units;
+import org.apache.sis.measure.UnitFormat;
import org.apache.sis.util.Numbers;
import org.apache.sis.util.resources.Errors;
@@ -57,7 +57,7 @@ import static org.apache.sis.util.Argume
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Rueben Schulz (UBC)
* @since 0.6
- * @version 0.6
+ * @version 0.8
* @module
*
* @see <a href="http://www.geoapi.org/snapshot/javadoc/org/opengis/referencing/doc-files/WKT.html">Well Know Text specification</a>
@@ -82,7 +82,7 @@ class MathTransformParser extends Abstra
* For each {@code UNIT_KEYWORDS[i]} element, the associated base unit is {@code BASE_UNIT[i]}.
*/
private static final Unit<?>[] BASE_UNITS = {
- SI.METRE, SI.RADIAN, Unit.ONE, SI.SECOND
+ Units.METRE, Units.RADIAN, Units.ONE, Units.SECOND
};
/**
@@ -110,7 +110,7 @@ class MathTransformParser extends Abstra
* Do not change the method signature even if it doesn't break the compilation, unless the reflection code
* is also updated.</p>
*
- * @param mtFactory The factory to use to create {@link MathTransform} objects.
+ * @param mtFactory the factory to use to create {@link MathTransform} objects.
*/
public MathTransformParser(final MathTransformFactory mtFactory) {
this(Symbols.getDefault(), Collections.<String,Element>emptyMap(), null, null, null, mtFactory, null);
@@ -119,13 +119,13 @@ class MathTransformParser extends Abstra
/**
* Creates a parser using the specified set of symbols and factory.
*
- * @param symbols The set of symbols to use.
- * @param fragments Reference to the {@link WKTFormat#fragments} map, or an empty map if none.
- * @param numberFormat The number format provided by {@link WKTFormat}, or {@code null} for a default format.
- * @param dateFormat The date format provided by {@link WKTFormat}, or {@code null} for a default format.
- * @param unitFormat The unit format provided by {@link WKTFormat}, or {@code null} for a default format.
- * @param mtFactory The factory to use to create {@link MathTransform} objects.
- * @param errorLocale The locale for error messages (not for parsing), or {@code null} for the system default.
+ * @param symbols the set of symbols to use.
+ * @param fragments reference to the {@link WKTFormat#fragments} map, or an empty map if none.
+ * @param numberFormat the number format provided by {@link WKTFormat}, or {@code null} for a default format.
+ * @param dateFormat the date format provided by {@link WKTFormat}, or {@code null} for a default format.
+ * @param unitFormat the unit format provided by {@link WKTFormat}, or {@code null} for a default format.
+ * @param mtFactory the factory to use to create {@link MathTransform} objects.
+ * @param errorLocale the locale for error messages (not for parsing), or {@code null} for the system default.
*/
MathTransformParser(final Symbols symbols, final Map<String,Element> fragments,
final NumberFormat numberFormat, final DateFormat dateFormat, final UnitFormat unitFormat,
@@ -148,8 +148,8 @@ class MathTransformParser extends Abstra
/**
* Parses the next element in the specified <cite>Well Know Text</cite> (WKT) tree.
*
- * @param element The element to be parsed.
- * @return The parsed object, or {@code null} if the element is not recognized.
+ * @param element the element to be parsed.
+ * @return the parsed object, or {@code null} if the element is not recognized.
* @throws ParseException if the element can not be parsed.
*/
@Override
@@ -160,9 +160,9 @@ class MathTransformParser extends Abstra
/**
* Parses the next {@code MathTransform} in the specified <cite>Well Know Text</cite> (WKT) tree.
*
- * @param element The parent element.
- * @param mandatory {@code true} if a math transform must be present, or {@code false} if optional.
- * @return The next element as a {@code MathTransform} object, or {@code null}.
+ * @param element the parent element.
+ * @param mandatory {@code true} if a math transform must be present, or {@code false} if optional.
+ * @return the next element as a {@code MathTransform} object, or {@code null}.
* @throws ParseException if the next element can not be parsed.
*/
final MathTransform parseMathTransform(final Element element, final boolean mandatory) throws ParseException {
@@ -195,8 +195,8 @@ class MathTransformParser extends Abstra
* and 9111) can hardly be expressed in an other way than by their EPSG code. Thankfully, identifiers in
* {@code UNIT} elements are rare, so risk of conflicts should be low.</div>
*
- * @param parent The parent {@code "UNIT"} element.
- * @return The unit from the identifier code, or {@code null} if none.
+ * @param parent the parent {@code "UNIT"} element.
+ * @return the unit from the identifier code, or {@code null} if none.
* @throws ParseException if the {@code "ID"} can not be parsed.
*/
final Unit<?> parseUnitID(final Element parent) throws ParseException {
@@ -224,8 +224,8 @@ class MathTransformParser extends Abstra
* Parses an optional {@code "UNIT"} element of unknown dimension.
* This method tries to infer the quantity dimension from the unit keyword.
*
- * @param parent The parent element.
- * @return The {@code "UNIT"} element, or {@code null} if none.
+ * @param parent the parent element.
+ * @return the {@code "UNIT"} element, or {@code null} if none.
* @throws ParseException if the {@code "UNIT"} can not be parsed.
*/
final Unit<?> parseUnit(final Element parent) throws ParseException {
@@ -247,7 +247,7 @@ class MathTransformParser extends Abstra
// If we can not infer the base type, we have to rely on the name.
try {
return parseUnit(name);
- } catch (IllegalArgumentException e) {
+ } catch (ParserException e) {
throw (ParseException) new LocalizedParseException(errorLocale,
Errors.Keys.UnknownUnit_1, new Object[] {name}, element.offset).initCause(e);
}
@@ -256,17 +256,17 @@ class MathTransformParser extends Abstra
/**
* Parses a sequence of {@code "PARAMETER"} elements.
*
- * @param element The parent element containing the parameters to parse.
- * @param parameters The group where to store the parameter values.
- * @param defaultUnit The default unit (for arbitrary quantity, including angular), or {@code null}.
- * @param defaultAngularUnit The default angular unit, or {@code null} if none. This is determined by the
- * context, especially when {@link GeodeticObjectParser} parses a {@code ProjectedCRS} element.
+ * @param element the parent element containing the parameters to parse.
+ * @param parameters the group where to store the parameter values.
+ * @param defaultUnit the default unit (for arbitrary quantity, including angular), or {@code null}.
+ * @param defaultAngularUnit the default angular unit, or {@code null} if none. This is determined by the context,
+ * especially when {@link GeodeticObjectParser} parses a {@code ProjectedCRS} element.
* @throws ParseException if the {@code "PARAMETER"} element can not be parsed.
*/
final void parseParameters(final Element element, final ParameterValueGroup parameters,
final Unit<?> defaultUnit, final Unit<Angle> defaultAngularUnit) throws ParseException
{
- final Unit<?> defaultSI = (defaultUnit != null) ? defaultUnit.toSI() : null;
+ final Unit<?> defaultSI = (defaultUnit != null) ? defaultUnit.getSystemUnit(): null;
Element param = element;
try {
while ((param = element.pullElement(OPTIONAL, WKTKeywords.Parameter)) != null) {
@@ -287,10 +287,10 @@ class MathTransformParser extends Abstra
if (isNumeric && unit == null) {
unit = descriptor.getUnit();
if (unit != null) {
- final Unit<?> si = unit.toSI();
+ final Unit<?> si = unit.getSystemUnit();
if (si.equals(defaultSI)) {
unit = defaultUnit;
- } else if (si.equals(SI.RADIAN)) {
+ } else if (si.equals(Units.RADIAN)) {
unit = defaultAngularUnit;
}
}
@@ -325,8 +325,8 @@ class MathTransformParser extends Abstra
* PARAM_MT["<classification-name>" {,<parameter>}* ]
* }
*
- * @param parent The parent element.
- * @return The {@code "PARAM_MT"} element as an {@link MathTransform} object.
+ * @param parent the parent element.
+ * @return the {@code "PARAM_MT"} element as an {@link MathTransform} object.
* @throws ParseException if the {@code "PARAM_MT"} element can not be parsed.
*/
private MathTransform parseParamMT(final Element parent) throws ParseException {
@@ -367,8 +367,8 @@ class MathTransformParser extends Abstra
* INVERSE_MT[<math transform>]
* }
*
- * @param parent The parent element.
- * @return The {@code "INVERSE_MT"} element as an {@link MathTransform} object.
+ * @param parent the parent element.
+ * @return the {@code "INVERSE_MT"} element as an {@link MathTransform} object.
* @throws ParseException if the {@code "INVERSE_MT"} element can not be parsed.
*/
private MathTransform parseInverseMT(final Element parent) throws ParseException {
@@ -393,8 +393,8 @@ class MathTransformParser extends Abstra
* PASSTHROUGH_MT[<integer>, <math transform>]
* }
*
- * @param parent The parent element.
- * @return The {@code "PASSTHROUGH_MT"} element as an {@link MathTransform} object.
+ * @param parent the parent element.
+ * @return the {@code "PASSTHROUGH_MT"} element as an {@link MathTransform} object.
* @throws ParseException if the {@code "PASSTHROUGH_MT"} element can not be parsed.
*/
private MathTransform parsePassThroughMT(final Element parent) throws ParseException {
@@ -419,9 +419,9 @@ class MathTransformParser extends Abstra
* CONCAT_MT[<math transform> {,<math transform>}*]
* }
*
- * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
- * @param parent The parent element.
- * @return The {@code "CONCAT_MT"} element as an {@link MathTransform} object.
+ * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+ * @param parent the parent element.
+ * @return the {@code "CONCAT_MT"} element as an {@link MathTransform} object.
* @throws ParseException if the {@code "CONCAT_MT"} element can not be parsed.
*/
private MathTransform parseConcatMT(final Element parent) throws ParseException {
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/VerticalInfo.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/VerticalInfo.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/VerticalInfo.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/VerticalInfo.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -18,7 +18,7 @@ package org.apache.sis.io.wkt;
import java.util.Map;
import java.util.Collections;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import javax.measure.quantity.Length;
import org.opengis.util.FactoryException;
import org.opengis.referencing.IdentifiedObject;
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -29,8 +29,7 @@ import java.text.NumberFormat;
import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.ParseException;
-import javax.measure.unit.Unit;
-import javax.measure.unit.UnitFormat;
+import javax.measure.Unit;
import org.opengis.util.Factory;
import org.opengis.util.InternationalString;
import org.opengis.metadata.citation.Citation;
@@ -41,6 +40,7 @@ import org.opengis.referencing.datum.Dat
import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.CoordinateOperationFactory;
import org.apache.sis.io.CompoundFormat;
+import org.apache.sis.measure.UnitFormat;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
@@ -110,7 +110,7 @@ import org.apache.sis.internal.jdk8.JDK8
* @author Martin Desruisseaux (Geomatys)
* @author R�mi Eve (IRD)
* @since 0.4
- * @version 0.6
+ * @version 0.8
* @module
*
* @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">WKT 2 specification</a>
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -16,7 +16,7 @@
*/
package org.apache.sis.metadata.iso.content;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import javax.measure.quantity.Length;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultSampleDimension.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -16,7 +16,7 @@
*/
package org.apache.sis.metadata.iso.content;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -19,7 +19,7 @@ package org.apache.sis.metadata.iso.dist
import java.util.AbstractSet;
import java.util.Collection;
import java.util.Iterator;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -19,7 +19,7 @@ package org.apache.sis.metadata.iso.exte
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import org.opengis.geometry.Envelope;
import org.opengis.temporal.TemporalPrimitive;
import org.opengis.metadata.extent.Extent;
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultQuantitativeResult.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultQuantitativeResult.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultQuantitativeResult.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultQuantitativeResult.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -17,7 +17,7 @@
package org.apache.sis.metadata.iso.quality;
import java.util.List;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -16,8 +16,6 @@
*/
package org.apache.sis.io.wkt;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
import org.opengis.util.CodeList;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.metadata.extent.GeographicBoundingBox;
@@ -40,7 +38,7 @@ import static org.apache.sis.test.Metada
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.5
+ * @version 0.8
* @module
*/
@DependsOn({ConventionTest.class, SymbolsTest.class, ColorsTest.class})
@@ -103,12 +101,12 @@ public final strictfp class FormatterTes
*/
@Test
public void testAppendUnit() {
- assertWktEquals(Convention.WKT2, "LENGTHUNIT[\u201cmetre\u201d, 1]", SI.METRE);
- assertWktEquals(Convention.WKT2, "ANGLEUNIT[\u201cdegree\u201d, 0.017453292519943295]", NonSI.DEGREE_ANGLE);
+ assertWktEquals(Convention.WKT2, "LENGTHUNIT[\u201cmetre\u201d, 1]", Units.METRE);
+ assertWktEquals(Convention.WKT2, "ANGLEUNIT[\u201cdegree\u201d, 0.017453292519943295]", Units.DEGREE);
assertWktEquals(Convention.WKT2, "SCALEUNIT[\u201cparts per million\u201d, 1.0E-6]", Units.PPM);
- assertWktEquals(Convention.WKT1, "UNIT[\u201cmetre\u201d, 1]", SI.METRE);
- assertWktEquals(Convention.WKT1, "UNIT[\u201cdegree\u201d, 0.017453292519943295]", NonSI.DEGREE_ANGLE);
+ assertWktEquals(Convention.WKT1, "UNIT[\u201cmetre\u201d, 1]", Units.METRE);
+ assertWktEquals(Convention.WKT1, "UNIT[\u201cdegree\u201d, 0.017453292519943295]", Units.DEGREE);
assertWktEquals(Convention.WKT1, "UNIT[\u201cparts per million\u201d, 1.0E-6]", Units.PPM);
}
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -17,7 +17,6 @@
package org.apache.sis.metadata;
import java.util.Arrays;
-import javax.measure.unit.SI;
import org.opengis.metadata.citation.Role;
import org.opengis.metadata.citation.PresentationForm;
import org.apache.sis.util.collection.TableColumn;
@@ -31,6 +30,7 @@ import org.apache.sis.metadata.iso.citat
import org.apache.sis.metadata.iso.content.DefaultAttributeGroup;
import org.apache.sis.metadata.iso.identification.DefaultDataIdentification;
import org.apache.sis.metadata.iso.lineage.DefaultProcessing;
+import org.apache.sis.measure.Units;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -70,7 +70,7 @@ public final strictfp class TreeTableFor
final DefaultBand band = new DefaultBand();
band.setMinValue(min);
band.setMaxValue(max);
- band.setUnits(SI.CENTIMETRE);
+ band.setUnits(Units.CENTIMETRE);
return band;
}
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -19,10 +19,9 @@ package org.apache.sis.metadata.iso.exte
import java.util.List;
import java.util.Arrays;
import java.util.Collections;
-import javax.measure.unit.SI;
-import javax.measure.unit.Unit;
-import javax.measure.converter.UnitConverter;
-import javax.measure.converter.ConversionException;
+import javax.measure.Unit;
+import javax.measure.UnitConverter;
+import javax.measure.IncommensurableException;
import org.opengis.metadata.extent.GeographicBoundingBox;
import org.apache.sis.measure.Units;
import org.apache.sis.measure.MeasurementRange;
@@ -44,7 +43,7 @@ import static org.junit.Assert.*;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.6
+ * @version 0.8
* @module
*/
@DependsOn(DefaultGeographicBoundingBoxTest.class)
@@ -57,11 +56,11 @@ public final strictfp class ExtentsTest
/**
* Tests {@link Extents#getVerticalRange(Extent)}.
*
- * @throws ConversionException should never happen in this test.
+ * @throws IncommensurableException if a conversion between incompatible units were attempted.
*/
@Test
@SuppressWarnings("null")
- public void testGetVerticalRange() throws ConversionException {
+ public void testGetVerticalRange() throws IncommensurableException {
final List<DefaultVerticalExtent> extents = Arrays.asList(
new DefaultVerticalExtent( -200, -100, VerticalCRSMock.HEIGHT),
new DefaultVerticalExtent( 150, 300, VerticalCRSMock.DEPTH),
@@ -80,7 +79,7 @@ public final strictfp class ExtentsTest
unit = e.getVerticalCRS().getCoordinateSystem().getAxis(0).getUnit();
if (Units.isLinear(unit)) break;
}
- final UnitConverter c = unit.getConverterToAny(SI.METRE);
+ final UnitConverter c = unit.getConverterToAny(Units.METRE);
/*
* The actual test. Arbitrarily compare the heights in metres, converting them if needed.
*/
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -22,8 +22,8 @@ package org.apache.sis.geometry;
* force installation of the Java2D module (e.g. JavaFX/SWT).
*/
import java.io.Serializable;
-import javax.measure.unit.Unit;
-import javax.measure.converter.ConversionException;
+import javax.measure.Unit;
+import javax.measure.IncommensurableException;
import org.opengis.geometry.Envelope;
import org.opengis.geometry.DirectPosition;
import org.opengis.geometry.MismatchedDimensionException;
@@ -110,7 +110,7 @@ import java.util.Objects;
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3
- * @version 0.4
+ * @version 0.8
* @module
*/
public abstract class AbstractEnvelope implements Envelope, Emptiable {
@@ -488,10 +488,10 @@ public abstract class AbstractEnvelope i
* @param unit The unit for the return value.
* @return The span in terms of the given unit.
* @throws IndexOutOfBoundsException If the given index is out of bounds.
- * @throws ConversionException if the length can't be converted to the specified units.
+ * @throws IncommensurableException if the length can't be converted to the specified units.
*/
public double getSpan(final int dimension, final Unit<?> unit)
- throws IndexOutOfBoundsException, ConversionException
+ throws IndexOutOfBoundsException, IncommensurableException
{
double value = getSpan(dimension);
final CoordinateSystemAxis axis = getAxis(getCoordinateReferenceSystem(), dimension);
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationMethod.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -20,7 +20,7 @@ import java.util.Map;
import java.util.Collection;
import java.util.Collections;
import javax.xml.bind.annotation.XmlElement;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import org.opengis.util.FactoryException;
import org.opengis.metadata.Identifier;
import org.opengis.parameter.GeneralParameterValue;
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationParameter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationParameter.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationParameter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_OperationParameter.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -18,14 +18,13 @@ package org.apache.sis.internal.jaxb.ref
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlElement;
-import javax.measure.unit.Unit;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
+import javax.measure.Unit;
import org.opengis.parameter.ParameterValue;
import org.opengis.parameter.ParameterDescriptor;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.jaxb.gco.PropertyType;
import org.apache.sis.measure.MeasurementRange;
+import org.apache.sis.measure.Units;
import org.apache.sis.parameter.DefaultParameterDescriptor;
@@ -39,7 +38,7 @@ import org.apache.sis.parameter.DefaultP
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.8
* @module
*/
public final class CC_OperationParameter extends PropertyType<CC_OperationParameter, ParameterDescriptor<?>> {
@@ -135,9 +134,9 @@ public final class CC_OperationParameter
valueClass = value.getClass();
Unit<?> unit = ((ParameterValue<?>) parent).getUnit();
if (unit != null) {
- unit = unit.toSI();
- if (SI.RADIAN.equals(unit)) {
- unit = NonSI.DEGREE_ANGLE;
+ unit = unit.getSystemUnit();
+ if (Units.RADIAN.equals(unit)) {
+ unit = Units.DEGREE;
}
assert (valueClass == Double.class) || (valueClass == double[].class) : valueClass;
valueDomain = MeasurementRange.create(Double.NEGATIVE_INFINITY, false,
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameter.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameter.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -18,8 +18,9 @@ package org.apache.sis.internal.jaxb.ref
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import org.opengis.referencing.datum.Ellipsoid;
+import org.apache.sis.measure.Units;
import org.apache.sis.xml.Namespaces;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.jaxb.gml.Measure;
@@ -34,7 +35,7 @@ import org.apache.sis.util.resources.Err
* @author C�dric Brian�on (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.8
* @module
*/
@XmlRootElement(name = "SecondDefiningParameter", namespace = Namespaces.GML)
@@ -72,7 +73,7 @@ public final class SecondDefiningParamet
secondDefiningParameter = new SecondDefiningParameter(ellipsoid, false);
} else {
if (ellipsoid.isIvfDefinitive()) {
- measure = new Measure(ellipsoid.getInverseFlattening(), Unit.ONE);
+ measure = new Measure(ellipsoid.getInverseFlattening(), Units.ONE);
} else {
measure = new Measure(ellipsoid.getSemiMinorAxis(), ellipsoid.getAxisUnit());
}
@@ -85,7 +86,7 @@ public final class SecondDefiningParamet
* @return {@code true} if the measure is the inverse of the flattening value.
*/
public boolean isIvfDefinitive() {
- return (measure != null) && Unit.ONE.equals(measure.unit);
+ return (measure != null) && Units.ONE.equals(measure.unit);
}
/**
@@ -130,7 +131,7 @@ public final class SecondDefiningParamet
* @param measure The inverse flattening value.
*/
public void setInverseFlattening(final Measure measure) {
- if (measure.setUnit(Unit.ONE)) {
+ if (measure.setUnit(Units.ONE)) {
Context.warningOccured(Context.current(), SecondDefiningParameter.class, "setInverseFlattening",
Errors.class, Errors.Keys.IncompatiblePropertyValue_1, "uom");
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -17,7 +17,7 @@
package org.apache.sis.internal.referencing;
import java.util.Set;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import org.apache.sis.measure.NumberRange;
import org.apache.sis.internal.util.CollectionsExt;
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -19,8 +19,8 @@ package org.apache.sis.internal.referenc
import java.util.Map;
import java.util.Date;
import java.util.Collections;
-import javax.measure.unit.Unit;
-import javax.measure.quantity.Duration;
+import javax.measure.Unit;
+import javax.measure.quantity.Time;
import org.opengis.util.FactoryException;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.parameter.ParameterNotFoundException;
@@ -58,7 +58,7 @@ import org.apache.sis.referencing.Common
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
- * @version 0.7
+ * @version 0.8
* @module
*/
public class GeodeticObjectBuilder extends Builder<GeodeticObjectBuilder> {
@@ -268,10 +268,10 @@ public class GeodeticObjectBuilder exten
* ProjectedCRS crs = builder
* .setConversionMethod("Lambert Conic Conformal (1SP)")
* .setConversionName("Lambert zone II")
- * .setParameter("Latitude of natural origin", 52, NonSI.GRADE)
- * .setParameter("Scale factor at natural origin", 0.99987742, Unit.ONE)
- * .setParameter("False easting", 600000, SI.METRE)
- * .setParameter("False northing", 2200000, SI.METRE)
+ * .setParameter("Latitude of natural origin", 52, Units.GRAD)
+ * .setParameter("Scale factor at natural origin", 0.99987742, Units.ONE)
+ * .setParameter("False easting", 600000, Units.METRE)
+ * .setParameter("False northing", 2200000, Units.METRE)
* .addName("NTF (Paris) / Lambert zone II")
* .createProjectedCRS(baseCRS, derivedCS);
* }
@@ -318,7 +318,7 @@ public class GeodeticObjectBuilder exten
* @return a temporal CRS using the given origin and units.
* @throws FactoryException if an error occurred while building the temporal CRS.
*/
- public TemporalCRS createTemporalCRS(final Date origin, final Unit<Duration> unit) throws FactoryException {
+ public TemporalCRS createTemporalCRS(final Date origin, final Unit<Time> unit) throws FactoryException {
/*
* Try to use one of the pre-defined datum and coordinate system if possible.
* This not only saves a little bit of memory, but also provides better names.
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java?rev=1764677&r1=1764676&r2=1764677&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java [UTF-8] Thu Oct 13 13:50:40 2016
@@ -16,11 +16,11 @@
*/
package org.apache.sis.internal.referencing;
-import javax.measure.unit.SI;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
import javax.measure.quantity.Length;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CartesianCS;
+import org.apache.sis.measure.Units;
import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.referencing.cs.AxisFilter;
import org.apache.sis.referencing.cs.CoordinateSystems;
@@ -40,7 +40,7 @@ import static org.opengis.referencing.Id
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.7
+ * @version 0.8
* @module
*/
public final class Legacy {
@@ -57,9 +57,9 @@ public final class Legacy {
* the invalid names and directions for WKT 1 parsing/formatting purposes.
*/
private static final CartesianCS LEGACY = new DefaultCartesianCS(singletonMap(NAME_KEY, "Legacy geocentric"),
- new DefaultCoordinateSystemAxis(singletonMap(NAME_KEY, "X"), "X", AxisDirection.OTHER, SI.METRE),
- new DefaultCoordinateSystemAxis(singletonMap(NAME_KEY, "Y"), "Y", AxisDirection.EAST, SI.METRE),
- new DefaultCoordinateSystemAxis(singletonMap(NAME_KEY, "Z"), "Z", AxisDirection.NORTH, SI.METRE));
+ new DefaultCoordinateSystemAxis(singletonMap(NAME_KEY, "X"), "X", AxisDirection.OTHER, Units.METRE),
+ new DefaultCoordinateSystemAxis(singletonMap(NAME_KEY, "Y"), "Y", AxisDirection.EAST, Units.METRE),
+ new DefaultCoordinateSystemAxis(singletonMap(NAME_KEY, "Z"), "Z", AxisDirection.NORTH, Units.METRE));
/**
* Do not allow instantiation of this class.
@@ -104,7 +104,7 @@ public final class Legacy {
/**
* Returns the coordinate system of a geocentric CRS using axes in the given unit of measurement.
- * This method presumes that the given {@code cs} uses {@link SI#METRE} (this is not verified).
+ * This method presumes that the given {@code cs} uses {@link Units#METRE} (this is not verified).
*
* @param cs The coordinate system for which to perform the unit replacement.
* @param unit The unit of measurement for the geocentric CRS axes.
@@ -113,7 +113,7 @@ public final class Legacy {
* @since 0.6
*/
public static CartesianCS replaceUnit(CartesianCS cs, final Unit<?> unit) {
- if (unit != null && !unit.equals(SI.METRE)) {
+ if (unit != null && !unit.equals(Units.METRE)) {
cs = (CartesianCS) CoordinateSystems.replaceLinearUnit(cs, unit.asType(Length.class));
}
return cs;