use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class GMLReaderTest method testExtractMultiSurface2.
/**
* Test of extract method, of class GMLReader.
*
* @throws org.jdom2.JDOMException
* @throws java.io.IOException
*/
@Test
public void testExtractMultiSurface2() throws JDOMException, IOException {
Polygon[] polygons = new Polygon[2];
polygons[0] = GEOMETRY_FACTORY.createPolygon(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "40 40, 20 45, 45 30, 40 40"));
LinearRing shell = GEOMETRY_FACTORY.createLinearRing(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "20 35, 10 30, 10 10, 30 5, 45 20, 20 35"));
LinearRing[] holes = new LinearRing[] { GEOMETRY_FACTORY.createLinearRing(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "30 20, 20 15, 20 25, 30 20")) };
polygons[1] = GEOMETRY_FACTORY.createPolygon(shell, holes);
Geometry geometry = GEOMETRY_FACTORY.createMultiPolygon(polygons);
GMLReader expResult = new GMLReader(geometry, 2, SRS_URI.OSGB36_CRS);
String gmlText = "<gml:MultiSurface xmlns:gml=\"http://www.opengis.net/ont/gml\" srsName=\"http://www.opengis.net/def/crs/EPSG/0/27700\"><gml:surfaceMember><gml:Polygon srsName=\"http://www.opengis.net/def/crs/EPSG/0/27700\"><gml:exterior><gml:LinearRing><gml:posList>40 40 20 45 45 30 40 40</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember><gml:surfaceMember><gml:Polygon srsName=\"http://www.opengis.net/def/crs/EPSG/0/27700\"><gml:exterior><gml:LinearRing><gml:posList>20 35 10 30 10 10 30 5 45 20 20 35</gml:posList></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:posList>30 20 20 15 20 25 30 20</gml:posList></gml:LinearRing></gml:interior></gml:Polygon></gml:surfaceMember></gml:MultiSurface>";
GMLReader result = GMLReader.extract(gmlText);
//
//
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class GMLDatatypeTest method testPolygon.
@Test
public void testPolygon() throws JDOMException, IOException {
GeometryWrapper geo = GML_DATATYPE.read("<gml:Polygon xmlns:gml=\"http://www.opengis.net/ont/gml\" srsName=\"urn:ogc:def:crs:EPSG::27700\"><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">30 10 40 40 20 40 10 20 30 10</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon>");
Geometry test = GEOMETRY_FACTORY.createPolygon(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "30 10, 40 40, 20 40, 10 20, 30 10"));
GeometryWrapper expResult = new GeometryWrapper(test, URN_SRS_NAMESPACE, GMLDatatype.URI, new DimensionInfo(2, 2, 2));
//
//
assertEquals(geo, expResult);
}
use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class GMLDatatypeTest method testPolygon2.
@Test
public void testPolygon2() throws JDOMException, IOException {
GeometryWrapper geo = GML_DATATYPE.read("<gml:Polygon xmlns:gml=\"http://www.opengis.net/ont/gml\" srsName=\"urn:ogc:def:crs:EPSG::27700\"><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">30 10 40 40 20 40 10 20 30 10</gml:posList></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:posList srsDimension=\"2\">20 30 35 35 30 20 20 30</gml:posList></gml:LinearRing></gml:interior></gml:Polygon>");
LinearRing shell = GEOMETRY_FACTORY.createLinearRing(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "30 10, 40 40, 20 40, 10 20, 30 10"));
LinearRing[] holes = new LinearRing[] { GEOMETRY_FACTORY.createLinearRing(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "20 30, 35 35, 30 20, 20 30")) };
Geometry test = GEOMETRY_FACTORY.createPolygon(shell, holes);
GeometryWrapper expResult = new GeometryWrapper(test, URN_SRS_NAMESPACE, GMLDatatype.URI, new DimensionInfo(2, 2, 2));
//
//
assertEquals(geo, expResult);
}
use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class GMLDatatypeTest method testMultiCurve.
@Test
public void testMultiCurve() throws JDOMException, IOException {
GeometryWrapper geo = GML_DATATYPE.read("<gml:MultiCurve xmlns:gml=\"http://www.opengis.net/ont/gml\" srsName=\"urn:ogc:def:crs:EPSG::27700\"><gml:curveMember><gml:LineString><gml:posList srsDimension=\"2\">10 10 20 20 10 40</gml:posList></gml:LineString></gml:curveMember><gml:curveMember><gml:LineString><gml:posList srsDimension=\"2\">40 40 30 30 40 20 30 10</gml:posList></gml:LineString></gml:curveMember></gml:MultiCurve>");
LineString[] lineStrings = new LineString[2];
lineStrings[0] = GEOMETRY_FACTORY.createLineString(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "10 10, 20 20, 10 40"));
lineStrings[1] = GEOMETRY_FACTORY.createLineString(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "40 40, 30 30, 40 20, 30 10"));
Geometry test = GEOMETRY_FACTORY.createMultiLineString(lineStrings);
GeometryWrapper expResult = new GeometryWrapper(test, URN_SRS_NAMESPACE, GMLDatatype.URI, new DimensionInfo(2, 2, 1));
//
//
assertEquals(geo, expResult);
}
use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class GMLDatatypeTest method testLineString.
@Test
public void testLineString() throws JDOMException, IOException {
GeometryWrapper geo = GML_DATATYPE.read("<gml:LineString srsName=\"urn:ogc:def:crs:EPSG::27700\" xmlns:gml=\"http://www.opengis.net/ont/gml\"><gml:posList srsDimension=\"2\">-83.4 34.0 -83.3 34.3</gml:posList></gml:LineString>");
Geometry test = GEOMETRY_FACTORY.createLineString(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "-83.4 34.0, -83.3 34.3"));
GeometryWrapper expResult = new GeometryWrapper(test, URN_SRS_NAMESPACE, GMLDatatype.URI, new DimensionInfo(2, 2, 1));
//
//
assertEquals(geo, expResult);
}
Aggregations