Search in sources :

Example 1 with SweDataStream

use of org.n52.shetland.ogc.swe.SweDataStream in project arctic-sea by 52North.

the class SensorMLDecoderV20 method parseDataInterfaceType.

protected SmlDataInterface parseDataInterfaceType(DataInterfaceType xbDataInterface) throws DecodingException {
    SmlDataInterface dataInterface = new SmlDataInterface();
    // TODO implement- no funding at the moment available
    // When starting implementation: Do not forget to activate the already
    // available unit tests
    Object data = decodeXmlElement(xbDataInterface.getData());
    if (data instanceof SweDataStream) {
        dataInterface.setData((SweDataStream) data);
    }
    if (xbDataInterface.isSetInterfaceParameters()) {
        Object parameter = decodeXmlElement(xbDataInterface.getInterfaceParameters());
        if (parameter instanceof SweDataRecord) {
            dataInterface.setInputParameters((SweDataRecord) parameter);
        }
    // TODO throw exception if not instance of SweDataRecord
    }
    return dataInterface;
}
Also used : SweDataStream(org.n52.shetland.ogc.swe.SweDataStream) SweDataRecord(org.n52.shetland.ogc.swe.SweDataRecord) DescribedObject(org.n52.shetland.ogc.sensorML.v20.DescribedObject) XmlObject(org.apache.xmlbeans.XmlObject) SmlDataInterface(org.n52.shetland.ogc.sensorML.v20.SmlDataInterface)

Example 2 with SweDataStream

use of org.n52.shetland.ogc.swe.SweDataStream in project arctic-sea by 52North.

the class SweCommonDecoderV20 method parseDataStream.

private SweDataStream parseDataStream(DataStreamType dataStream) throws DecodingException {
    SweDataStream sweDataStream = new SweDataStream();
    if (dataStream.isSetElementCount() && dataStream.getElementCount().getCount() != null) {
        sweDataStream.setElementCount(parseCount(dataStream.getElementCount().getCount()));
    }
    // parse data record to elementType
    ElementType xbElementType = dataStream.getElementType();
    if (xbElementType != null && xbElementType.getAbstractDataComponent() != null) {
        sweDataStream.setElementType(parseAbstractDataComponent(xbElementType.getAbstractDataComponent()));
    }
    if (dataStream.getEncoding() != null && dataStream.getEncoding().getAbstractEncoding() != null) {
        sweDataStream.setEncoding(parseEncoding(dataStream.getEncoding().getAbstractEncoding()));
    }
    // parse values
    if (dataStream.getValues() != null) {
        sweDataStream.setValues(parseValues(sweDataStream.getElementCount(), sweDataStream.getElementType(), sweDataStream.getEncoding(), dataStream.getValues()));
    }
    // set XML
    DataStreamDocument dataStreamDoc = DataStreamDocument.Factory.newInstance(getXmlOptions());
    dataStreamDoc.setDataStream(dataStream);
    sweDataStream.setXml(dataStreamDoc.xmlText(getXmlOptions()));
    return sweDataStream;
}
Also used : DataStreamDocument(net.opengis.swe.x20.DataStreamDocument) ElementType(net.opengis.swe.x20.DataStreamType.ElementType) SweDataStream(org.n52.shetland.ogc.swe.SweDataStream)

Aggregations

SweDataStream (org.n52.shetland.ogc.swe.SweDataStream)2 DataStreamDocument (net.opengis.swe.x20.DataStreamDocument)1 ElementType (net.opengis.swe.x20.DataStreamType.ElementType)1 XmlObject (org.apache.xmlbeans.XmlObject)1 DescribedObject (org.n52.shetland.ogc.sensorML.v20.DescribedObject)1 SmlDataInterface (org.n52.shetland.ogc.sensorML.v20.SmlDataInterface)1 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)1