use of org.geotoolkit.gml.xml.v321.CoordinatesType in project ddf by codice.
the class WfsFilterDelegate method createPoint.
private JAXBElement<PointType> createPoint(String wkt) {
Coordinate[] coordinates = getCoordinatesFromWkt(wkt);
if (coordinates != null && coordinates.length > 0) {
StringBuilder coordString = new StringBuilder();
coordString.append(coordinates[0].x).append(",").append(coordinates[0].y);
CoordinatesType coordinatesType = new CoordinatesType();
coordinatesType.setValue(coordString.toString());
PointType point = new PointType();
point.setSrsName(srsName);
point.setCoordinates(coordinatesType);
return gmlObjectFactory.createPoint(point);
} else {
throw new IllegalArgumentException("Unable to parse Point coordinates from WKT String");
}
}
use of org.geotoolkit.gml.xml.v321.CoordinatesType in project ddf by codice.
the class WfsFilterDelegate method createPolygon.
private JAXBElement<PolygonType> createPolygon(String wkt) {
PolygonType polygon = new PolygonType();
LinearRingType linearRing = new LinearRingType();
Coordinate[] coordinates = getCoordinatesFromWkt(wkt);
if (coordinates != null && coordinates.length > 0) {
StringBuffer coordString = new StringBuffer();
for (Coordinate coordinate : coordinates) {
coordString.append(coordinate.x).append(",").append(coordinate.y).append(" ");
}
CoordinatesType coordinatesType = new CoordinatesType();
coordinatesType.setValue(coordString.toString());
coordinatesType.setDecimal(".");
coordinatesType.setCs(",");
coordinatesType.setTs(" ");
linearRing.setCoordinates(coordinatesType);
LinearRingMemberType member = new LinearRingMemberType();
member.setGeometry(gmlObjectFactory.createLinearRing(linearRing));
polygon.setOuterBoundaryIs(member);
polygon.setSrsName(srsName);
return gmlObjectFactory.createPolygon(polygon);
} else {
throw new IllegalArgumentException("Unable to parse Polygon coordinates from WKT String");
}
}
use of org.geotoolkit.gml.xml.v321.CoordinatesType in project ddf by codice.
the class WfsFilterDelegate method createCoordinatesTypeFromWkt.
private JAXBElement<CoordinatesType> createCoordinatesTypeFromWkt(String wkt) {
Envelope envelope = createEnvelopeFromWkt(wkt);
String coords = buildCoordinateString(envelope);
CoordinatesType coordinatesType = new CoordinatesType();
coordinatesType.setValue(coords);
return gmlObjectFactory.createCoordinates(coordinatesType);
}
use of org.geotoolkit.gml.xml.v321.CoordinatesType 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.v321.CoordinatesType in project ddf by codice.
the class WfsFilterDelegate method createLineString.
private JAXBElement<LineStringType> createLineString(Geometry geometry) {
LineStringType lineStringType = gmlObjectFactory.createLineStringType();
String coordinatesValue = coordinateStrategy.toString(geometry.getCoordinates());
CoordinatesType coordinatesType = gmlObjectFactory.createCoordinatesType();
coordinatesType.setValue(coordinatesValue);
coordinatesType.setDecimal(".");
coordinatesType.setCs(",");
coordinatesType.setTs(" ");
lineStringType.setCoordinates(coordinatesType);
return gmlObjectFactory.createLineString(lineStringType);
}
Aggregations