Search in sources :

Example 21 with Arc

use of eu.esdihumboldt.util.geometry.interpolation.model.Arc in project hale by halestudio.

the class SplitInterpolationTest method testByPoints3.

@Test
public void testByPoints3() throws IOException {
    Arc arc = new ArcByPointsImpl(new Coordinate(4, 4), new Coordinate(4, 6), new Coordinate(2, 6));
    splitInterpolationTest(arc, 0.1);
}
Also used : ArcByPointsImpl(eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByPointsImpl) Arc(eu.esdihumboldt.util.geometry.interpolation.model.Arc) Coordinate(com.vividsolutions.jts.geom.Coordinate) AbstractArcTest(eu.esdihumboldt.util.geometry.interpolation.AbstractArcTest) Test(org.junit.Test)

Example 22 with Arc

use of eu.esdihumboldt.util.geometry.interpolation.model.Arc in project hale by halestudio.

the class InterpolationAlgorithm method interpolateArcString.

/**
 * Interpolate an arc string.
 *
 * @param arcs the arc string to interpolate
 * @return the interpolated geometry
 */
default LineString interpolateArcString(ArcString arcs) {
    List<Coordinate> coords = new ArrayList<>();
    List<Arc> arcList = new ArrayList<>(arcs.getArcs());
    for (int i = 0; i < arcList.size(); i++) {
        Arc arc = arcList.get(i);
        LineString interpolated = interpolateArc(arc);
        Coordinate[] lineCoords = interpolated.getCoordinates();
        int startIndex = 1;
        if (i == 0) {
            startIndex = 0;
        }
        for (int j = startIndex; j < lineCoords.length; j++) {
            Coordinate coord = lineCoords[j];
            coords.add(coord);
        }
    }
    return new InterpolatedLineString(getGeometryFactory().getCoordinateSequenceFactory().create(coords.toArray(new Coordinate[coords.size()])), getGeometryFactory(), arcs);
}
Also used : Arc(eu.esdihumboldt.util.geometry.interpolation.model.Arc) Coordinate(com.vividsolutions.jts.geom.Coordinate) LineString(com.vividsolutions.jts.geom.LineString) ArrayList(java.util.ArrayList)

Example 23 with Arc

use of eu.esdihumboldt.util.geometry.interpolation.model.Arc in project hale by halestudio.

the class ArcGridSegment method getFirstPart.

@Override
public ArcSegment getFirstPart() {
    ArcByCenterPoint byCenter = arc.toArcByCenterPoint();
    Angle middleAngle = Angle.fromRadians(byCenter.getStartAngle().getRadians() + 0.5 * byCenter.getAngleBetween().getRadians());
    Arc part = new ArcByCenterPointImpl(byCenter.getCenterPoint(), byCenter.getRadius(), byCenter.getStartAngle(), middleAngle, byCenter.isClockwise());
    // match the parent segment's
    return new FixedStartEndGridSegment(part, true, gridSize, getStartPoint(), getMiddlePoint());
}
Also used : ArcByCenterPoint(eu.esdihumboldt.util.geometry.interpolation.model.ArcByCenterPoint) Arc(eu.esdihumboldt.util.geometry.interpolation.model.Arc) Angle(eu.esdihumboldt.util.geometry.interpolation.model.Angle) ArcByCenterPointImpl(eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByCenterPointImpl)

Example 24 with Arc

use of eu.esdihumboldt.util.geometry.interpolation.model.Arc in project hale by halestudio.

the class ArcGridSegment method getSecondPart.

@Override
public ArcSegment getSecondPart() {
    ArcByCenterPoint byCenter = arc.toArcByCenterPoint();
    Angle middleAngle = Angle.fromRadians(byCenter.getStartAngle().getRadians() + 0.5 * byCenter.getAngleBetween().getRadians());
    Arc part = new ArcByCenterPointImpl(byCenter.getCenterPoint(), byCenter.getRadius(), middleAngle, byCenter.getEndAngle(), byCenter.isClockwise());
    // match the parent segment's
    return new FixedStartEndGridSegment(part, true, gridSize, getMiddlePoint(), getEndPoint());
}
Also used : ArcByCenterPoint(eu.esdihumboldt.util.geometry.interpolation.model.ArcByCenterPoint) Arc(eu.esdihumboldt.util.geometry.interpolation.model.Arc) Angle(eu.esdihumboldt.util.geometry.interpolation.model.Angle) ArcByCenterPointImpl(eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByCenterPointImpl)

Example 25 with Arc

use of eu.esdihumboldt.util.geometry.interpolation.model.Arc in project hale by halestudio.

the class ArcSplitSegment method getSecondPart.

@Override
public ArcSegment getSecondPart() {
    ArcByCenterPoint byCenter = arc.toArcByCenterPoint();
    Angle middleAngle = Angle.fromRadians(byCenter.getStartAngle().getRadians() + 0.5 * byCenter.getAngleBetween().getRadians());
    Arc part = new ArcByCenterPointImpl(byCenter.getCenterPoint(), byCenter.getRadius(), middleAngle, byCenter.getEndAngle(), byCenter.isClockwise());
    return new FixedStartEndSplitSegment(part, maxPositionalError, getMiddlePoint(), getEndPoint());
}
Also used : ArcByCenterPoint(eu.esdihumboldt.util.geometry.interpolation.model.ArcByCenterPoint) Arc(eu.esdihumboldt.util.geometry.interpolation.model.Arc) Angle(eu.esdihumboldt.util.geometry.interpolation.model.Angle) ArcByCenterPointImpl(eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByCenterPointImpl)

Aggregations

Arc (eu.esdihumboldt.util.geometry.interpolation.model.Arc)26 Coordinate (com.vividsolutions.jts.geom.Coordinate)20 ArcByPointsImpl (eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByPointsImpl)16 AbstractArcTest (eu.esdihumboldt.util.geometry.interpolation.AbstractArcTest)13 Test (org.junit.Test)13 ArcByCenterPointImpl (eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcByCenterPointImpl)8 ArrayList (java.util.ArrayList)7 LineString (com.vividsolutions.jts.geom.LineString)6 ArcByCenterPoint (eu.esdihumboldt.util.geometry.interpolation.model.ArcByCenterPoint)6 DefaultGeometryProperty (eu.esdihumboldt.hale.common.instance.geometry.DefaultGeometryProperty)5 GeometryNotSupportedException (eu.esdihumboldt.hale.io.gml.geometry.GeometryNotSupportedException)5 InterpolationAlgorithm (eu.esdihumboldt.util.geometry.interpolation.InterpolationAlgorithm)5 Angle (eu.esdihumboldt.util.geometry.interpolation.model.Angle)4 ArcStringImpl (eu.esdihumboldt.util.geometry.interpolation.model.impl.ArcStringImpl)4 Point (com.vividsolutions.jts.geom.Point)2 Instance (eu.esdihumboldt.hale.common.instance.model.Instance)2 CRSDefinition (eu.esdihumboldt.hale.common.schema.geometry.CRSDefinition)2 ParseException (java.text.ParseException)2 Envelope (com.vividsolutions.jts.geom.Envelope)1 TypeConstraint (eu.esdihumboldt.hale.common.schema.model.TypeConstraint)1