All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.geolatte.geom.crs.EllipsoidalCoordinateSystem3D Maven / Gradle / Ivy

Go to download

This geoLatte-geom library offers a geometry model that conforms to the OGC Simple Features for SQL specification.

The newest version!
package org.geolatte.geom.crs;

import org.geolatte.geom.G3D;
import org.geolatte.geom.G3DM;

import java.util.Arrays;
import java.util.List;

/**
 *
 * Created by Karel Maesen, Geovise BVBA on 28/11/14.
 */
public class EllipsoidalCoordinateSystem3D extends CoordinateSystem {

    private final static List REQUIRED_AXIS_NORMAL_ORDER = Arrays.asList(0, 1, 2);

    public EllipsoidalCoordinateSystem3D(EllipsoidalAxis first, EllipsoidalAxis second, StraightLineAxis heightAxis) {
        super(first, second, heightAxis);
        checkAxes();
    }

    private void checkAxes() {
        List order = getAxisNormalOrder();
        if (!order.containsAll(REQUIRED_AXIS_NORMAL_ORDER)) {
            throw new IllegalArgumentException("Require order 0, 1 and 2 axes");
        }
    }


    @Override
    public Class getPositionClass() {
        return G3D.class;
    }

    @Override
    public CoordinateSystem merge(OneDimensionCoordinateSystem coordinateSystem) {
        CoordinateSystemAxis axis = coordinateSystem.getAxis();
        return extend(axis);
    }

    @Override
    public CoordinateSystem extend(CoordinateSystemAxis axis) {
        if (axis instanceof MeasureStraightLineAxis) {
            return new EllipsoidalCoordinateSystem3DM((EllipsoidalAxis) getAxis(0), (EllipsoidalAxis) getAxis(1),
                    (StraightLineAxis) getAxis(2), (MeasureStraightLineAxis) axis);
        }
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean hasZ() {
        return true;
    }

    @Override
    public boolean hasM() {
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy