|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectStatic
Units
public final class Units
A set of units to use in addition of SI and NonSI.
| utility/geotk-utility (download) | View source code for this class |
| Field Summary | |
|---|---|
static Unit<Angle> |
DEGREE_MINUTE_SECOND
Pseudo-unit for degree - minute - second. |
static Unit<Duration> |
MILLISECOND
Unit for milliseconds. |
static Unit<Dimensionless> |
PPM
Parts per million. |
static Unit<Angle> |
SEXAGESIMAL_DMS
Pseudo-unit for sexagesimal degree. |
| Method Summary | ||
|---|---|---|
static double |
derivative(UnitConverter converter,
double value)
Returns an estimation of the derivative of the given converter at the given value. |
|
static Unit<Angle> |
ensureAngular(Unit<?> unit)
Makes sure that the specified unit is either null or an angular unit. |
|
static Unit<Length> |
ensureLinear(Unit<?> unit)
Makes sure that the specified unit is either null or a linear unit. |
|
static Unit<Dimensionless> |
ensureScale(Unit<?> unit)
Makes sure that the specified unit is either null or a scale unit. |
|
static Unit<Duration> |
ensureTemporal(Unit<?> unit)
Makes sure that the specified unit is either null or a temporal unit. |
|
static boolean |
isAngular(Unit<?> unit)
Returns true if the given unit is a linear unit. |
|
static boolean |
isLinear(Unit<?> unit)
Returns true if the given unit is a linear unit. |
|
static boolean |
isScale(Unit<?> unit)
Returns true if the given unit is a dimensionless scale unit. |
|
static boolean |
isTemporal(Unit<?> unit)
Returns true if the given unit is a temporal unit. |
|
static
|
multiply(Unit<A> unit,
double factor)
Multiplies the given unit by the given factor. |
|
static
|
toStandardUnit(Unit<A> unit)
Returns the factor by which to multiply the standard unit in order to get the given unit. |
|
static Unit<?> |
valueOf(String uom)
Parses the given symbol. |
|
static Unit<?> |
valueOfEPSG(int code)
Returns a hard-coded unit from an EPSG code. |
|
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Unit<Duration> MILLISECOND
Date objects.
public static final Unit<Angle> SEXAGESIMAL_DMS
This unit is non-linear and not practical for computation. Consequently, it should be avoid as much as possible. Unfortunately, this pseudo-unit is extensively used in the EPSG database (code 9110).
public static final Unit<Angle> DEGREE_MINUTE_SECOND
This unit is non-linear and not practical for computation. Consequently, it should be avoid as much as possible. Unfortunately, this pseudo-unit is extensively used in the EPSG database (code 9107).
public static final Unit<Dimensionless> PPM
| Method Detail |
|---|
public static boolean isTemporal(Unit<?> unit)
true if the given unit is a temporal unit.
Temporal units are convertible to SI.SECOND.
unit - The unit to check (may be null).
true if the given unit is non-null and temporal.ensureTemporal(Unit)public static boolean isLinear(Unit<?> unit)
true if the given unit is a linear unit.
Linear units are convertible to SI.METRE.
unit - The unit to check (may be null).
true if the given unit is non-null and linear.ensureLinear(Unit)public static boolean isAngular(Unit<?> unit)
true if the given unit is a linear unit.
Linear units are convertible to NonSI.DEGREE_ANGLE.
Angular units are dimensionless, which may be a cause of confusion with other
dimensionless units like Unit.ONE or PPM. This method take
care of differentiating angular units from other dimensionless units.
unit - The unit to check (may be null).
true if the given unit is non-null and angular.ensureAngular(Unit)public static boolean isScale(Unit<?> unit)
true if the given unit is a dimensionless scale unit.
This include Unit.ONE and PPM.
unit - The unit to check (may be null).
true if the given unit is non-null and a dimensionless scale.ensureScale(Unit)
public static Unit<Duration> ensureTemporal(Unit<?> unit)
throws IllegalArgumentException
unit - The unit to check, or null if none.
unit argument, which may be null.
IllegalArgumentException - if unit is non-null and not a temporal unit.isTemporal(Unit)
public static Unit<Length> ensureLinear(Unit<?> unit)
throws IllegalArgumentException
unit - The unit to check, or null if none.
unit argument, which may be null.
IllegalArgumentException - if unit is non-null and not a linear unit.isLinear(Unit)
public static Unit<Angle> ensureAngular(Unit<?> unit)
throws IllegalArgumentException
unit - The unit to check, or null if none.
unit argument, which may be null.
IllegalArgumentException - if unit is non-null and not an angular unit.isAngular(Unit)
public static Unit<Dimensionless> ensureScale(Unit<?> unit)
throws IllegalArgumentException
unit - The unit to check, or null if none.
unit argument, which may be null.
IllegalArgumentException - if unit is non-null and not a scale unit.isScale(Unit)
public static <A extends Quantity> Unit<A> multiply(Unit<A> unit,
double factor)
SI.METRE
by 1000 gives SI.KILOMETRE. Invoking this method is equivalent to invoking
Unit.times(double) except for the following:
multiply(SI.RADIANS, 0.0174532925199...) will return
NonSI.DEGREE_ANGLE even if the given numerical value is slightly
different than pi/180. The tolerance factor and the
set of units handled especially may change in future Geotk versions.
A - The quantity measured by the unit.unit - The unit to multiply.factor - The multiplication factor.
public static <A extends Quantity> double toStandardUnit(Unit<A> unit)
Example: If the given unit is kilometre, then this method returns 1000 since a measurement in kilometres must be multiplied by 1000 in order to give the equivalent measurement in the "standard" units (here metres).
A - The quantity measured by the unit.unit - The unit for which we want the multiplication factor to standard unit.
public static double derivative(UnitConverter converter,
double value)
Current implementation computes the derivative as below:
The above is exact for linear converters, which is the case of the vast majority of unit converters in use. It may not be exact for a few unusual converter like the one fromreturn converter.convert(value + 1) - converter.convert(value);
SEXAGESIMAL_DMS to decimal degrees for
example.
converter - The converter for which we want the derivative at a given point.value - The point at which to compute the derivative.
public static Unit<?> valueOf(String uom)
throws IllegalArgumentException
Unit.valueOf(CharSequence), but
hands especially a few symbols found in WKT parsing or in XML files. The list of symbols
handled especially is implementation-dependent and may change in future Geotk versions.
Parsing authority codes
As a special case, if the given uom arguments is of the form "EPSG:xxx"
(ignoring case and whitespaces), then "xxx" is parsed as an integer and given to
valueOfEPSG(int).
uom - The symbol to parse, or null.
null if uom was null.
IllegalArgumentException - if the given symbol can not be parsed.org.geotoolkit.image.io.plugin.NetcdfMetadataTranscoder class needs
that we parse the "degrees_west" symbol in such a way that the conversion from
"degrees_west" to "degrees_east" reverse the sign of the values.
This is not yet supported by current implementation.public static Unit<?> valueOfEPSG(int code)
code argument given to this
method shall be a code identifying a record in the "Unit of Measure" table of
the EPSG database. If this method does not recognize the given code, then it returns
null.
The list of units recognized by this method is not exhaustive. This method recognizes
the base units declared in the [TARGET_UOM_CODE] column of the above-cited table,
and some frequently-used units. The list of recognized units may be updated in any future
version of Geotk.
The DirectEpsgFactory uses this method
for fetching the base units, and derives automatically other units from the information
found in the EPSG database. This method is also used by other code not directly related
to the EPSG database, like AutoCRSFactory
which uses EPSG code for identifying units.
The values currently recognized are:
| Linear units | Angular units | Scale units | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
code - The EPSG code for a unit of measurement.
null if the code is unrecognized.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||