1 package org.djunits.unit;
2
3 import static org.djunits.unit.unitsystem.UnitSystem.SI_DERIVED;
4
5 import org.djunits.unit.unitsystem.UnitSystem;
6
7 /**
8 * Standard solid angle unit.
9 * <p>
10 * Copyright (c) 2015-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
11 * BSD-style license. See <a href="http://djunits.org/docs/license.html">DJUNITS License</a>.
12 * <p>
13 * $LastChangedDate: 2019-03-02 19:06:46 +0100 (Sat, 02 Mar 2019) $, @version $Revision: 342 $, by $Author: averbraeck $,
14 * initial version May 15, 2014 <br>
15 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
16 */
17 public class AngleSolidUnit extends LinearUnit<AngleSolidUnit>
18 {
19 /** */
20 private static final long serialVersionUID = 20140607L;
21
22 /** The SI unit for solid angle is steradian. */
23 public static final AngleSolidUnit SI;
24
25 /** steradian. */
26 public static final AngleSolidUnit STERADIAN;
27
28 /** square degree. */
29 public static final AngleSolidUnit SQUARE_DEGREE;
30
31 static
32 {
33 SI = new AngleSolidUnit("AngleSolidUnit.sr", SI_DERIVED);
34 STERADIAN = SI;
35 SQUARE_DEGREE =
36 new AngleSolidUnit("AngleSolidUnit.sq_deg", SI_DERIVED, STERADIAN, (Math.PI / 180.0) * (Math.PI / 180.0));
37 }
38
39 /**
40 * Build a standard unit.
41 * @param abbreviationKey String; the key to the locale file for the abbreviation of the unit
42 * @param unitSystem UnitSystem; the unit system, e.g. SI or Imperial
43 */
44 private AngleSolidUnit(final String abbreviationKey, final UnitSystem unitSystem)
45 {
46 super(abbreviationKey, unitSystem);
47 }
48
49 /**
50 * Construct a derived unit as a conversion from another unit.
51 * @param abbreviationKey String; the key to the locale file for the abbreviation of the unit
52 * @param unitSystem UnitSystem; the unit system, e.g. SI or Imperial
53 * @param referenceUnit AngleSolidUnit; the unit to convert to
54 * @param scaleFactorToReferenceUnit double; multiply a value in this unit by the factor to convert to the given reference
55 * unit
56 */
57 private AngleSolidUnit(final String abbreviationKey, final UnitSystem unitSystem, final AngleSolidUnit referenceUnit,
58 final double scaleFactorToReferenceUnit)
59 {
60 super(abbreviationKey, unitSystem, referenceUnit, scaleFactorToReferenceUnit);
61 }
62
63 /**
64 * Build a user-defined unit with a conversion factor to another unit.
65 * @param name String; the long name of the unit
66 * @param abbreviation String; the abbreviation of the unit
67 * @param unitSystem UnitSystem; the unit system, e.g. SI or Imperial
68 * @param referenceUnit AngleSolidUnit; the unit to convert to
69 * @param scaleFactorToReferenceUnit double; multiply a value in this unit by the factor to convert to the given reference
70 * unit
71 */
72 public AngleSolidUnit(final String name, final String abbreviation, final UnitSystem unitSystem,
73 final AngleSolidUnit referenceUnit, final double scaleFactorToReferenceUnit)
74 {
75 super(name, abbreviation, unitSystem, referenceUnit, scaleFactorToReferenceUnit);
76 }
77
78 /** {@inheritDoc} */
79 @Override
80 public final AngleSolidUnit getStandardUnit()
81 {
82 return STERADIAN;
83 }
84
85 /** {@inheritDoc} */
86 @Override
87 public final String getSICoefficientsString()
88 {
89 return "1";
90 }
91
92 }