    001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.4_testing/src/org/deegree/crs/coordinatesystems/GeographicCRS.java $
    002    /*----------------------------------------------------------------------------
    003     This file is part of deegree, http://deegree.org/
    004     Copyright (C) 2001-2009 by:
    005       Department of Geography, University of Bonn
    006     and
    007       lat/lon GmbH
    008
    009     This library is free software; you can redistribute it and/or modify it under
    010     the terms of the GNU Lesser General Public License as published by the Free
    011     Software Foundation; either version 2.1 of the License, or (at your option)
    012     any later version.
    013     This library is distributed in the hope that it will be useful, but WITHOUT
    014     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    015     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
    016     details.
    017     You should have received a copy of the GNU Lesser General Public License
    018     along with this library; if not, write to the Free Software Foundation, Inc.,
    019     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    020
    021     Contact information:
    022
    023     lat/lon GmbH
    024     Aennchenstr. 19, 53177 Bonn
    025     Germany
    026     http://lat-lon.de/
    027
    028     Department of Geography, University of Bonn
    029     Prof. Dr. Klaus Greve
    030     Postfach 1147, 53001 Bonn
    031     Germany
    032     http://www.geographie.uni-bonn.de/deegree/
    033
    034     e-mail: info@deegree.org
    035    ----------------------------------------------------------------------------*/
    036
    037    package org.deegree.crs.coordinatesystems;
    038
    039    import java.util.List;
    040
    041    import org.deegree.crs.Identifiable;
    042    import org.deegree.crs.components.Axis;
    043    import org.deegree.crs.components.GeodeticDatum;
    044    import org.deegree.crs.components.Unit;
    045    import org.deegree.crs.transformations.polynomial.PolynomialTransformation;
    046    import org.deegree.i18n.Messages;
    047
    048    /**
    049     * The <code>GeographicCoordinateSystem</code> (in epsg aka Geodetic CRS) is a two dimensional crs with axis of lat-lon.
    050     *
    051     * @author <a href="mailto:bezema@lat-lon.de">Rutger Bezema</a>
    052     *
    053     * @author last edited by: $Author: mschneider $
    054     *
    055     * @version $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
    056     *
    057     */
    058
    059    public class GeographicCRS extends CoordinateSystem {
    060
    061        private static final long serialVersionUID = -293420964593919065L;
    062
    063        /**
    064         * A geographic coordinate system using WGS84 datum. This coordinate system use
    065         * <var>longitude</var>/<var>latitude</var> axis with latitude values increasing north and longitude values
    066         * increasing east. Angular units are degrees and prime meridian is Greenwich.
    067         */
    068        public static final GeographicCRS WGS84 = new GeographicCRS(
    069                                                                     GeodeticDatum.WGS84,
    070                                                                     new Axis[] {
    071                                                                                 new Axis( Unit.DEGREE, "lon", Axis.AO_EAST ),
    072                                                                                 new Axis( Unit.DEGREE, "lat",
    073                                                                                           Axis.AO_NORTH ) }, "EPSG:4326",
    074                                                                     "WGS 84" );
    075
    076        /**
    077         * A geographic coordinate system using WGS84 datum. This coordinate system use
    078         * <var>longitude</var>/<var>latitude</var> axis with latitude values increasing north and longitude values
    079         * increasing east. Angular units are degrees and prime meridian is Greenwich.
    080         */
    081        public static final GeographicCRS WGS84_YX = new GeographicCRS( GeodeticDatum.WGS84,
    082                                                                        new Axis[] {
    083                                                                                    new Axis( Unit.DEGREE, "lat",
    084                                                                                              Axis.AO_NORTH ),
    085                                                                                    new Axis( Unit.DEGREE, "lon",
    086                                                                                              Axis.AO_EAST ) },
    087                                                                        "EPSG:4326", "WGS 84" );
    088
    089        /**
    090         * @param datum
    091         * @param axisOrder
    092         * @param identity
    093         * @throws IllegalArgumentException
    094         *             if the axisOrder.length != 2.
    095         */
    096        public GeographicCRS( GeodeticDatum datum, Axis[] axisOrder, Identifiable identity )
    097                                throws IllegalArgumentException {
    098            this( null, datum, axisOrder, identity );
    099        }
    100
    101        /**
    102         * @param datum
    103         * @param axisOrder
    104         * @param identifiers
    105         * @param names
    106         * @param versions
    107         * @param descriptions
    108         * @param areasOfUse
    109         * @throws IllegalArgumentException
    110         *             if the axisOrder.length != 2.
    111         */
    112        public GeographicCRS( GeodeticDatum datum, Axis[] axisOrder, String[] identifiers, String[] names,
    113                              String[] versions, String[] descriptions, String[] areasOfUse )
    114                                throws IllegalArgumentException {
    115            super( datum, axisOrder, identifiers, names, versions, descriptions, areasOfUse );
    116            if ( axisOrder.length != 2 ) {
    117                throw new IllegalArgumentException( Messages.getMessage( "CRS_COORDINATESYSTEMS_WRONG_AXIS_DIM",
    118                                                                         "Geographic", "2" ) );
    119            }
    120        }
    121
    122        /**
    123         * @param datum
    124         * @param axisOrder
    125         * @param identifiers
    126         */
    127        public GeographicCRS( GeodeticDatum datum, Axis[] axisOrder, String[] identifiers ) {
    128            this( datum, axisOrder, identifiers, null, null, null, null );
    129        }
    130
    131        /**
    132         * @param datum
    133         * @param axisOrder
    134         * @param identifier
    135         * @param name
    136         * @param version
    137         * @param description
    138         * @param areaOfUse
    139         */
    140        public GeographicCRS( GeodeticDatum datum, Axis[] axisOrder, String identifier, String name, String version,
    141                              String description, String areaOfUse ) {
    142            this( datum, axisOrder, new String[] { identifier }, new String[] { name }, new String[] { version },
    143                  new String[] { description }, new String[] { areaOfUse } );
    144        }
    145
    146        /**
    147         * @param datum
    148         * @param axisOrder
    149         * @param identifier
    150         * @param name
    151         */
    152        public GeographicCRS( GeodeticDatum datum, Axis[] axisOrder, String identifier, String name ) {
    153            this( datum, axisOrder, new String[] { identifier }, new String[] { name }, null, null, null );
    154        }
    155
    156        /**
    157         * @param transformations
    158         * @param usedDatum
    159         * @param axisOrder
    160         * @param id
    161         */
    162        public GeographicCRS( List<PolynomialTransformation> transformations, GeodeticDatum usedDatum, Axis[] axisOrder,
    163                              Identifiable id ) {
    164            super( transformations, usedDatum, axisOrder, id );
    165            if ( axisOrder.length != 2 ) {
    166                throw new IllegalArgumentException( Messages.getMessage( "CRS_COORDINATESYSTEMS_WRONG_AXIS_DIM",
    167                                                                         "Geographic", "2" ) );
    168            }
    169        }
    170
    171        @Override
    172        public int getDimension() {
    173            return 2;
    174        }
    175
    176        @Override
    177        public int getType() {
    178            return GEOGRAPHIC_CRS;
    179        }
    180
    181    }