Search in sources :

Example 1 with Position

use of net.opengis.sensorML.x101.PositionDocument.Position 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;
}
Also used : PositionType(net.opengis.swe.x101.PositionType) SmlPosition(org.n52.shetland.ogc.sensorML.elements.SmlPosition) Position(net.opengis.sensorML.x101.PositionDocument.Position) VectorType(net.opengis.swe.x101.VectorType)

Aggregations

Position (net.opengis.sensorML.x101.PositionDocument.Position)1 PositionType (net.opengis.swe.x101.PositionType)1 VectorType (net.opengis.swe.x101.VectorType)1 SmlPosition (org.n52.shetland.ogc.sensorML.elements.SmlPosition)1