use of eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByPointsImpl in project hale by halestudio.
the class CircleHandler method createGeometry.
@Override
public Object createGeometry(Instance instance, int srsDimension, IOProvider reader) throws GeometryNotSupportedException {
@SuppressWarnings("unchecked") DefaultGeometryProperty<LineString> lineStringGeomProperty = (DefaultGeometryProperty<LineString>) super.createGeometry(instance, srsDimension, reader);
// create Arc for circle
Coordinate[] coords = lineStringGeomProperty.getGeometry().getCoordinates();
if (coords.length != 3) {
throw new GeometryNotSupportedException("Arc must be defined by three points");
}
Arc arc = new ArcByPointsImpl(coords[0], coords[1], coords[2]);
ArcByCenterPoint byCenter = arc.toArcByCenterPoint();
ArcByCenterPoint circle = new ArcByCenterPointImpl(byCenter.getCenterPoint(), byCenter.getRadius(), byCenter.getStartAngle(), byCenter.getStartAngle(), byCenter.isClockwise());
// get interpolation algorithm
InterpolationAlgorithm interpol = InterpolationHelper.getInterpolation(reader, getGeometryFactory());
LineString interpolatedCircle = interpol.interpolateArc(circle);
if (interpolatedCircle == null) {
log.error("Circle could be not interpolated to Linestring");
return null;
}
return new DefaultGeometryProperty<LineString>(lineStringGeomProperty.getCRSDefinition(), interpolatedCircle);
}
use of eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByPointsImpl in project hale by halestudio.
the class GridInterpolationTest method testByPoints1.
@Test
public void testByPoints1() throws IOException {
Arc arc = new ArcByPointsImpl(new Coordinate(-3, 2), new Coordinate(-2, 4), new Coordinate(0, 4));
gridInterpolationTest(arc, 0.1, false);
}
use of eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByPointsImpl in project hale by halestudio.
the class GridInterpolationTest method testByPoints1AllGrid.
@Test
public void testByPoints1AllGrid() throws IOException {
Arc arc = new ArcByPointsImpl(new Coordinate(-3, 2), new Coordinate(-2, 4), new Coordinate(0, 4));
gridInterpolationTest(arc, 0.1, true);
}
use of eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByPointsImpl in project hale by halestudio.
the class GridInterpolationTest method testByPoints2.
@Test
public void testByPoints2() throws IOException {
Arc arc = new ArcByPointsImpl(new Coordinate(0, 4), new Coordinate(2, 3), new Coordinate(4, 4));
gridInterpolationTest(arc, 0.1, false);
}
use of eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByPointsImpl in project hale by halestudio.
the class GridInterpolationTest method testByPoints2AllGrid.
@Test
public void testByPoints2AllGrid() throws IOException {
Arc arc = new ArcByPointsImpl(new Coordinate(0, 4), new Coordinate(2, 3), new Coordinate(4, 4));
gridInterpolationTest(arc, 0.1, true);
}
Aggregations