Search in sources :

Example 6 with SweCoordinate

use of org.n52.shetland.ogc.swe.SweCoordinate 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

SweCoordinate (org.n52.shetland.ogc.swe.SweCoordinate)3 SweQuantity (org.n52.shetland.ogc.swe.simpleType.SweQuantity)2 BigDecimal (java.math.BigDecimal)1 Position (net.opengis.sensorML.x101.PositionDocument.Position)1 DataRecordDocument (net.opengis.swe.x101.DataRecordDocument)1 DataRecordType (net.opengis.swe.x101.DataRecordType)1 PositionType (net.opengis.swe.x101.PositionType)1 SimpleDataRecordType (net.opengis.swe.x101.SimpleDataRecordType)1 VectorType (net.opengis.swe.x101.VectorType)1 Coordinate (net.opengis.swe.x101.VectorType.Coordinate)1 Coordinate (net.opengis.swe.x20.VectorType.Coordinate)1 XmlObject (org.apache.xmlbeans.XmlObject)1 Test (org.junit.Test)1 Envelope (org.locationtech.jts.geom.Envelope)1 TimePeriod (org.n52.shetland.ogc.gml.time.TimePeriod)1 SmlPosition (org.n52.shetland.ogc.sensorML.elements.SmlPosition)1 SweDataArray (org.n52.shetland.ogc.swe.SweDataArray)1 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)1 SweEnvelope (org.n52.shetland.ogc.swe.SweEnvelope)1 SweSimpleDataRecord (org.n52.shetland.ogc.swe.SweSimpleDataRecord)1