1 package org.djunits.unit;
2
3 import org.djunits.quantity.Quantity;
4 import org.djunits.unit.scale.GradeScale;
5 import org.djunits.unit.scale.IdentityScale;
6 import org.djunits.unit.si.SIPrefixes;
7 import org.djunits.unit.unitsystem.UnitSystem;
8
9
10
11
12
13
14
15
16
17
18
19
20
21 public class AngleUnit extends Unit<AngleUnit>
22 {
23
24 private static final long serialVersionUID = 20140607L;
25
26
27 public static final Quantity<AngleUnit> BASE = new Quantity<>("Angle", "rad");
28
29
30 public static final AngleUnit SI =
31 new AngleUnit().build(new Unit.Builder<AngleUnit>().setQuantity(BASE).setId("rad").setName("radians")
32 .setUnitSystem(UnitSystem.SI_DERIVED).setSiPrefixes(SIPrefixes.NONE, 1.0).setScale(IdentityScale.SCALE));
33
34
35 public static final AngleUnit RADIAN = SI;
36
37
38 public static final AngleUnit PERCENT = new AngleUnit().build(new Unit.Builder<AngleUnit>().setQuantity(BASE).setId("perc")
39 .setName("percent").setUnitSystem(UnitSystem.OTHER).setSiPrefixes(SIPrefixes.NONE, 1.0)
40 .setScale(new GradeScale(0.01)).setDefaultDisplayAbbreviation("%").setDefaultTextualAbbreviation("%"));
41
42
43 public static final AngleUnit DEGREE =
44 RADIAN.deriveLinear(Math.PI / 180.0, "deg", "degree", UnitSystem.SI_ACCEPTED, "\u00b0", "deg", "dg");
45
46
47 public static final AngleUnit ARCMINUTE =
48 DEGREE.deriveLinear(1.0 / 60.0, "arcmin", "arcminute", UnitSystem.SI_ACCEPTED, "'", "'", "arcmin");
49
50
51 public static final AngleUnit ARCSECOND = DEGREE.deriveLinear(1.0 / 3600.0, "arcsec", "arcsecond", UnitSystem.SI_ACCEPTED,
52 "\"", "\"", new String[] {"arcsec"});
53
54
55 public static final AngleUnit GRAD = RADIAN.deriveLinear(2.0 * Math.PI / 400.0, "grad", "gradian", UnitSystem.OTHER);
56
57
58 public static final AngleUnit CENTESIMAL_ARCMINUTE =
59 GRAD.deriveLinear(1.0 / 100.0, "cdm", "centesimal arcminute", UnitSystem.OTHER, "c'", "c'");
60
61
62 public static final AngleUnit CENTESIMAL_ARCSECOND =
63 GRAD.deriveLinear(1.0 / 10000.0, "cds", "centesimal arcsecond", UnitSystem.OTHER, "c\"", "c\"");
64
65 }