GeometryWrapperFactory { public static final GeometryWrapper createPolygon(List<Coordinate> coordinates, String srsURI, String geometryDatatypeURI) { Polygon geometry = GEOMETRY_FACTORY.createPolygon(coordinates.toArray(new Coordinate[coordinates.size()])); return createGeometry(geometry, srsURI, geometryDatatypeURI); }  static final GeometryWrapper createPoint(Coordinate coordinate, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createLineString(List<Coordinate> coordinates, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createLineString(Coordinate[] coordinates, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createLineString(LineString lineString, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createPolygon(List<Coordinate> coordinates, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createPolygon(LinearRing shell, LinearRing[] holes, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createPolygon(LinearRing shell, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createPolygon(Envelope envelope, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createMultiPoint(List<Coordinate> coordinates, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createMultiLineString(List<LineString> lineStrings, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createMultiPolygon(List<Polygon> polygons, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createGeometryCollection(List<Geometry> geometries, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createGeometry(Geometry geometry, String srsURI, String geometryDatatypeURI); static final GeometryWrapper createPoint(Coordinate coordinate, String geometryDatatypeURI); static final GeometryWrapper createLineString(Coordinate[] coordinates, String geometryDatatypeURI); static final GeometryWrapper createLineString(List<Coordinate> coordinates, String geometryDatatypeURI); static final GeometryWrapper createLineString(LineString lineString, String geometryDatatypeURI); static final GeometryWrapper createPolygon(List<Coordinate> coordinates, String geometryDatatypeURI); static final GeometryWrapper createPolygon(LinearRing shell, LinearRing[] holes, String geometryDatatypeURI); static final GeometryWrapper createPolygon(LinearRing shell, String geometryDatatypeURI); static final GeometryWrapper createPolygon(Envelope envelope, String geometryDatatypeURI); static final GeometryWrapper createMultiPoint(List<Coordinate> coordinates, String geometryDatatypeURI); static final GeometryWrapper createMultiLineString(List<LineString> lineStrings, String geometryDatatypeURI); static final GeometryWrapper createMultiPolygon(List<Polygon> polygons, String geometryDatatypeURI); static final GeometryWrapper createGeometry(Geometry geometry, String geometryDatatypeURI);  }
@Test public void testCreatPolygon() { List<Coordinate> coordinates = Arrays.asList(new Coordinate(1, 2), new Coordinate(10, 2), new Coordinate(10, 20), new Coordinate(1, 20), new Coordinate(1, 2)); String srsURI = SRS_URI.WGS84_CRS; String geometryDatatypeURI = WKTDatatype.URI; GeometryWrapper instance = GeometryWrapperFactory.createPolygon(coordinates, srsURI, geometryDatatypeURI); String expResult = "<http: String result = instance.asLiteral().getLexicalForm(); assertEquals(expResult, result); }
@Test public void testCreatPolygon_xy() { List<Coordinate> coordinates = Arrays.asList(new Coordinate(1, 2), new Coordinate(10, 2), new Coordinate(10, 20), new Coordinate(1, 20), new Coordinate(1, 2)); String srsURI = SRS_URI.DEFAULT_WKT_CRS84; String geometryDatatypeURI = WKTDatatype.URI; GeometryWrapper instance = GeometryWrapperFactory.createPolygon(coordinates, srsURI, geometryDatatypeURI); String expResult = "POLYGON((1 2, 10 2, 10 20, 1 20, 1 2))"; String result = instance.asLiteral().getLexicalForm(); assertEquals(expResult, result); }