Package org.locationtech.proj4j.geoapi
Class Units
- java.lang.Object
-
- org.locationtech.proj4j.geoapi.Units
-
final class Units extends java.lang.Object
Predefined constants for the units of measurement. The actual JSR-385 implementation is left at user's choice.
-
-
Field Summary
Fields Modifier and Type Field Description javax.measure.Unit<javax.measure.quantity.Angle>
degree
Angular unit.private static Units
instance
The default instance, created when first needed.javax.measure.Unit<javax.measure.quantity.Length>
metre
Linear unit.javax.measure.Unit<javax.measure.quantity.Dimensionless>
one
Scale unit.javax.measure.Unit<javax.measure.quantity.Dimensionless>
ppm
Scale unit.javax.measure.Unit<javax.measure.quantity.Angle>
radian
Angular unit.javax.measure.spi.SystemOfUnits
system
The implementation-dependent system of units for creating base units.
-
Constructor Summary
Constructors Modifier Constructor Description private
Units(javax.measure.spi.SystemOfUnits system)
Creates a new set of units which will use the given system of units.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static javax.measure.Unit<javax.measure.quantity.Dimensionless>
getDimensionless(javax.measure.spi.SystemOfUnits system)
Returns the dimensionless unit.static Units
getInstance()
{@return the default units factory}.(package private) Unit
proj4j(javax.measure.Unit<?> unit)
Returns the given JSR-385 unit of measurement as a PROJ4J instance.
-
-
-
Field Detail
-
instance
private static Units instance
The default instance, created when first needed.- See Also:
getInstance()
-
system
public final javax.measure.spi.SystemOfUnits system
The implementation-dependent system of units for creating base units.
-
metre
public final javax.measure.Unit<javax.measure.quantity.Length> metre
Linear unit.
-
degree
public final javax.measure.Unit<javax.measure.quantity.Angle> degree
Angular unit.
-
radian
public final javax.measure.Unit<javax.measure.quantity.Angle> radian
Angular unit.
-
one
public final javax.measure.Unit<javax.measure.quantity.Dimensionless> one
Scale unit.
-
ppm
public final javax.measure.Unit<javax.measure.quantity.Dimensionless> ppm
Scale unit.
-
-
Method Detail
-
getInstance
public static Units getInstance()
{@return the default units factory}. This factory uses the unit service provider which is current at the time of the first invocation of this method.
-
getDimensionless
private static javax.measure.Unit<javax.measure.quantity.Dimensionless> getDimensionless(javax.measure.spi.SystemOfUnits system)
Returns the dimensionless unit. This is a workaround for what seems to be a bug in the reference implementation 1.0.1 of unit API.- Parameters:
system
- the system of units from which to get the dimensionless unit.- Returns:
- the dimensionless unit.
-
proj4j
final Unit proj4j(javax.measure.Unit<?> unit)
Returns the given JSR-385 unit of measurement as a PROJ4J instance. Note that there is no method in the reverse direction (from PROJ4J to JSR-385) because current PROJ4J does not tell us whether the unit is linear or angular.- Parameters:
unit
- the unit of measurement- Returns:
- the PROJ4J equivalent unit
- Throws:
UnconvertibleInstanceException
- if the unit cannot be mapped
-
-