Search in sources :

Example 1 with ElementType

use of net.opengis.swe.x20.DataStreamType.ElementType 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)

Example 2 with ElementType

use of net.opengis.swe.x20.DataStreamType.ElementType in project arctic-sea by 52North.

the class SweCommonDecoderV20 method parseDataArray.

private SweDataArray parseDataArray(DataArrayType xbDataArray) throws DecodingException {
    SweDataArray sosSweDataArray = new SweDataArray();
    CountPropertyType elementCount = xbDataArray.getElementCount();
    if (elementCount != null) {
        sosSweDataArray.setElementCount(parseElementCount(elementCount));
    }
    // parse data record to elementType
    DataArrayType.ElementType xbElementType = xbDataArray.getElementType();
    if (xbElementType != null && xbElementType.getAbstractDataComponent() != null) {
        sosSweDataArray.setElementType(parseAbstractDataComponent(xbElementType.getAbstractDataComponent()));
    }
    if (xbDataArray.isSetEncoding()) {
        sosSweDataArray.setEncoding(parseEncoding(xbDataArray.getEncoding().getAbstractEncoding()));
    }
    // parse values
    if (xbDataArray.isSetValues()) {
        sosSweDataArray.setValues(parseValues(sosSweDataArray.getElementCount(), sosSweDataArray.getElementType(), sosSweDataArray.getEncoding(), xbDataArray.getValues()));
    }
    // set XML
    DataArrayDocument dataArrayDoc = DataArrayDocument.Factory.newInstance(getXmlOptions());
    dataArrayDoc.setDataArray1(xbDataArray);
    sosSweDataArray.setXml(dataArrayDoc.xmlText(getXmlOptions()));
    return sosSweDataArray;
}
Also used : CountPropertyType(net.opengis.swe.x20.CountPropertyType) SweDataArray(org.n52.shetland.ogc.swe.SweDataArray) DataArrayType(net.opengis.swe.x20.DataArrayType) DataArrayDocument(net.opengis.swe.x20.DataArrayDocument)

Aggregations

CountPropertyType (net.opengis.swe.x20.CountPropertyType)1 DataArrayDocument (net.opengis.swe.x20.DataArrayDocument)1 DataArrayType (net.opengis.swe.x20.DataArrayType)1 DataStreamDocument (net.opengis.swe.x20.DataStreamDocument)1 ElementType (net.opengis.swe.x20.DataStreamType.ElementType)1 SweDataArray (org.n52.shetland.ogc.swe.SweDataArray)1 SweDataStream (org.n52.shetland.ogc.swe.SweDataStream)1