1 package org.djunits.unit;
2
3 import org.djunits.quantity.Quantity;
4 import org.djunits.unit.scale.OffsetLinearScale;
5 import org.djunits.unit.si.SIPrefixes;
6 import org.djunits.unit.unitsystem.UnitSystem;
7
8
9
10
11
12
13
14
15
16 public class PositionUnit extends AbsoluteLinearUnit<PositionUnit, LengthUnit>
17 {
18
19 private static final long serialVersionUID = 20140607L;
20
21
22 public static final Quantity<PositionUnit> BASE = new Quantity<>("Position", "m");
23
24
25 public static final PositionUnit DEFAULT =
26 new PositionUnit().build(new AbsoluteLinearUnit.Builder<PositionUnit, LengthUnit>().setQuantity(BASE).setId("m")
27 .setName("meter").setUnitSystem(UnitSystem.SI_BASE).setSiPrefixes(SIPrefixes.UNIT, 1.0)
28 .setScale(new OffsetLinearScale(1.0, 0.0)).setRelativeUnit(LengthUnit.METER));
29
30
31 public static final PositionUnit METER = DEFAULT;
32
33
34 public static final PositionUnit NANOMETER = METER.deriveSI(SIPrefixes.getUnit("n"), 1.0);
35
36
37 public static final PositionUnit MICROMETER = METER.deriveSI(SIPrefixes.getUnit("mu"), 1.0);
38
39
40 public static final PositionUnit MILLIMETER = METER.deriveSI(SIPrefixes.getUnit("m"), 1.0);
41
42
43 public static final PositionUnit CENTIMETER = METER.deriveSI(SIPrefixes.getUnit("c"), 1.0);
44
45
46 public static final PositionUnit DECIMETER = METER.deriveSI(SIPrefixes.getUnit("d"), 1.0);
47
48
49 public static final PositionUnit DECAMETER = METER.deriveSI(SIPrefixes.getUnit("da"), 1.0);
50
51
52 public static final PositionUnit HECTOMETER = METER.deriveSI(SIPrefixes.getUnit("h"), 1.0);
53
54
55 public static final PositionUnit KILOMETER = METER.deriveSI(SIPrefixes.getUnit("k"), 1.0);
56
57
58 public static final PositionUnit FOOT =
59 METER.deriveLinearOffset(0.3048, 0.0, LengthUnit.FOOT, "ft", "foot", UnitSystem.IMPERIAL);
60
61
62 public static final PositionUnit INCH =
63 METER.deriveLinearOffset(0.3048 / 12.0, 0.0, LengthUnit.INCH, "in", "inch", UnitSystem.IMPERIAL);
64
65
66 public static final PositionUnit YARD =
67 METER.deriveLinearOffset(0.3048 * 3.0, 0.0, LengthUnit.YARD, "yd", "yard", UnitSystem.IMPERIAL);
68
69
70 public static final PositionUnit MILE =
71 METER.deriveLinearOffset(0.3048 * 5280.0, 0.0, LengthUnit.MILE, "mi", "mile", UnitSystem.IMPERIAL);
72
73
74 public static final PositionUnit NAUTICAL_MILE =
75 METER.deriveLinearOffset(1852.0, 0.0, LengthUnit.NAUTICAL_MILE, "NM", "nautical mile", UnitSystem.OTHER);
76
77
78 public static final PositionUnit ASTRONOMICAL_UNIT = METER.deriveLinearOffset(149597870700.0, 0.0,
79 LengthUnit.ASTRONOMICAL_UNIT, "AU", "Astronomical Unit", UnitSystem.OTHER);
80
81
82 public static final PositionUnit LIGHTYEAR =
83 METER.deriveLinearOffset(9_460_730_472_580_800.0, 0.0, LengthUnit.LIGHTYEAR, "ly", "lightyear", UnitSystem.OTHER);
84
85
86 public static final PositionUnit PARSEC = METER.deriveLinearOffset(9_460_730_472_580_800.0 * 648_000.0 / Math.PI, 0.0,
87 LengthUnit.PARSEC, "Pc", "Parsec", UnitSystem.OTHER);
88
89
90 public static final PositionUnit ANGSTROM =
91 METER.deriveLinearOffset(1.0E-10, 0.0, LengthUnit.ANGSTROM, "A", "Angstrom", UnitSystem.OTHER, "\u212B", "A");
92
93 }