use of net.opengis.gml.x32.CoordinatesType in project ddf by codice.
the class WfsFilterDelegate method createCoordinates.
private CoordinatesType createCoordinates(Geometry geometry) {
CoordinatesType coords = gml320ObjectFactory.createCoordinatesType();
Coordinate[] coordinates = geometry.getCoordinates();
if (coordinates != null && coordinates.length > 0) {
StringBuffer coordString = new StringBuffer();
for (Coordinate coordinate : coordinates) {
coordString.append(coordinate.x).append(",").append(coordinate.y).append(" ");
}
coords.setValue(coordString.toString());
coords.setDecimal(".");
coords.setCs(",");
coords.setTs(" ");
coords.setValue(coordString.toString());
return coords;
} else {
throw new IllegalArgumentException("Unable to parse Geometry coordinates from WKT String");
}
}
use of net.opengis.gml.x32.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();
StringBuffer stringBuffer = new StringBuffer();
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 net.opengis.gml.x32.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 net.opengis.gml.x32.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 net.opengis.gml.x32.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);
}
Aggregations