use of net.opengis.gml.PointType in project arctic-sea by 52North.
the class GmlEncoderv311 method createPosition.
private XmlObject createPosition(Geometry geom, Optional<Object> optional) throws UnsupportedEncoderInputException {
String gmlId = (optional != null && optional.isPresent() && optional.get() instanceof String) ? (String) optional.get() : null;
if (geom instanceof Point) {
PointType xbPoint = PointType.Factory.newInstance(getXmlOptions());
if (gmlId != null) {
xbPoint.setId(geom.getGeometryType() + "_" + gmlId);
}
createPointFromJtsGeometry((Point) geom, xbPoint);
return xbPoint;
} else if (geom instanceof LineString) {
LineStringType xbLineString = LineStringType.Factory.newInstance(getXmlOptions());
if (gmlId != null) {
xbLineString.setId(geom.getGeometryType() + "_" + gmlId);
}
createLineStringFromJtsGeometry((LineString) geom, xbLineString);
return xbLineString;
} else if (geom instanceof Polygon) {
PolygonType xbPolygon = PolygonType.Factory.newInstance(getXmlOptions());
if (gmlId != null) {
xbPolygon.setId(geom.getGeometryType() + "_" + gmlId);
}
createPolygonFromJtsGeometry((Polygon) geom, xbPolygon);
return xbPolygon;
} else {
throw new UnsupportedEncoderInputException(this, geom);
}
}
Aggregations