use of com.vividsolutions.jts.geom.LinearRing in project hale by halestudio.
the class InteriorPointTest method testHalfmoon.
/**
* Test with a polygon describing a rough half moon.
*
* @throws Exception if an error occurs
*/
@Test
public void testHalfmoon() throws Exception {
LinearRing outer = factory.createLinearRing(new Coordinate[] { new Coordinate(49.87359, 8.65558), new Coordinate(49.87307, 8.65649), new Coordinate(49.87239, 8.65812), new Coordinate(49.8724, 8.65586), new Coordinate(49.87294, 8.65431), new Coordinate(49.87402, 8.65378), new Coordinate(49.87541, 8.65358), new Coordinate(49.87671, 8.65437), new Coordinate(49.87751, 8.65659), new Coordinate(49.87683, 8.65548), new Coordinate(49.87583, 8.65489), new Coordinate(49.87448, 8.65505), new Coordinate(49.87359, 8.65558) });
Polygon geom = factory.createPolygon(outer);
testPointWithin(geom);
}
use of com.vividsolutions.jts.geom.LinearRing in project hale by halestudio.
the class InteriorPointTest method testProblemCase.
/**
* Test with a problem case from real data.
*
* @throws Exception if an error occurs
*/
@Test
public void testProblemCase() throws Exception {
LinearRing outer1 = factory.createLinearRing(new Coordinate[] { new Coordinate(466713.482, 5974979.283), new Coordinate(466737.125, 5974995.621), new Coordinate(466737.125, 5974995.621), new Coordinate(467230.558, 5975071.481), new Coordinate(467230.558, 5975071.481), new Coordinate(467309.28, 5975083.867), new Coordinate(467309.28, 5975083.867), new Coordinate(466776.829, 5975009.807), new Coordinate(466776.829, 5975009.807), new Coordinate(466742.764, 5974999.507), new Coordinate(466713.482, 5974979.283) });
Polygon poly1 = factory.createPolygon(outer1);
testPointWithin(factory.createMultiPolygon(new Polygon[] { poly1 }));
}
use of com.vividsolutions.jts.geom.LinearRing in project hale by halestudio.
the class InteriorPointTest method testTriangle.
/**
* Test with a simple triangular polygon.
*
* @throws Exception if an error occurs
*/
@Test
public void testTriangle() 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) });
Polygon geom = factory.createPolygon(outer);
testPointWithin(geom);
}
use of com.vividsolutions.jts.geom.LinearRing in project hale by halestudio.
the class InteriorPointTest method testFootprint2Hole.
/**
* Test with a complex polygon describing a rough building footprint.
*
* @throws Exception if an error occurs
*/
@Test
public void testFootprint2Hole() throws Exception {
LinearRing outer = factory.createLinearRing(new Coordinate[] { new Coordinate(49.87517, 8.64862), new Coordinate(49.87491, 8.64873), new Coordinate(49.87497, 8.64913), new Coordinate(49.87521, 8.64904), new Coordinate(49.87525, 8.64924), new Coordinate(49.87424, 8.64958), new Coordinate(49.8742, 8.64937), new Coordinate(49.87446, 8.64929), new Coordinate(49.87441, 8.6489), new Coordinate(49.87414, 8.64897), new Coordinate(49.87411, 8.64877), new Coordinate(49.87514, 8.64844), new Coordinate(49.87517, 8.64862) });
LinearRing inner = factory.createLinearRing(new Coordinate[] { new Coordinate(49.87478, 8.6488), new Coordinate(49.87482, 8.64914), new Coordinate(49.8746, 8.64924), new Coordinate(49.87454, 8.64887), new Coordinate(49.87478, 8.6488) });
Polygon geom = factory.createPolygon(outer, new LinearRing[] { inner });
testPointWithin(geom);
}
use of com.vividsolutions.jts.geom.LinearRing in project hale by halestudio.
the class ExtendedWKBReader method readPolygon.
@SuppressWarnings("null")
private Polygon readPolygon() throws IOException {
int numRings = dis.readInt();
LinearRing[] holes = null;
if (numRings > 1)
holes = new LinearRing[numRings - 1];
LinearRing shell = readLinearRing();
for (int i = 0; i < numRings - 1; i++) {
holes[i] = readLinearRing();
}
return factory.createPolygon(shell, holes);
}
Aggregations