Search in sources :

Example 1 with VectorType

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

the class SweCommonDecoderV20 method parseAbstractDataComponent.

private SweAbstractDataComponent parseAbstractDataComponent(AbstractDataComponentType abstractDataComponent) throws DecodingException {
    SweAbstractDataComponent sosAbstractDataComponent = null;
    if (abstractDataComponent instanceof BooleanType) {
        sosAbstractDataComponent = parseBoolean((BooleanType) abstractDataComponent);
    } else if (abstractDataComponent instanceof CategoryType) {
        sosAbstractDataComponent = parseCategory((CategoryType) abstractDataComponent);
    } else if (abstractDataComponent instanceof CountRangeType) {
        sosAbstractDataComponent = parseCountRange((CountRangeType) abstractDataComponent);
    } else if (abstractDataComponent instanceof CountType) {
        sosAbstractDataComponent = parseCount((CountType) abstractDataComponent);
    } else if (abstractDataComponent instanceof QuantityType) {
        sosAbstractDataComponent = parseQuantity((QuantityType) abstractDataComponent);
    } else if (abstractDataComponent instanceof QuantityRangeType) {
        sosAbstractDataComponent = parseQuantityRange((QuantityRangeType) abstractDataComponent);
    } else if (abstractDataComponent instanceof TextType) {
        sosAbstractDataComponent = parseText((TextType) abstractDataComponent);
    } else if (abstractDataComponent instanceof TimeType) {
        sosAbstractDataComponent = parseTime((TimeType) abstractDataComponent);
    } else if (abstractDataComponent instanceof TimeRangeType) {
        sosAbstractDataComponent = parseTimeRange((TimeRangeType) abstractDataComponent);
    } else if (abstractDataComponent instanceof VectorType) {
        sosAbstractDataComponent = parseVector((VectorType) abstractDataComponent);
    } else if (abstractDataComponent instanceof DataRecordType) {
        SweDataRecord sosDataRecord = parseDataRecord((DataRecordType) abstractDataComponent);
        DataRecordDocument dataRecordDoc = DataRecordDocument.Factory.newInstance(getXmlOptions());
        dataRecordDoc.setDataRecord((DataRecordType) abstractDataComponent);
        sosDataRecord.setXml(dataRecordDoc.xmlText(getXmlOptions()));
        sosAbstractDataComponent = sosDataRecord;
    } else if (abstractDataComponent instanceof DataArrayType) {
        SweDataArray sosDataArray = parseDataArray((DataArrayType) abstractDataComponent);
        DataArrayDocument dataArrayDoc = DataArrayDocument.Factory.newInstance(getXmlOptions());
        dataArrayDoc.setDataArray1((DataArrayType) abstractDataComponent);
        sosDataArray.setXml(dataArrayDoc.xmlText(getXmlOptions()));
        sosAbstractDataComponent = sosDataArray;
    } else {
        throw new UnsupportedDecoderXmlInputException(this, abstractDataComponent);
    }
    if (sosAbstractDataComponent != null) {
        if (abstractDataComponent.isSetDefinition()) {
            sosAbstractDataComponent.setDefinition(abstractDataComponent.getDefinition());
        }
        if (abstractDataComponent.isSetDescription()) {
            sosAbstractDataComponent.setDescription(abstractDataComponent.getDescription());
        }
        if (abstractDataComponent.isSetIdentifier()) {
            sosAbstractDataComponent.setIdentifier(abstractDataComponent.getIdentifier());
        }
        if (abstractDataComponent.isSetLabel()) {
            sosAbstractDataComponent.setLabel(abstractDataComponent.getLabel());
        }
    }
    return sosAbstractDataComponent;
}
Also used : DataRecordType(net.opengis.swe.x20.DataRecordType) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) BooleanType(net.opengis.swe.x20.BooleanType) CategoryType(net.opengis.swe.x20.CategoryType) CountType(net.opengis.swe.x20.CountType) SweDataArray(org.n52.shetland.ogc.swe.SweDataArray) DataRecordDocument(net.opengis.swe.x20.DataRecordDocument) TextType(net.opengis.swe.x20.TextType) TimeType(net.opengis.swe.x20.TimeType) TimeRangeType(net.opengis.swe.x20.TimeRangeType) CountRangeType(net.opengis.swe.x20.CountRangeType) QuantityType(net.opengis.swe.x20.QuantityType) SweDataRecord(org.n52.shetland.ogc.swe.SweDataRecord) VectorType(net.opengis.swe.x20.VectorType) UnsupportedDecoderXmlInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderXmlInputException) QuantityRangeType(net.opengis.swe.x20.QuantityRangeType) DataArrayType(net.opengis.swe.x20.DataArrayType) DataArrayDocument(net.opengis.swe.x20.DataArrayDocument)

