Class Units
java.lang.Object
org.locationtech.proj4j.geoapi.Units
Predefined constants for the units of measurement.
The actual JSR-385 implementation is left at user's choice.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal javax.measure.Unit<javax.measure.quantity.Angle> Angular unit.private static UnitsThe default instance, created when first needed.final javax.measure.Unit<javax.measure.quantity.Length> Linear unit.final javax.measure.Unit<javax.measure.quantity.Dimensionless> Scale unit.final javax.measure.Unit<javax.measure.quantity.Dimensionless> Scale unit.final javax.measure.Unit<javax.measure.quantity.Angle> Angular unit.final javax.measure.spi.SystemOfUnitsThe implementation-dependent system of units for creating base units. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateUnits(javax.measure.spi.SystemOfUnits system) Creates a new set of units which will use the given system of units. -
Method Summary
Modifier and TypeMethodDescriptionprivate static javax.measure.Unit<javax.measure.quantity.Dimensionless> getDimensionless(javax.measure.spi.SystemOfUnits system) Returns the dimensionless unit.static UnitsReturns the default units factory.(package private) final Unitproj4j(javax.measure.Unit<?> unit) Returns the given JSR-385 unit of measurement as a PROJ4J instance.
-
Field Details
-
instance
-
system
public final javax.measure.spi.SystemOfUnits systemThe implementation-dependent system of units for creating base units. -
metre
public final javax.measure.Unit<javax.measure.quantity.Length> metreLinear unit. -
degree
public final javax.measure.Unit<javax.measure.quantity.Angle> degreeAngular unit. -
radian
public final javax.measure.Unit<javax.measure.quantity.Angle> radianAngular unit. -
one
public final javax.measure.Unit<javax.measure.quantity.Dimensionless> oneScale unit. -
ppm
public final javax.measure.Unit<javax.measure.quantity.Dimensionless> ppmScale unit.
-
-
Constructor Details
-
Units
private Units(javax.measure.spi.SystemOfUnits system) Creates a new set of units which will use the given system of units.- Parameters:
system- the system of units to use for creating base units
-
-
Method Details
-
getInstance
Returns the default units factory.. This factory uses the unit service provider which is current at the time of the first invocation of this method.- Returns:
- the default units factory
-
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
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
-