use of net.opengis.gml._3.LineStringType in project tiamat by entur.
the class LineStringConverterTest method convertToLineString.
@Test
public void convertToLineString() throws Exception {
LineStringType lineStringType = new LineStringType().withId("LineString").withPosList(new DirectPositionListType().withSrsDimension(BigInteger.valueOf(2L)).withValue(71.1, 9.1, 4.1, 9.5));
LineString lineString = lineStringConverter.convertTo(lineStringType, new TypeBuilder<LineString>() {
}.build(), mappingContext);
assertThat(lineString).isNotNull();
assertThat(lineString.getCoordinates()).hasSize(2);
assertThat(lineString.getCoordinates()[0].x).isEqualTo(lineStringType.getPosList().getValue().get(1));
assertThat(lineString.getCoordinates()[0].y).isEqualTo(lineStringType.getPosList().getValue().get(0));
assertThat(lineString.getCoordinates()[1].x).isEqualTo(lineStringType.getPosList().getValue().get(3));
assertThat(lineString.getCoordinates()[1].y).isEqualTo(lineStringType.getPosList().getValue().get(2));
}
use of net.opengis.gml._3.LineStringType in project ddf by codice.
the class WfsFilterDelegateTest method testLineStringLatLonOrder.
@Test
public void testLineStringLatLonOrder() {
final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.INTERSECTS.getValue(), new LatLonCoordinateStrategy());
final FilterType filter = delegate.intersects(Metacard.ANY_GEO, LINESTRING);
assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BinarySpatialOpType.class)));
final BinarySpatialOpType binarySpatialOpType = (BinarySpatialOpType) filter.getSpatialOps().getValue();
assertThat(binarySpatialOpType.getGeometry().getValue(), is(instanceOf(LineStringType.class)));
final LineStringType lineStringType = (LineStringType) binarySpatialOpType.getGeometry().getValue();
assertThat(lineStringType.getCoordinates().getValue(), is("10.0,30.0 30.0,10.0 40.0,50.0"));
}
use of net.opengis.gml._3.LineStringType in project ddf by codice.
the class WfsFilterDelegateTest method testLineStringLonLatOrder.
@Test
public void testLineStringLonLatOrder() {
final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.INTERSECTS.getValue(), new LonLatCoordinateStrategy());
final FilterType filter = delegate.intersects(Metacard.ANY_GEO, LINESTRING);
assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BinarySpatialOpType.class)));
final BinarySpatialOpType binarySpatialOpType = (BinarySpatialOpType) filter.getSpatialOps().getValue();
assertThat(binarySpatialOpType.getGeometry().getValue(), is(instanceOf(LineStringType.class)));
final LineStringType lineStringType = (LineStringType) binarySpatialOpType.getGeometry().getValue();
assertThat(lineStringType.getCoordinates().getValue(), is("30.0,10.0 10.0,30.0 50.0,40.0"));
}
use of net.opengis.gml._3.LineStringType in project ddf by codice.
the class TestWfs10JTStoGML200Converter method testLineStringTypeToJAXB.
@Test
public void testLineStringTypeToJAXB() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
LineString lineString = (LineString) getGeometryFromWkt(LINESTRING);
assertThat(lineString == null, is(Boolean.FALSE));
String lineStringGML = Wfs10JTStoGML200Converter.convertGeometryToGML(lineString);
LineStringType lineStringType = (LineStringType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(lineStringGML, Wfs10Constants.LINESTRING);
JAXBElement<LineStringType> lineStringTypeJAXBElement = (JAXBElement<LineStringType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(lineStringType);
XMLUnit.setNormalizeWhitespace(Boolean.TRUE);
JAXB.marshal(lineStringTypeJAXBElement, writer);
String xml = writer.toString();
Diff diff = XMLUnit.compareXML(xml, LINESTRING_GML);
assertTrue(XMLUNIT_SIMILAR, diff.similar());
assertThat(diff.similar(), is(Boolean.TRUE));
assertThat(diff.identical(), is(Boolean.FALSE));
}
use of net.opengis.gml._3.LineStringType in project ddf by codice.
the class TestWfs10JTStoGML200Converter method testGMLToGeometryCollectionType.
@Test
public void testGMLToGeometryCollectionType() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
String geometryCollectionGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(GEOMETRYCOLLECTION));
GeometryCollectionType geometryCollectionType = (GeometryCollectionType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(geometryCollectionGML, Wfs10Constants.GEOMETRY_COLLECTION);
assertFalse(geometryCollectionType == null);
List<JAXBElement<? extends GeometryAssociationType>> geometryMembers = geometryCollectionType.getGeometryMember();
assertThat(CollectionUtils.isEmpty(geometryMembers), is(Boolean.FALSE));
assertThat(geometryMembers.size() == 2, is(Boolean.TRUE));
GeometryAssociationType geometryAssociationType = geometryMembers.get(0).getValue();
JAXBElement<? extends AbstractGeometryType> jaxbElement = geometryAssociationType.getGeometry();
assertThat(Wfs10Constants.POINT.getLocalPart().equals(jaxbElement.getName().getLocalPart()), is(Boolean.TRUE));
PointType pointType = (PointType) jaxbElement.getValue();
assertThat(pointType == null, is(Boolean.FALSE));
assertThat(GEOMETRYCOLLECTION_POINT_COORD.equals(pointType.getCoordinates().getValue().trim()), is(Boolean.TRUE));
GeometryAssociationType geometryAssociationType2 = geometryMembers.get(1).getValue();
JAXBElement<? extends AbstractGeometryType> jaxbElement2 = geometryAssociationType2.getGeometry();
assertThat(Wfs10Constants.LINESTRING.getLocalPart().equals(jaxbElement2.getName().getLocalPart()), is(Boolean.TRUE));
LineStringType lineStringType = (LineStringType) jaxbElement2.getValue();
assertThat(lineStringType == null, is(Boolean.FALSE));
assertThat(GEOMETRYCOLLECTION_LINESTRING_COORD.equals(lineStringType.getCoordinates().getValue().trim()), is(Boolean.TRUE));
}
Aggregations