Example 2 with VectorType

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

the class SweCommonEncoderv20 method asPropertyType.

private XmlObject asPropertyType(AbstractDataComponentType type) throws NotYetSupportedEncodingException {
    if (type instanceof BooleanType) {
        BooleanPropertyType propertyType = BooleanPropertyType.Factory.newInstance();
        propertyType.setBoolean((BooleanType) type);
        return propertyType;
    } else if (type instanceof CountType) {
        CountPropertyType propertyType = CountPropertyType.Factory.newInstance();
        propertyType.setCount((CountType) type);
        return propertyType;
    } else if (type instanceof CountRangeType) {
        CountRangePropertyType propertyType = CountRangePropertyType.Factory.newInstance();
        propertyType.setCountRange((CountRangeType) type);
        return propertyType;
    } else if (type instanceof QuantityType) {
        QuantityPropertyType propertyType = QuantityPropertyType.Factory.newInstance();
        propertyType.setQuantity((QuantityType) type);
        return propertyType;
    } else if (type instanceof QuantityRangeType) {
        QuantityRangePropertyType propertyType = QuantityRangePropertyType.Factory.newInstance();
        propertyType.setQuantityRange((QuantityRangeType) type);
        return propertyType;
    } else if (type instanceof TimeType) {
        TimePropertyType propertyType = TimePropertyType.Factory.newInstance();
        propertyType.setTime((TimeType) type);
        return propertyType;
    } else if (type instanceof TimeRangeType) {
        TimeRangePropertyType propertyType = TimeRangePropertyType.Factory.newInstance();
        propertyType.setTimeRange((TimeRangeType) type);
        return propertyType;
    } else if (type instanceof CategoryType) {
        CategoryPropertyType propertyType = CategoryPropertyType.Factory.newInstance();
        propertyType.setCategory((CategoryType) type);
        return propertyType;
    } else if (type instanceof CategoryRangeType) {
        CategoryRangePropertyType propertyType = CategoryRangePropertyType.Factory.newInstance();
        propertyType.setCategoryRange((CategoryRangeType) type);
        return propertyType;
    } else if (type instanceof MatrixType) {
        MatrixPropertyType propertyType = MatrixPropertyType.Factory.newInstance();
        propertyType.setMatrix((MatrixType) type);
        return propertyType;
    } else if (type instanceof DataArrayType) {
        DataArrayPropertyType propertyType = DataArrayPropertyType.Factory.newInstance();
        propertyType.setDataArray1((DataArrayType) type);
        return propertyType;
    } else if (type instanceof DataChoiceType) {
        DataChoicePropertyType propertyType = DataChoicePropertyType.Factory.newInstance();
        propertyType.setDataChoice((DataChoiceType) type);
        return propertyType;
    } else if (type instanceof DataRecordType) {
        DataRecordPropertyType propertyType = DataRecordPropertyType.Factory.newInstance();
        propertyType.setDataRecord((DataRecordType) type);
        return propertyType;
    } else if (type instanceof TextType) {
        TextPropertyType propertyType = TextPropertyType.Factory.newInstance();
        propertyType.setText((TextType) type);
        return propertyType;
    } else if (type instanceof VectorType) {
        VectorPropertyType propertyType = VectorPropertyType.Factory.newInstance();
        propertyType.setVector((VectorType) type);
        return propertyType;
    } else {
        throw new NotYetSupportedEncodingException(type.getClass().getName(), type);
    }
}
Also used : DataRecordType(net.opengis.swe.x20.DataRecordType) CategoryRangeType(net.opengis.swe.x20.CategoryRangeType) MatrixPropertyType(net.opengis.swe.x20.MatrixPropertyType) NotYetSupportedEncodingException(org.n52.svalbard.encode.exception.NotYetSupportedEncodingException) CategoryType(net.opengis.swe.x20.CategoryType) DataArrayPropertyType(net.opengis.swe.x20.DataArrayPropertyType) TimeRangePropertyType(net.opengis.swe.x20.TimeRangePropertyType) CountType(net.opengis.swe.x20.CountType) TimeType(net.opengis.swe.x20.TimeType) VectorPropertyType(net.opengis.swe.x20.VectorPropertyType) CountPropertyType(net.opengis.swe.x20.CountPropertyType) CountRangeType(net.opengis.swe.x20.CountRangeType) DataChoiceType(net.opengis.swe.x20.DataChoiceType) VectorType(net.opengis.swe.x20.VectorType) QuantityPropertyType(net.opengis.swe.x20.QuantityPropertyType) TextPropertyType(net.opengis.swe.x20.TextPropertyType) CountRangePropertyType(net.opengis.swe.x20.CountRangePropertyType) BooleanPropertyType(net.opengis.swe.x20.BooleanPropertyType) DataChoicePropertyType(net.opengis.swe.x20.DataChoicePropertyType) DataArrayType(net.opengis.swe.x20.DataArrayType) QuantityRangePropertyType(net.opengis.swe.x20.QuantityRangePropertyType) CategoryRangePropertyType(net.opengis.swe.x20.CategoryRangePropertyType) BooleanType(net.opengis.swe.x20.BooleanType) DataRecordPropertyType(net.opengis.swe.x20.DataRecordPropertyType) TextType(net.opengis.swe.x20.TextType) TimeRangeType(net.opengis.swe.x20.TimeRangeType) QuantityType(net.opengis.swe.x20.QuantityType) MatrixType(net.opengis.swe.x20.MatrixType) TimePropertyType(net.opengis.swe.x20.TimePropertyType) QuantityRangeType(net.opengis.swe.x20.QuantityRangeType) CategoryPropertyType(net.opengis.swe.x20.CategoryPropertyType)

