use of org.geotoolkit.gml.xml.v311.LineStringType in project ddf by codice.
the class TestWfs10JTStoGML200Converter method testGMLToLineStringType.
@Test
public void testGMLToLineStringType() 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);
assertThat(Wfs10Constants.LINESTRING.getLocalPart().equals(lineStringType.getJAXBElementName().getLocalPart()), is(Boolean.TRUE));
String coords = lineStringType.getCoordinates().getValue().replaceAll("\n", "").trim();
assertThat(coords.isEmpty(), is(Boolean.FALSE));
assertThat(LINESTRING_COORDS.equals(coords), is(Boolean.TRUE));
}
use of org.geotoolkit.gml.xml.v311.LineStringType in project ddf by codice.
the class TestWfs10JTStoGML200Converter method extractLineStringMemberCoordinates.
private String extractLineStringMemberCoordinates(JAXBElement element1) throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
assertThat(Wfs10Constants.LINESTRING_MEMBER.getLocalPart().equals(element1.getName().getLocalPart()), is(Boolean.TRUE));
LineStringMemberType lsMemberType1 = (LineStringMemberType) element1.getValue();
JAXBElement geometry1 = lsMemberType1.getGeometry();
LineStringType lineStringType = (LineStringType) geometry1.getValue();
return lineStringType.getCoordinates().getValue().replaceAll("\n", "").trim();
}
use of org.geotoolkit.gml.xml.v311.LineStringType in project ddf by codice.
the class WfsFilterDelegate method createLineString.
private JAXBElement<LineStringType> createLineString(Geometry geometry) {
JAXBElement<LineStringType> jaxbElement = null;
try {
String gml = Wfs10JTStoGML200Converter.convertGeometryToGML(geometry);
LineStringType lineStringType = (LineStringType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(gml, Wfs10Constants.LINESTRING);
jaxbElement = (JAXBElement<LineStringType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(lineStringType);
} catch (JAXBException jbe) {
LOGGER.debug("Unable to create LineString with geometry: [{}]", geometry);
}
return jaxbElement;
}
use of org.geotoolkit.gml.xml.v311.LineStringType in project ddf by codice.
the class Wfs20JTStoGML321Converter method convertToLineStringType.
public static LineStringType convertToLineStringType(LineString line, String srsName) {
LineStringType lineStringType = GML320_OBJECT_FACTORY.createLineStringType();
CoordinatesType coordinatesType = GML320_OBJECT_FACTORY.createCoordinatesType();
StringBuilder stringBuffer = new StringBuilder();
for (int i = 0; i < line.getCoordinateSequence().size(); i++) {
Coordinate coordinate = line.getCoordinateSequence().getCoordinate(i);
if (i != 0) {
stringBuffer.append(" ");
}
stringBuffer.append(coordinate.x).append(",").append(coordinate.y);
if (!Double.isNaN(coordinate.z)) {
stringBuffer.append(",").append(coordinate.z);
}
}
coordinatesType.setValue(stringBuffer.toString());
lineStringType.setCoordinates(coordinatesType);
lineStringType.setSrsName(srsName);
return lineStringType;
}
use of org.geotoolkit.gml.xml.v311.LineStringType in project ddf by codice.
the class Wfs20JTStoGML321Converter method convertToRingType.
public static RingType convertToRingType(LinearRing line, String srsName) {
RingType ringType = GML320_OBJECT_FACTORY.createRingType();
CurvePropertyType curvePropertyType = GML320_OBJECT_FACTORY.createCurvePropertyType();
LineStringType curve = convertToLineStringType(line, srsName);
JAXBElement<LineStringType> lineStringTypeJAXBElement = GML320_OBJECT_FACTORY.createLineString(curve);
curvePropertyType.setAbstractCurve(lineStringTypeJAXBElement);
ringType.getCurveMember().add(curvePropertyType);
return ringType;
}
Aggregations