use of org.locationtech.jts.geom.LinearRing in project hale by halestudio.
the class InteriorPointTest method testTriangleHole.
/**
* Test with a triangular polygon with a hole in the middle.
*
* @throws Exception if an error occurs
*/
@Test
public void testTriangleHole() throws Exception {
LinearRing outer = factory.createLinearRing(new Coordinate[] { new Coordinate(49.87401, 8.65491), new Coordinate(49.87318, 8.65606), new Coordinate(49.87297, 8.6545), new Coordinate(49.87401, 8.65491) });
LinearRing inner = factory.createLinearRing(new Coordinate[] { new Coordinate(49.87374, 8.65501), new Coordinate(49.87327, 8.65566), new Coordinate(49.87313, 8.65478), new Coordinate(49.87374, 8.65501) });
Polygon geom = factory.createPolygon(outer, new LinearRing[] { inner });
testPointWithin(geom);
}
use of org.locationtech.jts.geom.LinearRing in project hale by halestudio.
the class PolygonPatchGeometryTest method init.
@Override
public void init() {
super.init();
LinearRing shell = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(0.01, 3.2), new Coordinate(3.33, 3.33), new Coordinate(0.01, -3.2), new Coordinate(-3.33, -3.2), new Coordinate(0.01, 3.2) });
LinearRing[] holes = new LinearRing[2];
LinearRing hole1 = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(0, 1), new Coordinate(1, 1), new Coordinate(0, -1), new Coordinate(-1, -1), new Coordinate(0, 1) });
LinearRing hole2 = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(0, 2), new Coordinate(2, 2), new Coordinate(0, -2), new Coordinate(-2, -2), new Coordinate(0, 2) });
holes[0] = hole1;
holes[1] = hole2;
reference = geomFactory.createPolygon(shell, holes);
checker = combine(noCoordinatePairs(), referenceChecker(reference));
gridChecker = combine(noCoordinatePairs(), referenceChecker(reference, InterpolationHelper.DEFAULT_MAX_POSITION_ERROR), gridConfig.geometryChecker());
}
use of org.locationtech.jts.geom.LinearRing in project hale by halestudio.
the class MultiPolygonGeometryTest method init.
@Override
public void init() {
super.init();
LinearRing shell = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(0.01, 3.2), new Coordinate(3.33, 3.33), new Coordinate(0.01, -3.2), new Coordinate(-3.33, -3.2), new Coordinate(0.01, 3.2) });
LinearRing[] holes = new LinearRing[2];
LinearRing hole1 = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(0, 1), new Coordinate(1, 1), new Coordinate(0, -1), new Coordinate(-1, -1), new Coordinate(0, 1) });
LinearRing hole2 = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(0, 2), new Coordinate(2, 2), new Coordinate(0, -2), new Coordinate(-2, -2), new Coordinate(0, 2) });
holes[0] = hole1;
holes[1] = hole2;
Polygon polygon1 = geomFactory.createPolygon(shell, holes);
shell = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(6.01, 9.2), new Coordinate(9.33, 9.33), new Coordinate(6.01, -9.2), new Coordinate(-9.33, -9.2), new Coordinate(6.01, 9.2) });
holes = new LinearRing[2];
hole1 = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(2, 3), new Coordinate(3, 3), new Coordinate(2, -3), new Coordinate(-3, -3), new Coordinate(2, 3) });
hole2 = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(2, 4), new Coordinate(4, 4), new Coordinate(2, -4), new Coordinate(-4, -4), new Coordinate(2, 4) });
holes[0] = hole1;
holes[1] = hole2;
Polygon polygon2 = geomFactory.createPolygon(shell, holes);
Polygon[] polygons = new Polygon[] { polygon1, polygon2 };
reference = geomFactory.createMultiPolygon(polygons);
checker = referenceChecker(reference);
gridChecker = combine(referenceChecker(reference, InterpolationHelper.DEFAULT_MAX_POSITION_ERROR), gridConfig.geometryChecker());
}
use of org.locationtech.jts.geom.LinearRing in project hale by halestudio.
the class MultiSurfaceGeometryTest method init.
@Override
public void init() {
super.init();
LinearRing shell = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(-122.44, 37.80), new Coordinate(-122.45, 37.80), new Coordinate(-122.45, 37.78), new Coordinate(-122.44, 37.78), new Coordinate(-122.44, 37.80) });
LinearRing[] holes = new LinearRing[1];
LinearRing hole1 = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(-122.24, 37.60), new Coordinate(-122.25, 37.60), new Coordinate(-122.25, 37.58), new Coordinate(-122.24, 37.58), new Coordinate(-122.24, 37.60) });
holes[0] = hole1;
Polygon polygon2 = geomFactory.createPolygon(shell, holes);
shell = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(0.01, 3.2), new Coordinate(3.33, 3.33), new Coordinate(0.01, -3.2), new Coordinate(-3.33, -3.2), new Coordinate(0.01, 3.2) });
holes = new LinearRing[2];
hole1 = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(0, 1), new Coordinate(1, 1), new Coordinate(0, -1), new Coordinate(-1, -1), new Coordinate(0, 1) });
LinearRing hole2 = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(0, 2), new Coordinate(2, 2), new Coordinate(0, -2), new Coordinate(-2, -2), new Coordinate(0, 2) });
holes[0] = hole1;
holes[1] = hole2;
Polygon polygon1 = geomFactory.createPolygon(shell, holes);
Polygon[] polygons = new Polygon[] { polygon1, polygon2 };
reference = geomFactory.createMultiPolygon(polygons);
checker = referenceChecker(reference);
gridChecker = combine(referenceChecker(reference, maxPositionalError), gridConfig.geometryChecker());
}
use of org.locationtech.jts.geom.LinearRing in project hale by halestudio.
the class PolyhedralSurfaceGeometryTest method init.
@Override
public void init() {
super.init();
LinearRing shell = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(0.01, 3.2), new Coordinate(3.33, 3.33), new Coordinate(0.01, -3.2), new Coordinate(-3.33, -3.2), new Coordinate(0.01, 3.2) });
LinearRing[] holes = new LinearRing[2];
LinearRing hole1 = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(0, 1), new Coordinate(1, 1), new Coordinate(0, -1), new Coordinate(-1, -1), new Coordinate(0, 1) });
LinearRing hole2 = geomFactory.createLinearRing(new Coordinate[] { new Coordinate(0, 2), new Coordinate(2, 2), new Coordinate(0, -2), new Coordinate(-2, -2), new Coordinate(0, 2) });
holes[0] = hole1;
holes[1] = hole2;
reference = geomFactory.createPolygon(shell, holes);
checker = combine(noCoordinatePairs(), referenceChecker(reference));
gridChecker = combine(noCoordinatePairs(), referenceChecker(reference, InterpolationHelper.DEFAULT_MAX_POSITION_ERROR), gridConfig.geometryChecker());
}
Aggregations