use of net.opengis.swe.x20.DataStreamType in project arctic-sea by 52North.
the class SweCommonDecoderV20 method decode.
@Override
public Object decode(Object element) throws DecodingException {
if (element instanceof DataArrayPropertyType) {
final DataArrayPropertyType dataArrayPropertyType = (DataArrayPropertyType) element;
return parseAbstractDataComponent(dataArrayPropertyType.getDataArray1());
} else if (element instanceof DataRecordPropertyType) {
final DataRecordPropertyType dataRecordPropertyType = (DataRecordPropertyType) element;
return parseAbstractDataComponent(dataRecordPropertyType.getDataRecord());
} else if (element instanceof AbstractDataComponentDocument) {
return parseAbstractDataComponentDocument((AbstractDataComponentDocument) element);
} else if (element instanceof AbstractDataComponentType) {
return parseAbstractDataComponent((AbstractDataComponentType) element);
} else if (element instanceof Coordinate[]) {
return parseCoordinates((Coordinate[]) element);
} else if (element instanceof AnyScalarPropertyType[]) {
return parseAnyScalarPropertyTypeArray((AnyScalarPropertyType[]) element);
} else if (element instanceof TextEncodingDocument) {
final TextEncodingDocument textEncodingDoc = (TextEncodingDocument) element;
final SweTextEncoding sosTextEncoding = parseTextEncoding(textEncodingDoc.getTextEncoding());
sosTextEncoding.setXml(textEncodingDoc.xmlText(getXmlOptions()));
return sosTextEncoding;
} else if (element instanceof TextEncodingType) {
TextEncodingDocument textEncodingDoc = TextEncodingDocument.Factory.newInstance(getXmlOptions());
TextEncodingType textEncoding = (TextEncodingType) element;
textEncodingDoc.setTextEncoding(textEncoding);
SweTextEncoding sosTextEncoding = parseTextEncoding(textEncoding);
sosTextEncoding.setXml(textEncodingDoc.xmlText(getXmlOptions()));
return sosTextEncoding;
} else if (element instanceof TextPropertyType) {
return parseAbstractDataComponent(((TextPropertyType) element).getText());
} else if (element instanceof CountPropertyType) {
return parseAbstractDataComponent(((CountPropertyType) element).getCount());
} else if (element instanceof BooleanPropertyType) {
return parseAbstractDataComponent(((BooleanPropertyType) element).getBoolean());
} else if (element instanceof CategoryPropertyType) {
return parseAbstractDataComponent(((CategoryPropertyType) element).getCategory());
} else if (element instanceof QuantityPropertyType) {
return parseAbstractDataComponent(((QuantityPropertyType) element).getQuantity());
} else if (element instanceof DataStreamPropertyType) {
return parseDataStream(((DataStreamPropertyType) element).getDataStream());
} else if (element instanceof DataStreamType) {
return parseDataStream((DataStreamType) element);
} else if (element instanceof DataStreamDocument) {
return parseDataStream(((DataStreamDocument) element).getDataStream());
} else if (element instanceof XmlObject) {
throw new UnsupportedDecoderXmlInputException(this, (XmlObject) element);
} else {
throw new UnsupportedDecoderInputException(this, element);
}
}
use of net.opengis.swe.x20.DataStreamType 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;
}
Aggregations