use of org.locationtech.jts.geom.Coordinate in project hale by halestudio.
the class SplitInterpolationTest method test90Deegrees.
@Test
public void test90Deegrees() throws IOException {
ArcByCenterPoint arc = new ArcByCenterPointImpl(new Coordinate(0, 0), Math.sqrt(2.0), Angle.fromDegrees(45), Angle.fromDegrees(135), false);
splitInterpolationTest(arc, 0.1);
}
use of org.locationtech.jts.geom.Coordinate in project hale by halestudio.
the class SplitInterpolationTest method testByPoints1.
@Test
public void testByPoints1() throws IOException {
Arc arc = new ArcByPointsImpl(new Coordinate(-3, 2), new Coordinate(-2, 4), new Coordinate(0, 4));
splitInterpolationTest(arc, 0.1);
}
use of org.locationtech.jts.geom.Coordinate in project hale by halestudio.
the class SplitInterpolationTest method testArcString.
@Test
public void testArcString() throws IOException {
List<Arc> arcs = new ArrayList<>();
arcs.add(new ArcByPointsImpl(new Coordinate(-3, 2), new Coordinate(-2, 4), new Coordinate(0, 4)));
arcs.add(new ArcByPointsImpl(new Coordinate(0, 4), new Coordinate(2, 3), new Coordinate(4, 4)));
arcs.add(new ArcByPointsImpl(new Coordinate(4, 4), new Coordinate(4, 6), new Coordinate(2, 6)));
splitInterpolationTest(new ArcStringImpl(arcs), 0.1);
}
use of org.locationtech.jts.geom.Coordinate in project hale by halestudio.
the class CurveHelper method combineCurve.
/**
* Combine the given {@link LineString}s to a single {@link LineString} if
* possible.
*
* @param lineStrings the line strings
* @param fact a geometry factory
* @return the combined {@link LineString} or <code>null</code> if the
* geometry did not meet the requirements of the strict mode
*/
@Nullable
public static LineString combineCurve(List<? extends LineString> lineStrings, GeometryFactory fact) {
return combineCurve(lineStrings, true, geoms -> {
List<Coordinate> coordinates = new ArrayList<>();
boolean skipFirst = false;
for (LineString geom : geoms) {
int index = 0;
if (!skipFirst) {
skipFirst = true;
} else {
index = 1;
}
for (int i = index; i < geom.getNumPoints(); i++) {
coordinates.add(geom.getCoordinateN(i));
}
}
return fact.createLineString(coordinates.toArray(new Coordinate[coordinates.size()]));
});
}
use of org.locationtech.jts.geom.Coordinate in project hale by halestudio.
the class WindingOrderTest method setUp.
/**
* Setup for different tests
*/
@BeforeClass
public static void setUp() {
GeometryFactory factory = new GeometryFactory();
r1 = factory.createLinearRing(new Coordinate[] { new Coordinate(10, 30), new Coordinate(20, 0), new Coordinate(0, 0), new Coordinate(10, 30) });
r2 = factory.createLinearRing(new Coordinate[] { new Coordinate(49.87445, 8.64729), new Coordinate(49.87582, 8.65441), new Coordinate(49.87095, 8.65694), new Coordinate(49.86978, 8.65032), new Coordinate(49.87197, 8.64758), new Coordinate(49.87341, 8.64688), new Coordinate(49.87445, 8.64729) });
h1 = factory.createLinearRing(new Coordinate[] { new Coordinate(49.87327, 8.64991), new Coordinate(49.8735, 8.6521), new Coordinate(49.87253, 8.65239), new Coordinate(49.8723, 8.65045), new Coordinate(49.87327, 8.64991) });
h2 = factory.createLinearRing(new Coordinate[] { new Coordinate(49.87203, 8.65208), new Coordinate(49.87209, 8.6531), new Coordinate(49.87156, 8.65312), new Coordinate(49.87145, 8.65227), new Coordinate(49.87203, 8.65208) });
clockWise1 = factory.createPolygon(r1);
clockWise2 = factory.createPolygon(r2, new LinearRing[] { h1, h2 });
clockWise2WOHoles = factory.createPolygon(r2);
clockWise3 = factory.createMultiPolygon(new Polygon[] { clockWise1, clockWise2 });
clockWise4 = factory.createGeometryCollection(new Geometry[] { clockWise2, clockWise2WOHoles, clockWise3, r2 });
if (crs1 == null) {
try {
crs1 = CRS_CACHE.get(code1);
} catch (Exception e) {
throw new IllegalStateException("Invalid CRS code", e);
}
}
if (crs2 == null) {
try {
crs2 = CRS_CACHE.get(code2);
} catch (Exception e) {
throw new IllegalStateException("Invalid CRS code", e);
}
}
}
Aggregations