/*
 *    GeoTools - OpenSource mapping toolkit
 *    http://geotools.org
 *    (C) 2005-2006, GeoTools Project Managment Committee (PMC)
 *    (C) 2005, Institut de Recherche pour le Développement
 *    
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
 *    version 2.1 of the License.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 */
package org.geotools.measure;

// J2SE extensions
import javax.units.SI;
import javax.units.NonSI;
import javax.units.Unit;
import javax.units.UnitFormat;
import javax.units.TransformedUnit;


/**
 * A set of units to use in addition of {@link SI} and {@link NonSI}.
 *
 * @since 2.1
 * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/measure/Units.java $
 * @version $Id: Units.java 20874 2006-08-07 10:00:01Z jgarnett $
 * @author Desruisseaux
 */
public final class Units {
    /**
     * Do not allows instantiation of this class.
     */
    private Units() {
    }

    /**
     * Pseudo-unit for sexagesimal degree. Numbers in this pseudo-unit has the following format:
     *
     * <cite>sign - degrees - decimal point - minutes (two digits) - integer seconds (two digits) -
     * fraction of seconds (any precision)</cite>.
     *
     * This unit is non-linear and not pratical for computation. Consequently, it should be
     * avoid as much as possible. Unfortunatly, this pseudo-unit is extensively used in the
     * EPSG database (code 9110).
     */
    public static final Unit SEXAGESIMAL_DMS = TransformedUnit.getInstance(NonSI.DEGREE_ANGLE,
                                               new SexagesimalConverter(10000).inverse());
    static {
        UnitFormat.label(SEXAGESIMAL_DMS, "D.MS");
    }

    /**
     * Pseudo-unit for degree - minute - second. Numbers in this pseudo-unit has the following
     * format:
     *
     * <cite>signed degrees (integer) - arc-minutes (integer) - arc-seconds
     * (real, any precision)</cite>.
     *
     * This unit is non-linear and not pratical for computation. Consequently, it should be
     * avoid as much as possible. Unfortunatly, this pseudo-unit is extensively used in the
     * EPSG database (code 9107).
     */
    public static final Unit DEGREE_MINUTE_SECOND = TransformedUnit.getInstance(NonSI.DEGREE_ANGLE,
                                                    new SexagesimalConverter(1).inverse());
    static {
        UnitFormat.label(DEGREE_MINUTE_SECOND, "DMS");
    }

    /**
     * Parts per million.
     */
    public static final Unit PPM = Unit.ONE.multiply(1E-6);
    static {
        UnitFormat.label(PPM, "ppm");
    }
}
