Search in sources :

Example 26 with SweQuantity

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

the class SweCommonEncoderv101 method createSimpleType.

private AbstractDataComponentType createSimpleType(SweAbstractSimpleType<?> sosSimpleType, EncodingContext additionalValues) throws EncodingException {
    AbstractDataComponentType abstractDataComponentType = null;
    if (sosSimpleType instanceof SweBoolean) {
        abstractDataComponentType = createBoolean((SweBoolean) sosSimpleType);
    } else if (sosSimpleType instanceof SweCategory) {
        abstractDataComponentType = createCategory((SweCategory) sosSimpleType);
    } else if (sosSimpleType instanceof SweCount) {
        abstractDataComponentType = createCount((SweCount) sosSimpleType);
    } else if (sosSimpleType instanceof SweCountRange) {
        abstractDataComponentType = createCountRange((SweCountRange) sosSimpleType);
    } else if (sosSimpleType instanceof SweObservableProperty) {
        abstractDataComponentType = createObservableProperty((SweObservableProperty) sosSimpleType);
    } else if (sosSimpleType instanceof SweQuantity) {
        abstractDataComponentType = createQuantity((SweQuantity) sosSimpleType);
    } else if (sosSimpleType instanceof SweQuantityRange) {
        abstractDataComponentType = createQuantityRange((SweQuantityRange) sosSimpleType);
    } else if (sosSimpleType instanceof SweText) {
        abstractDataComponentType = createText((SweText) sosSimpleType);
    } else if (sosSimpleType instanceof SweTimeRange) {
        abstractDataComponentType = createTimeRange((SweTimeRange) sosSimpleType);
    } else if (sosSimpleType instanceof SweTime) {
        abstractDataComponentType = createTime((SweTime) sosSimpleType);
    } else {
        throw new NotYetSupportedEncodingException(SweAbstractSimpleType.class.getSimpleName(), sosSimpleType);
    }
    addAbstractDataComponentValues(abstractDataComponentType, sosSimpleType);
    return abstractDataComponentType;
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) AbstractDataComponentType(net.opengis.swe.x101.AbstractDataComponentType) SweText(org.n52.shetland.ogc.swe.simpleType.SweText) SweTime(org.n52.shetland.ogc.swe.simpleType.SweTime) NotYetSupportedEncodingException(org.n52.svalbard.encode.exception.NotYetSupportedEncodingException) SweQuantityRange(org.n52.shetland.ogc.swe.simpleType.SweQuantityRange) SweCountRange(org.n52.shetland.ogc.swe.simpleType.SweCountRange) SweCategory(org.n52.shetland.ogc.swe.simpleType.SweCategory) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) SweTimeRange(org.n52.shetland.ogc.swe.simpleType.SweTimeRange) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) SweObservableProperty(org.n52.shetland.ogc.swe.simpleType.SweObservableProperty)

Example 27 with SweQuantity

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

the class WmlTDREncoderv20 method createDataRecord.

/**
 * Create a SOS DataRecord object from SOS observation and encode to
 * XmlBeans object
 *
 * @param sosObservation
 *            SOS observation
 * @return XML DataRecord object
 * @throws EncodingException
 *             If an error occurs
 */
private XmlObject createDataRecord(OmObservation sosObservation) throws EncodingException {
    AbstractPhenomenon observableProperty = sosObservation.getObservationConstellation().getObservableProperty();
    SweQuantity quantity = new SweQuantity();
    quantity.setDefinition(observableProperty.getIdentifier());
    quantity.setDescription(observableProperty.getDescription());
    if (observableProperty instanceof OmObservableProperty && ((OmObservableProperty) observableProperty).isSetUnit()) {
        quantity.setUom(((OmObservableProperty) observableProperty).getUnit());
    }
    return createDataRecord(quantity, sosObservation.getObservationID());
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) AbstractPhenomenon(org.n52.shetland.ogc.om.AbstractPhenomenon) OmObservableProperty(org.n52.shetland.ogc.om.OmObservableProperty)

Aggregations

SweQuantity (org.n52.shetland.ogc.swe.simpleType.SweQuantity)22 Test (org.junit.Test)11 XmlObject (org.apache.xmlbeans.XmlObject)9 SweField (org.n52.shetland.ogc.swe.SweField)9 SweCategory (org.n52.shetland.ogc.swe.simpleType.SweCategory)9 SweText (org.n52.shetland.ogc.swe.simpleType.SweText)9 SweBoolean (org.n52.shetland.ogc.swe.simpleType.SweBoolean)8 SweCount (org.n52.shetland.ogc.swe.simpleType.SweCount)8 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)7 SimpleDataRecordType (net.opengis.swe.x101.SimpleDataRecordType)5 SweTime (org.n52.shetland.ogc.swe.simpleType.SweTime)5 NotYetSupportedEncodingException (org.n52.svalbard.encode.exception.NotYetSupportedEncodingException)5 SweQuantityRange (org.n52.shetland.ogc.swe.simpleType.SweQuantityRange)4 EncodingException (org.n52.svalbard.encode.exception.EncodingException)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 BigDecimal (java.math.BigDecimal)3 AnyScalarPropertyType (net.opengis.swe.x101.AnyScalarPropertyType)3 DataComponentPropertyType (net.opengis.swe.x101.DataComponentPropertyType)3 DataRecordType (net.opengis.swe.x101.DataRecordType)3 SweTimeRange (org.n52.shetland.ogc.swe.simpleType.SweTimeRange)3