01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2005-2006, GeoTools Project Managment Committee (PMC)
05: * (C) 2005, Institut de Recherche pour le Développement
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation;
10: * version 2.1 of the License.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.measure;
18:
19: // J2SE extensions
20: import javax.units.SI;
21: import javax.units.NonSI;
22: import javax.units.Unit;
23: import javax.units.UnitFormat;
24: import javax.units.TransformedUnit;
25:
26: /**
27: * A set of units to use in addition of {@link SI} and {@link NonSI}.
28: *
29: * @since 2.1
30: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/measure/Units.java $
31: * @version $Id: Units.java 20874 2006-08-07 10:00:01Z jgarnett $
32: * @author Desruisseaux
33: */
34: public final class Units {
35: /**
36: * Do not allows instantiation of this class.
37: */
38: private Units() {
39: }
40:
41: /**
42: * Pseudo-unit for sexagesimal degree. Numbers in this pseudo-unit has the following format:
43: *
44: * <cite>sign - degrees - decimal point - minutes (two digits) - integer seconds (two digits) -
45: * fraction of seconds (any precision)</cite>.
46: *
47: * This unit is non-linear and not pratical for computation. Consequently, it should be
48: * avoid as much as possible. Unfortunatly, this pseudo-unit is extensively used in the
49: * EPSG database (code 9110).
50: */
51: public static final Unit SEXAGESIMAL_DMS = TransformedUnit
52: .getInstance(NonSI.DEGREE_ANGLE, new SexagesimalConverter(
53: 10000).inverse());
54: static {
55: UnitFormat.label(SEXAGESIMAL_DMS, "D.MS");
56: }
57:
58: /**
59: * Pseudo-unit for degree - minute - second. Numbers in this pseudo-unit has the following
60: * format:
61: *
62: * <cite>signed degrees (integer) - arc-minutes (integer) - arc-seconds
63: * (real, any precision)</cite>.
64: *
65: * This unit is non-linear and not pratical for computation. Consequently, it should be
66: * avoid as much as possible. Unfortunatly, this pseudo-unit is extensively used in the
67: * EPSG database (code 9107).
68: */
69: public static final Unit DEGREE_MINUTE_SECOND = TransformedUnit
70: .getInstance(NonSI.DEGREE_ANGLE,
71: new SexagesimalConverter(1).inverse());
72: static {
73: UnitFormat.label(DEGREE_MINUTE_SECOND, "DMS");
74: }
75:
76: /**
77: * Parts per million.
78: */
79: public static final Unit PPM = Unit.ONE.multiply(1E-6);
80: static {
81: UnitFormat.label(PPM, "ppm");
82: }
83: }
|