use of org.locationtech.jts.geom.Polygon in project arctic-sea by 52North.
the class GeoJSONTest method randomPolygon.
private Polygon randomPolygon(int srid) {
Polygon geometry = geometryFactory.createPolygon(randomLinearRing(srid), new LinearRing[] { randomLinearRing(srid), randomLinearRing(srid), randomLinearRing(srid) });
geometry.setSRID(srid);
return geometry;
}
use of org.locationtech.jts.geom.Polygon in project arctic-sea by 52North.
the class GeoJSONTest method testPolygonWithZCoordinate.
@Test
public void testPolygonWithZCoordinate() {
Polygon geometry = randomPolygon(EPSG_4326);
geometry.apply(new RandomZCoordinateFilter());
geometry.geometryChanged();
readWriteTest(geometry);
}
use of org.locationtech.jts.geom.Polygon in project arctic-sea by 52North.
the class JTSHelperTest method shouldReverseMultiPolygon.
@Test
public void shouldReverseMultiPolygon() throws OwsExceptionReport {
final GeometryFactory factory = getGeometryFactoryForSRID(4326);
testReverse(factory.createMultiPolygon(new Polygon[] { factory.createPolygon(factory.createLinearRing(randomCoordinateRing(13)), new LinearRing[] { factory.createLinearRing(randomCoordinateRing(130)), factory.createLinearRing(randomCoordinateRing(4121)), factory.createLinearRing(randomCoordinateRing(12)) }), factory.createPolygon(factory.createLinearRing(randomCoordinateRing(8)), new LinearRing[] { factory.createLinearRing(randomCoordinateRing(1101)), factory.createLinearRing(randomCoordinateRing(413)), factory.createLinearRing(randomCoordinateRing(123)) }), factory.createPolygon(factory.createLinearRing(randomCoordinateRing(89)), new LinearRing[] { factory.createLinearRing(randomCoordinateRing(112)), factory.createLinearRing(randomCoordinateRing(4)), factory.createLinearRing(randomCoordinateRing(43)) }) }));
}
use of org.locationtech.jts.geom.Polygon in project arctic-sea by 52North.
the class JTSHelperTest method shouldPolygonSwitchCoordinates.
@Test
public void shouldPolygonSwitchCoordinates() throws ParseException {
final GeometryFactory factory = getGeometryFactoryForSRID(4326);
Polygon polygon = factory.createPolygon(factory.createLinearRing(randomCoordinateRing(10)), new LinearRing[] { factory.createLinearRing(randomCoordinateRing(10)), factory.createLinearRing(randomCoordinateRing(41)), factory.createLinearRing(randomCoordinateRing(13)) });
assertNotEquals(polygon, switchCoordinateAxisOrder(polygon));
}
use of org.locationtech.jts.geom.Polygon in project onebusaway-application-modules by camsys.
the class BoundingBoxController method index.
@RequestMapping()
public ModelAndView index() {
GeometryFactory gf = new GeometryFactory();
List<Polygon> polygons = new ArrayList<Polygon>();
Map<String, CoordinateBounds> agencies = _agencyService.getAgencyIdsAndCoverageAreas();
for (CoordinateBounds cb : agencies.values()) {
Envelope e = new Envelope(cb.getMinLon(), cb.getMaxLon(), cb.getMinLat(), cb.getMaxLat());
Polygon p = (Polygon) gf.toGeometry(e);
polygons.add(p);
}
MultiPolygon mp = gf.createMultiPolygon(polygons.toArray(new Polygon[0]));
Geometry hull = mp.convexHull();
Envelope env = hull.getEnvelopeInternal();
ModelAndView mv = new ModelAndView("bounding-box.jspx");
mv.addObject("minY", env.getMinY());
mv.addObject("minX", env.getMinX());
mv.addObject("maxY", env.getMaxY());
mv.addObject("maxX", env.getMaxX());
mv.addObject("hullWKT", hull.toText());
return mv;
}
Aggregations