org.geolatte.geom.crs.EllipsoidalCoordinateSystem2D Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geolatte-geom Show documentation
Show all versions of geolatte-geom Show documentation
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.G2D;
import java.util.Arrays;
import java.util.List;
/**
*
* Created by Karel Maesen, Geovise BVBA on 28/11/14.
*/
public class EllipsoidalCoordinateSystem2D extends CoordinateSystem {
private final static List REQUIRED_AXIS_NORMAL_ORDER = Arrays.asList(0, 1);
public EllipsoidalCoordinateSystem2D(EllipsoidalAxis first, EllipsoidalAxis second) {
super(first, second);
checkAxes();
}
private void checkAxes() {
List order = getAxisNormalOrder();
if (!order.containsAll(REQUIRED_AXIS_NORMAL_ORDER)) {
throw new IllegalArgumentException("Require order 0 and 1 axes");
}
}
@Override
public Class getPositionClass() {
return G2D.class;
}
@Override
public CoordinateSystem extends G2D> merge(OneDimensionCoordinateSystem> coordinateSystem) {
CoordinateSystemAxis axis = coordinateSystem.getAxis();
return extend(axis);
}
@Override
public CoordinateSystem extends G2D> extend(CoordinateSystemAxis axis) {
if (axis instanceof EllipsoidalHeightCSAXis) {
return new EllipsoidalCoordinateSystem3D((EllipsoidalAxis) getAxis(0), (EllipsoidalAxis) getAxis(1),
(EllipsoidalHeightCSAXis) axis);
}
if (axis instanceof MeasureStraightLineAxis) {
return new EllipsoidalCoordinateSystem2DM((EllipsoidalAxis) getAxis(0), (EllipsoidalAxis) getAxis(1),
(MeasureStraightLineAxis) axis);
}
if (axis instanceof VerticalStraightLineAxis) {
return new EllipsoidalCoordinateSystem3D((EllipsoidalAxis) getAxis(0), (EllipsoidalAxis) getAxis(1),
(VerticalStraightLineAxis) axis);
}
throw new UnsupportedOperationException();
}
@Override
public boolean hasZ() {
return false;
}
@Override
public boolean hasM() {
return false;
}
}