Search in sources :

Example 1 with MultiLineStringType

use of ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType in project ddf by codice.

the class WfsFilterDelegate method createMultiLineString.

private JAXBElement<MultiLineStringType> createMultiLineString(Geometry geometry) {
    JAXBElement<MultiLineStringType> jaxbElement = null;
    try {
        String gml = Wfs10JTStoGML200Converter.convertGeometryToGML(geometry);
        MultiLineStringType multiLineStringType = (MultiLineStringType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(gml, Wfs10Constants.MULTI_LINESTRING);
        jaxbElement = (JAXBElement<MultiLineStringType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(multiLineStringType);
    } catch (JAXBException jbe) {
        LOGGER.debug("Unable to create MultiLineStringType with geometry: [{}]", geometry);
    }
    return jaxbElement;
}
Also used : JAXBException(javax.xml.bind.JAXBException) MultiLineStringType(ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString)

Example 2 with MultiLineStringType

use of ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType in project ddf by codice.

the class WfsFilterDelegate method createMultiPolygon.

private JAXBElement<MultiPolygonType> createMultiPolygon(Geometry geometry) {
    JAXBElement<MultiPolygonType> jaxbElement = null;
    try {
        String gml = Wfs10JTStoGML200Converter.convertGeometryToGML(geometry);
        MultiLineStringType multiLineStringType = (MultiLineStringType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(gml, Wfs10Constants.MULTI_LINESTRING);
        jaxbElement = (JAXBElement<MultiPolygonType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(multiLineStringType);
    } catch (JAXBException jbe) {
        LOGGER.debug("Unable to create MultiPolygonType with geometry: [{}]", geometry);
    }
    return jaxbElement;
}
Also used : JAXBException(javax.xml.bind.JAXBException) MultiLineStringType(ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType) MultiPolygonType(ogc.schema.opengis.gml.v_2_1_2.MultiPolygonType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString)

Example 3 with MultiLineStringType

use of ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType in project ddf by codice.

the class TestWfs10JTStoGML200Converter method testGMLToMultiLineStringType.

@Test
public void testGMLToMultiLineStringType() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
    String multiLineStringGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(MULTILINESTRING));
    MultiLineStringType multiLineStringType = (MultiLineStringType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(multiLineStringGML, Wfs10Constants.MULTI_LINESTRING);
    List<JAXBElement<? extends GeometryAssociationType>> jaxbElements = multiLineStringType.getGeometryMember();
    assertThat(jaxbElements.isEmpty(), is(Boolean.FALSE));
    assertThat(jaxbElements.size() == 2, is(Boolean.TRUE));
    String coordinates1 = extractLineStringMemberCoordinates(jaxbElements.get(0));
    assertThat(coordinates1.isEmpty(), is(Boolean.FALSE));
    assertThat(MULTILINESTRING_COORD1.equals(coordinates1), is(Boolean.TRUE));
    String coordinates2 = extractLineStringMemberCoordinates(jaxbElements.get(1));
    assertThat(coordinates2.isEmpty(), is(Boolean.FALSE));
    assertThat(MULTILINESTRING_COORD2.equals(coordinates2), is(Boolean.TRUE));
}
Also used : GeometryAssociationType(ogc.schema.opengis.gml.v_2_1_2.GeometryAssociationType) MultiLineStringType(ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) JAXBElement(javax.xml.bind.JAXBElement) Test(org.junit.Test)

Example 4 with MultiLineStringType

use of ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType in project ddf by codice.

the class TestWfs10JTStoGML200Converter method testMultiLineStringTypeToJAXB.

@Test
public void testMultiLineStringTypeToJAXB() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
    String multiLineString = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(MULTILINESTRING));
    MultiLineStringType multiLineStringType = (MultiLineStringType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(multiLineString, Wfs10Constants.MULTI_LINESTRING);
    JAXBElement<MultiLineStringType> multiLineStringTypeJAXBElement = (JAXBElement<MultiLineStringType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(multiLineStringType);
    JAXB.marshal(multiLineStringTypeJAXBElement, writer);
    String xml = writer.toString();
    Diff diff = XMLUnit.compareXML(xml, MULTILINESTRING_GML);
    assertTrue(XMLUNIT_SIMILAR, diff.similar());
    assertThat(diff.similar(), is(Boolean.TRUE));
    assertThat(diff.identical(), is(Boolean.FALSE));
}
Also used : Diff(org.custommonkey.xmlunit.Diff) MultiLineStringType(ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) JAXBElement(javax.xml.bind.JAXBElement) Test(org.junit.Test)

Aggregations

LineString (com.vividsolutions.jts.geom.LineString)4 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)4 MultiLineStringType (ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType)4 JAXBElement (javax.xml.bind.JAXBElement)2 JAXBException (javax.xml.bind.JAXBException)2 Test (org.junit.Test)2 GeometryAssociationType (ogc.schema.opengis.gml.v_2_1_2.GeometryAssociationType)1 MultiPolygonType (ogc.schema.opengis.gml.v_2_1_2.MultiPolygonType)1 Diff (org.custommonkey.xmlunit.Diff)1