Search in sources :

Example 1 with DefaultEllipsoidalCS

use of org.apache.sis.referencing.cs.DefaultEllipsoidalCS in project sis by apache.

the class StandardDefinitions method createCoordinateSystem.

/**
 * Creates a coordinate system from hard-coded values for the given code.
 * The coordinate system names used by this method contains only the first
 * part of the names declared in the EPSG database.
 *
 * @param  code  the EPSG code.
 * @return the coordinate system for the given code.
 */
@SuppressWarnings("fallthrough")
static CoordinateSystem createCoordinateSystem(final short code) {
    final String name;
    // 0= Cartesian (default), 1= Spherical, 2= Ellipsoidal
    int type = 0;
    // Number of dimension, default to 2.
    int dim = 2;
    // Code of first axis + dim (or code after the last axis).
    short axisCode;
    switch(code) {
        case 6422:
            name = "Ellipsoidal 2D";
            type = 2;
            axisCode = 108;
            break;
        case 6423:
            name = "Ellipsoidal 3D";
            type = 2;
            dim = 3;
            axisCode = 111;
            break;
        case 6404:
            name = "Spherical";
            type = 1;
            dim = 3;
            axisCode = 63;
            break;
        case 6500:
            name = "Earth centred";
            dim = 3;
            axisCode = 118;
            break;
        case 4400:
            name = "Cartesian 2D";
            axisCode = 3;
            break;
        case 1026:
            name = "Cartesian 2D for UPS north";
            axisCode = 1067;
            break;
        case 1027:
            name = "Cartesian 2D for UPS south";
            axisCode = 1059;
            break;
        default:
            throw new AssertionError(code);
    }
    final Map<String, ?> properties = properties(code, name, null, false);
    CoordinateSystemAxis xAxis = null, yAxis = null, zAxis = null;
    switch(dim) {
        default:
            throw new AssertionError(dim);
        case 3:
            zAxis = createAxis(--axisCode);
        case 2:
            yAxis = createAxis(--axisCode);
        case 1:
            xAxis = createAxis(--axisCode);
        case 0:
            break;
    }
    switch(type) {
        default:
            throw new AssertionError(type);
        case 0:
            return (zAxis != null) ? new DefaultCartesianCS(properties, xAxis, yAxis, zAxis) : new DefaultCartesianCS(properties, xAxis, yAxis);
        case 1:
            return new DefaultSphericalCS(properties, xAxis, yAxis, zAxis);
        case 2:
            return (zAxis != null) ? new DefaultEllipsoidalCS(properties, xAxis, yAxis, zAxis) : new DefaultEllipsoidalCS(properties, xAxis, yAxis);
    }
}
Also used : DefaultSphericalCS(org.apache.sis.referencing.cs.DefaultSphericalCS) DefaultCartesianCS(org.apache.sis.referencing.cs.DefaultCartesianCS) CoordinateSystemAxis(org.opengis.referencing.cs.CoordinateSystemAxis) DefaultCoordinateSystemAxis(org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis) DefaultEllipsoidalCS(org.apache.sis.referencing.cs.DefaultEllipsoidalCS)

Aggregations

DefaultCartesianCS (org.apache.sis.referencing.cs.DefaultCartesianCS)1 DefaultCoordinateSystemAxis (org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis)1 DefaultEllipsoidalCS (org.apache.sis.referencing.cs.DefaultEllipsoidalCS)1 DefaultSphericalCS (org.apache.sis.referencing.cs.DefaultSphericalCS)1 CoordinateSystemAxis (org.opengis.referencing.cs.CoordinateSystemAxis)1