use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class WKTDatatypeTest method testReadMultiLineString.
/**
* Test of read method, of class WKTReader.
*/
@Test
public void testReadMultiLineString() {
String wktLiteral = "MULTILINESTRING ZM((10 10 0 1, 20 20 0 1, 10 40 0 1), (40 40 0 1, 30 30 0 1, 40 20 0 1, 30 10 0 1))";
LineString[] lineStrings = new LineString[2];
lineStrings[0] = GEOMETRY_FACTORY.createLineString(new CustomCoordinateSequence(CoordinateSequenceDimensions.XYZM, "10 10 0 1, 20 20 0 1, 10 40 0 1"));
lineStrings[1] = GEOMETRY_FACTORY.createLineString(new CustomCoordinateSequence(CoordinateSequenceDimensions.XYZM, "40 40 0 1, 30 30 0 1, 40 20 0 1, 30 10 0 1"));
Geometry geometry = GEOMETRY_FACTORY.createMultiLineString(lineStrings);
GeometryWrapper expResult = new GeometryWrapper(geometry, SRS_URI.DEFAULT_WKT_CRS84, WKTDatatype.URI, new DimensionInfo(4, 3, 1));
GeometryWrapper result = WKT_DATATYPE.read(wktLiteral);
//
//
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class WKTDatatypeTest method testReadPoint.
/**
* Test of read method, of class WKTReader.
*/
@Test
public void testReadPoint() {
String wktLiteral = "POINT ZM (11.0 12.0 8.0 5.0)";
Geometry geometry = GEOMETRY_FACTORY.createPoint(new CustomCoordinateSequence(CoordinateSequenceDimensions.XYZM, "11.0 12.0 8.0 5.0"));
GeometryWrapper expResult = new GeometryWrapper(geometry, SRS_URI.DEFAULT_WKT_CRS84, WKTDatatype.URI, new DimensionInfo(4, 3, 0));
GeometryWrapper result = WKT_DATATYPE.read(wktLiteral);
//
//
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class WKTDatatypeTest method testReadPolygon2.
/**
* Test of read method, of class WKTReader.
*/
@Test
public void testReadPolygon2() {
String wktLiteral = "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))";
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 expResult = new GeometryWrapper(geometry, SRS_URI.DEFAULT_WKT_CRS84, WKTDatatype.URI, new DimensionInfo(4, 3, 2));
GeometryWrapper result = WKT_DATATYPE.read(wktLiteral);
//
//
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class WKTDatatypeTest method testReadLineString.
/**
* Test of read method, of class WKTReader.
*/
@Test
public void testReadLineString() {
String wktLiteral = "LINESTRING ZM (11 12.1 8 5, 3 4 6 2)";
Geometry geometry = GEOMETRY_FACTORY.createLineString(new CustomCoordinateSequence(CoordinateSequenceDimensions.XYZM, "11 12.1 8 5, 3 4 6 2"));
GeometryWrapper expResult = new GeometryWrapper(geometry, SRS_URI.DEFAULT_WKT_CRS84, WKTDatatype.URI, new DimensionInfo(4, 3, 1));
GeometryWrapper result = WKT_DATATYPE.read(wktLiteral);
//
//
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.jts.CustomCoordinateSequence in project jena by apache.
the class GMLWriterTest method testWritePoint.
@Test
public void testWritePoint() {
Geometry geometry = GEOMETRY_FACTORY.createPoint(new CustomCoordinateSequence(CoordinateSequenceDimensions.XY, "11.0 12.1"));
GeometryWrapper geometryWrapper = new GeometryWrapper(geometry, GML_SRS_NAMESPACE, GMLDatatype.URI, new DimensionInfo(2, 2, 0));
String result = GMLWriter.write(geometryWrapper);
String expResult = "<gml:Point xmlns:gml=\"http://www.opengis.net/ont/gml\" srsName=\"urn:ogc:def:crs:EPSG::27700\"><gml:pos>11 12.1</gml:pos></gml:Point>";
assertEquals(expResult.trim(), result.trim());
}
Aggregations