Example 3 with VectorType

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

the class SweCommonEncoderv20 method asDocument.

private XmlObject asDocument(AbstractDataComponentType type) throws NotYetSupportedEncodingException {
    if (type instanceof BooleanType) {
        BooleanDocument document = BooleanDocument.Factory.newInstance();
        document.setBoolean((BooleanType) type);
        return document;
    } else if (type instanceof CountType) {
        CountDocument document = CountDocument.Factory.newInstance();
        document.setCount((CountType) type);
        return document;
    } else if (type instanceof CountRangeType) {
        CountRangeDocument document = CountRangeDocument.Factory.newInstance();
        document.setCountRange((CountRangeType) type);
        return document;
    } else if (type instanceof QuantityType) {
        QuantityDocument document = QuantityDocument.Factory.newInstance();
        document.setQuantity((QuantityType) type);
        return document;
    } else if (type instanceof QuantityRangeType) {
        QuantityRangeDocument document = QuantityRangeDocument.Factory.newInstance();
        document.setQuantityRange((QuantityRangeType) type);
        return document;
    } else if (type instanceof TimeType) {
        TimeDocument document = TimeDocument.Factory.newInstance();
        document.setTime((TimeType) type);
        return document;
    } else if (type instanceof TimeRangeType) {
        TimeRangeDocument document = TimeRangeDocument.Factory.newInstance();
        document.setTimeRange((TimeRangeType) type);
        return document;
    } else if (type instanceof CategoryType) {
        CategoryDocument document = CategoryDocument.Factory.newInstance();
        document.setCategory((CategoryType) type);
        return document;
    } else if (type instanceof CategoryRangeType) {
        CategoryRangeDocument document = CategoryRangeDocument.Factory.newInstance();
        document.setCategoryRange((CategoryRangeType) type);
        return document;
    } else if (type instanceof MatrixType) {
        MatrixDocument document = MatrixDocument.Factory.newInstance();
        document.setMatrix((MatrixType) type);
        return document;
    } else if (type instanceof DataArrayType) {
        DataArrayDocument document = DataArrayDocument.Factory.newInstance();
        document.setDataArray1((DataArrayType) type);
        return document;
    } else if (type instanceof DataChoiceType) {
        DataChoiceDocument document = DataChoiceDocument.Factory.newInstance();
        document.setDataChoice((DataChoiceType) type);
        return document;
    } else if (type instanceof DataRecordType) {
        DataRecordDocument document = DataRecordDocument.Factory.newInstance();
        document.setDataRecord((DataRecordType) type);
        return document;
    } else if (type instanceof TextType) {
        TextDocument document = TextDocument.Factory.newInstance();
        document.setText((TextType) type);
        return document;
    } else if (type instanceof VectorType) {
        VectorDocument document = VectorDocument.Factory.newInstance();
        document.setVector((VectorType) type);
        return document;
    } else {
        throw new NotYetSupportedEncodingException(type.getClass().getName(), type);
    }
}
Also used : MatrixDocument(net.opengis.swe.x20.MatrixDocument) DataRecordType(net.opengis.swe.x20.DataRecordType) CategoryRangeType(net.opengis.swe.x20.CategoryRangeType) NotYetSupportedEncodingException(org.n52.svalbard.encode.exception.NotYetSupportedEncodingException) TimeRangeDocument(net.opengis.swe.x20.TimeRangeDocument) CategoryType(net.opengis.swe.x20.CategoryType) CountType(net.opengis.swe.x20.CountType) QuantityDocument(net.opengis.swe.x20.QuantityDocument) TimeType(net.opengis.swe.x20.TimeType) VectorDocument(net.opengis.swe.x20.VectorDocument) CountRangeType(net.opengis.swe.x20.CountRangeType) DataChoiceType(net.opengis.swe.x20.DataChoiceType) VectorType(net.opengis.swe.x20.VectorType) DataChoiceDocument(net.opengis.swe.x20.DataChoiceDocument) CountRangeDocument(net.opengis.swe.x20.CountRangeDocument) DataArrayType(net.opengis.swe.x20.DataArrayType) DataArrayDocument(net.opengis.swe.x20.DataArrayDocument) TextDocument(net.opengis.swe.x20.TextDocument) BooleanType(net.opengis.swe.x20.BooleanType) BooleanDocument(net.opengis.swe.x20.BooleanDocument) DataRecordDocument(net.opengis.swe.x20.DataRecordDocument) TextType(net.opengis.swe.x20.TextType) TimeRangeType(net.opengis.swe.x20.TimeRangeType) CategoryDocument(net.opengis.swe.x20.CategoryDocument) CategoryRangeDocument(net.opengis.swe.x20.CategoryRangeDocument) CountDocument(net.opengis.swe.x20.CountDocument) QuantityType(net.opengis.swe.x20.QuantityType) MatrixType(net.opengis.swe.x20.MatrixType) QuantityRangeDocument(net.opengis.swe.x20.QuantityRangeDocument) TimeDocument(net.opengis.swe.x20.TimeDocument) QuantityRangeType(net.opengis.swe.x20.QuantityRangeType)

