use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class GMLWriterTest method testWriteMultiGeometry.
@Test
public void testWriteMultiGeometry() {
Geometry[] geometries = new Geometry[2];
geometries[0] = GEOMETRY_FACTORY.createPoint(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "4 6"));
geometries[1] = GEOMETRY_FACTORY.createLineString(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "4 6,7 10"));
Geometry geometry = GEOMETRY_FACTORY.createGeometryCollection(geometries);
GeometryWrapper geometryWrapper = new GeometryWrapper(geometry, GML_SRS_NAMESPACE, GMLDatatype.URI, new DimensionInfo(2, 2, 0));
String result = GMLWriter.write(geometryWrapper);
String expResult = "<gml:MultiGeometry xmlns:gml=\"http://www.opengis.net/ont/gml\" srsName=\"urn:ogc:def:crs:EPSG::27700\"><gml:geometryMember><gml:Point srsName=\"urn:ogc:def:crs:EPSG::27700\"><gml:pos>4 6</gml:pos></gml:Point></gml:geometryMember><gml:geometryMember><gml:LineString srsName=\"urn:ogc:def:crs:EPSG::27700\"><gml:posList>4 6 7 10</gml:posList></gml:LineString></gml:geometryMember></gml:MultiGeometry>";
assertEquals(expResult.trim(), result.trim());
}
use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class GMLWriterTest method testWriteMultiSurface2.
@Test
public void testWriteMultiSurface2() {
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);
GeometryWrapper geometryWrapper = new GeometryWrapper(geometry, GML_SRS_NAMESPACE, GMLDatatype.URI, new DimensionInfo(2, 2, 0));
String result = GMLWriter.write(geometryWrapper);
String expResult = "<gml:MultiSurface xmlns:gml=\"http://www.opengis.net/ont/gml\" srsName=\"urn:ogc:def:crs:EPSG::27700\"><gml:surfaceMember><gml:Polygon srsName=\"urn:ogc:def:crs:EPSG::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=\"urn:ogc:def:crs:EPSG::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>";
assertEquals(expResult.trim(), result.trim());
}
use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class GMLWriterTest method testWriteLineString.
@Test
public void testWriteLineString() {
Geometry geometry = GEOMETRY_FACTORY.createLineString(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "11.0 12.1, 15.0 8.0"));
GeometryWrapper geometryWrapper = new GeometryWrapper(geometry, GML_SRS_NAMESPACE, GMLDatatype.URI, new DimensionInfo(2, 2, 0));
String result = GMLWriter.write(geometryWrapper);
String expResult = "<gml:LineString xmlns:gml=\"http://www.opengis.net/ont/gml\" srsName=\"urn:ogc:def:crs:EPSG::27700\"><gml:posList>11 12.1 15 8</gml:posList></gml:LineString>";
assertEquals(expResult.trim(), result.trim());
}
use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class WKTWriterTest method testWritePolygon3.
/**
* Test of write method, of class WKTWriter.
*/
@Test
public void testWritePolygon3() {
LinearRing shell = GEOMETRY_FACTORY.createLinearRing(new CustomCoordinateSequence(CoordinateSequenceDimensions.XYZM, "30 10 0 1, 40 40 0 1, 20 40 0 1, 10 20 0 1, 30 10 0 1"));
LinearRing[] holes = new LinearRing[] { GEOMETRY_FACTORY.createLinearRing(new CustomCoordinateSequence(CoordinateSequenceDimensions.XYZM, "20 30 0 1, 35 35 0 1, 30 20 0 1, 20 30 0 1")) };
Geometry geometry = GEOMETRY_FACTORY.createPolygon(shell, holes);
GeometryWrapper geometryWrapper = new GeometryWrapper(geometry, SRS_URI.WGS84_CRS, WKTDatatype.URI, new DimensionInfo(4, 3, 2));
String expResult = "<" + SRS_URI.WGS84_CRS + "> POLYGON ZM((30 10 0 1, 40 40 0 1, 20 40 0 1, 10 20 0 1, 30 10 0 1), (20 30 0 1, 35 35 0 1, 30 20 0 1, 20 30 0 1))";
String result = WKTWriter.write(geometryWrapper);
//
//
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class WKTWriterTest method testWriteMultiPolygon.
/**
* Test of extract method, of class WKTWriter.
*/
@Test
public void testWriteMultiPolygon() {
Polygon[] polygons = new Polygon[2];
polygons[0] = GEOMETRY_FACTORY.createPolygon(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "40 40, 20 45, 45 30, 40 40"));
polygons[1] = GEOMETRY_FACTORY.createPolygon(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "20 35, 10 30, 10 10, 30 5, 45 20, 20 35"));
Geometry geometry = GEOMETRY_FACTORY.createMultiPolygon(polygons);
GeometryWrapper geometryWrapper = new GeometryWrapper(geometry, SRS_URI.WGS84_CRS, WKTDatatype.URI, new DimensionInfo(2, 2, 2));
String expResult = "<" + SRS_URI.WGS84_CRS + "> MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35)))";
String result = WKTWriter.write(geometryWrapper);
//
//
assertEquals(expResult, result);
}
Aggregations