Search in sources :

Example 1 with GeometryAssociationType

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

the class TestWfs10JTStoGML200Converter method testGMLToMultiPolygonType.

@Test
public void testGMLToMultiPolygonType() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
    String multiPolygonGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(MULTIPOLYGON));
    MultiPolygonType multiPolygonType = (MultiPolygonType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(multiPolygonGML, Wfs10Constants.MULTI_POLYGON);
    multiPolygonType.getJAXBElementName();
    List<JAXBElement<? extends GeometryAssociationType>> geometryMembers = multiPolygonType.getGeometryMember();
    assertThat(geometryMembers.size() == 2, is(Boolean.TRUE));
    PolygonMemberType polygonMemberType1 = (PolygonMemberType) geometryMembers.get(0).getValue();
    String coords1 = extractPolygonMemberCoordinates(polygonMemberType1);
    assertThat(MULTIPOLYGON_COORDS1.equals(coords1), is(Boolean.TRUE));
    PolygonMemberType polygonMemberType2 = (PolygonMemberType) geometryMembers.get(0).getValue();
    String coords2 = extractPolygonMemberCoordinates(polygonMemberType2);
    assertThat(MULTIPOLYGON_COORDS2.equals(coords2), is(Boolean.TRUE));
}
Also used : PolygonMemberType(ogc.schema.opengis.gml.v_2_1_2.PolygonMemberType) GeometryAssociationType(ogc.schema.opengis.gml.v_2_1_2.GeometryAssociationType) MultiPolygonType(ogc.schema.opengis.gml.v_2_1_2.MultiPolygonType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) JAXBElement(javax.xml.bind.JAXBElement) Test(org.junit.Test)

Example 2 with GeometryAssociationType

use of ogc.schema.opengis.gml.v_2_1_2.GeometryAssociationType 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 3 with GeometryAssociationType

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

the class TestWfs10JTStoGML200Converter method extractPointMemberTypeCoordinates.

private String extractPointMemberTypeCoordinates(JAXBElement<? extends GeometryAssociationType> jaxbElement1) throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
    assertThat(Wfs10Constants.POINT_MEMBER.getLocalPart().equals(jaxbElement1.getName().getLocalPart()), is(Boolean.TRUE));
    PointMemberType pointMemberType1 = (PointMemberType) jaxbElement1.getValue();
    JAXBElement<? extends AbstractGeometryType> geometry1 = pointMemberType1.getGeometry();
    assertThat(Wfs10Constants.POINT.getLocalPart().equals(geometry1.getName().getLocalPart()), is(Boolean.TRUE));
    return ((PointType) geometry1.getValue()).getCoordinates().getValue().replaceAll("\n", "").trim();
}
Also used : PointMemberType(ogc.schema.opengis.gml.v_2_1_2.PointMemberType)

Example 4 with GeometryAssociationType

use of ogc.schema.opengis.gml.v_2_1_2.GeometryAssociationType 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));
}
Also used : GeometryAssociationType(ogc.schema.opengis.gml.v_2_1_2.GeometryAssociationType) GeometryCollectionType(ogc.schema.opengis.gml.v_2_1_2.GeometryCollectionType) PointType(ogc.schema.opengis.gml.v_2_1_2.PointType) MultiPointType(ogc.schema.opengis.gml.v_2_1_2.MultiPointType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) JAXBElement(javax.xml.bind.JAXBElement) MultiLineStringType(ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType) LineStringType(ogc.schema.opengis.gml.v_2_1_2.LineStringType) Test(org.junit.Test)

Example 5 with GeometryAssociationType

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

the class TestWfs10JTStoGML200Converter method testGMLToMultiPointType.

@Test
public void testGMLToMultiPointType() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
    String multiPointGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(MULTIPOINT));
    MultiPointType multiPointType = (MultiPointType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(multiPointGML, Wfs10Constants.MULTI_POINT);
    List<JAXBElement<? extends GeometryAssociationType>> geoMembers = multiPointType.getGeometryMember();
    assertThat(geoMembers.isEmpty(), is(Boolean.FALSE));
    assertThat(Wfs10Constants.MULTI_POINT.getLocalPart().equals(multiPointType.getJAXBElementName().getLocalPart()), is(Boolean.TRUE));
    assertThat(geoMembers.size() == 4, is(Boolean.TRUE));
    String coords1 = extractPointMemberTypeCoordinates(geoMembers.get(0));
    assertThat(MULTIPOINT_COORDS1.equals(coords1), is(Boolean.TRUE));
    String coords2 = extractPointMemberTypeCoordinates(geoMembers.get(1));
    assertThat(MULTIPOINT_COORDS2.equals(coords2), is(Boolean.TRUE));
    String coords3 = extractPointMemberTypeCoordinates(geoMembers.get(2));
    assertThat(MULTIPOINT_COORDS3.equals(coords3), is(Boolean.TRUE));
    String coords4 = extractPointMemberTypeCoordinates(geoMembers.get(3));
    assertThat(MULTIPOINT_COORDS4.equals(coords4), is(Boolean.TRUE));
}
Also used : GeometryAssociationType(ogc.schema.opengis.gml.v_2_1_2.GeometryAssociationType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) JAXBElement(javax.xml.bind.JAXBElement) MultiPointType(ogc.schema.opengis.gml.v_2_1_2.MultiPointType) Test(org.junit.Test)

Aggregations

LineString (com.vividsolutions.jts.geom.LineString)4 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)4 JAXBElement (javax.xml.bind.JAXBElement)4 GeometryAssociationType (ogc.schema.opengis.gml.v_2_1_2.GeometryAssociationType)4 Test (org.junit.Test)4 MultiLineStringType (ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType)2 MultiPointType (ogc.schema.opengis.gml.v_2_1_2.MultiPointType)2 GeometryCollectionType (ogc.schema.opengis.gml.v_2_1_2.GeometryCollectionType)1 LineStringType (ogc.schema.opengis.gml.v_2_1_2.LineStringType)1 MultiPolygonType (ogc.schema.opengis.gml.v_2_1_2.MultiPolygonType)1 PointMemberType (ogc.schema.opengis.gml.v_2_1_2.PointMemberType)1 PointType (ogc.schema.opengis.gml.v_2_1_2.PointType)1 PolygonMemberType (ogc.schema.opengis.gml.v_2_1_2.PolygonMemberType)1