public final class Units extends Object
SI
and NonSI
.Modifier and Type | Field and Description |
---|---|
static Unit<Angle> |
DEGREE_MINUTE_SECOND
Pseudo-unit for degree - minute - second.
|
static Unit<Time> |
MONTH
Time duration of
1/12 of a Units.YEAR . |
static Unit<Length> |
PIXEL
Length of
1/72 of a USCustomary.INCH |
static Unit<Dimensionless> |
PPM
Parts per million.
|
static Unit<Angle> |
SEXAGESIMAL_DMS
Pseudo-unit for sexagesimal degree.
|
Modifier and Type | Method and Description |
---|---|
static <Q extends Quantity<Q>> |
autoCorrect(Unit<Q> unit)
Returns an equivalent unit instance based on the provided unit.
|
static boolean |
equals(Unit<?> unit1,
Unit<?> unit2)
Checks whether two units can be considered equivalent.
|
static UnitConverter |
getConverterToAny(Unit<?> fromUnit,
Unit<?> toUnit)
Gets a UnitConverter between two units, wrapping any raised exception in a
IllegalArgumentException.
|
static UnitFormat |
getDefaultFormat()
Gets an instance of the default system-wide Unit format.
|
static Unit<?> |
parseUnit(String name)
Parses the text into an instance of unit
|
static String |
toName(Unit<?> unit)
Unit name, willing to use
SimpleUnitFormat to look up appropriate label if a name has
not been not defined. |
static String |
toSymbol(Unit<?> unit)
Unit symbol, willing to use
SimpleUnitFormat to look up appropriate label if
required. |
public static final Unit<Length> PIXEL
1/72
of a USCustomary.INCH
public static final Unit<Time> MONTH
1/12
of a Units.YEAR
.public static final Unit<Angle> SEXAGESIMAL_DMS
sign - degrees - decimal point - minutes (two digits) - integer seconds (two digits) - fraction of seconds (any precision).
This unit is non-linear and not pratical for computation. Consequently, it should be avoid as much as possible. Unfortunatly, this pseudo-unit is extensively used in the EPSG database (code 9110).
public static final Unit<Angle> DEGREE_MINUTE_SECOND
signed degrees (integer) - arc-minutes (integer) - arc-seconds (real, any precision).
This unit is non-linear and not pratical for computation. Consequently, it should be avoid as much as possible. Unfortunatly, this pseudo-unit is extensively used in the EPSG database (code 9107).
public static final Unit<Dimensionless> PPM
public static UnitFormat getDefaultFormat()
GeoToolsUnitFormat#getInstance()
public static String toName(Unit<?> unit)
SimpleUnitFormat
to look up appropriate label if a name has
not been not defined.
This allows us to format units like PIXEL
.
public static String toSymbol(Unit<?> unit)
SimpleUnitFormat
to look up appropriate label if
required.
This allows us to format units like PIXEL
.
public static <Q extends Quantity<Q>> Unit<Q> autoCorrect(Unit<Q> unit)
equals(Unit, Unit)
method returns true. If no equivalent
reference unit is defined, it returns the provided unit.unit
- public static final boolean equals(Unit<?> unit1, Unit<?> unit2)
unit1
- unit2
- public static UnitConverter getConverterToAny(Unit<?> fromUnit, Unit<?> toUnit)
fromUnit
- toUnit
- IllegalArgumentException
- if unit1 can't be converter to unit2public static Unit<?> parseUnit(String name)
name
- ParserException
- if any problem occurs while parsing the specified character sequence
(e.g. illegal syntax).UnsupportedOperationException
- if the UnitFormat
is unable to parse.UnitFormat.parse(CharSequence)
Copyright © 1996–2019 Geotools. All rights reserved.