Example 4 with VectorType

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

the class SweCommonEncoderv101 method createVector.

private VectorType createVector(List<? extends SweCoordinate<?>> coordinates) throws EncodingException {
    VectorType vectorType = VectorType.Factory.newInstance(getXmlOptions());
    vectorType.setCoordinateArray(createCoordinates(coordinates));
    return vectorType;
}
Also used : VectorType(net.opengis.swe.x101.VectorType)

Example 5 with VectorType

use of net.opengis.swe.x20.VectorType 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

BooleanType (net.opengis.swe.x20.BooleanType)3 CategoryType (net.opengis.swe.x20.CategoryType)3 CountRangeType (net.opengis.swe.x20.CountRangeType)3 CountType (net.opengis.swe.x20.CountType)3 DataArrayType (net.opengis.swe.x20.DataArrayType)3 DataRecordType (net.opengis.swe.x20.DataRecordType)3 QuantityRangeType (net.opengis.swe.x20.QuantityRangeType)3 QuantityType (net.opengis.swe.x20.QuantityType)3 TextType (net.opengis.swe.x20.TextType)3 TimeRangeType (net.opengis.swe.x20.TimeRangeType)3 TimeType (net.opengis.swe.x20.TimeType)3 VectorType (net.opengis.swe.x20.VectorType)3 VectorType (net.opengis.swe.x101.VectorType)2 CategoryRangeType (net.opengis.swe.x20.CategoryRangeType)2 DataArrayDocument (net.opengis.swe.x20.DataArrayDocument)2 DataChoiceType (net.opengis.swe.x20.DataChoiceType)2 DataRecordDocument (net.opengis.swe.x20.DataRecordDocument)2 MatrixType (net.opengis.swe.x20.MatrixType)2 NotYetSupportedEncodingException (org.n52.svalbard.encode.exception.NotYetSupportedEncodingException)2 Position (net.opengis.sensorML.x101.PositionDocument.Position)1