use of net.opengis.swe.x101.PositionType in project arctic-sea by 52North.
the class SensorMLEncoderv101 method createPosition.
/**
* Creates the position section of the SensorML description.
*
* @param position
* SOS position
*
* @return XML Position element
*
* @throws EncodingException
* if an error occurs
*/
private Position createPosition(final SmlPosition position) throws EncodingException {
Position xbPosition = Position.Factory.newInstance(getXmlOptions());
if (position.isSetName()) {
xbPosition.setName(position.getName().getValue());
} else {
xbPosition.setName("position");
}
PositionType xbSwePosition = xbPosition.addNewPosition();
xbSwePosition.setFixed(position.isFixed());
xbSwePosition.setReferenceFrame(position.getReferenceFrame());
final VectorType xbVector = xbSwePosition.addNewLocation().addNewVector();
for (SweCoordinate<?> coordinate : position.getPosition()) {
if (coordinate.getValue().getValue() != null && (!coordinate.getValue().isSetValue() || !coordinate.getValue().getValue().equals(Double.NaN))) {
// FIXME: SWE Common NS
xbVector.addNewCoordinate().set(encodeObjectToXml(SweConstants.NS_SWE_101, coordinate));
}
}
return xbPosition;
}
Aggregations