use of net.opengis.gml.DirectPositionType in project arctic-sea by 52North.
the class GmlDecoderv311 method parsePointType.
private Object parsePointType(PointType xbPointType) throws DecodingException {
String geomWKT = null;
int srid = -1;
if (xbPointType.getSrsName() != null) {
srid = CRSHelper.parseSrsName(xbPointType.getSrsName());
}
if (xbPointType.getPos() != null) {
DirectPositionType xbPos = xbPointType.getPos();
if (srid == -1 && xbPos.getSrsName() != null) {
srid = CRSHelper.parseSrsName(xbPos.getSrsName());
}
String directPosition = getString4Pos(xbPos);
geomWKT = JTSHelper.createWKTPointFromCoordinateString(directPosition);
} else if (xbPointType.getCoordinates() != null) {
CoordinatesType xbCoords = xbPointType.getCoordinates();
String directPosition = getString4Coordinates(xbCoords);
geomWKT = JTSHelper.createWKTPointFromCoordinateString(directPosition);
} else {
throw new DecodingException("For geometry type 'gml:Point' only elements 'gml:pos' and 'gml:coordinates' are allowed");
}
checkSrid(srid);
if (srid == -1) {
throw new DecodingException("No SrsName ist specified for geometry!");
}
try {
return JTSHelper.createGeometryFromWKT(geomWKT, srid);
} catch (ParseException ex) {
throw new DecodingException(ex);
}
}
use of net.opengis.gml.DirectPositionType in project arctic-sea by 52North.
the class GmlEncoderv311 method createPointFromJtsGeometry.
/**
* Creates a XML Point from a SOS Point.
*
* @param jtsPoint
* SOS Point
* @param xbPoint
* XML Point
*/
private void createPointFromJtsGeometry(Point jtsPoint, PointType xbPoint) {
DirectPositionType xbPos = xbPoint.addNewPos();
xbPos.setSrsName(getSrsName(jtsPoint));
xbPos.setStringValue(JTSHelper.getCoordinatesString(jtsPoint));
}
Aggregations