Search in sources :

Example 6 with MeasurementTimeseriesDocument

use of net.opengis.waterml.x20.MeasurementTimeseriesDocument in project arctic-sea by 52North.

the class WmlTVPEncoderv20Test method shouldEncodeInterpolationTypeContinuousAsDefault.

@Test
public void shouldEncodeInterpolationTypeContinuousAsDefault() throws EncodingException, XmlException {
    XmlObject encodedElement = encoder.encode(mv);
    TVPDefaultMetadataPropertyType defaultPointMetadata = ((MeasurementTimeseriesDocument) encodedElement).getTimeseries().getDefaultPointMetadataArray(0);
    DefaultTVPMeasurementMetadataDocument tvpMeasurementMetadataDocument = DefaultTVPMeasurementMetadataDocument.Factory.parse(defaultPointMetadata.xmlText());
    ReferenceType interpolationType = tvpMeasurementMetadataDocument.getDefaultTVPMeasurementMetadata().getInterpolationType();
    Assert.assertThat(interpolationType.getHref(), Is.is("http://www.opengis.net/def/waterml/2.0/interpolationType/Continuous"));
    Assert.assertThat(interpolationType.getTitle(), Is.is("Continuous"));
}
Also used : TVPDefaultMetadataPropertyType(net.opengis.waterml.x20.TVPDefaultMetadataPropertyType) XmlObject(org.apache.xmlbeans.XmlObject) DefaultTVPMeasurementMetadataDocument(net.opengis.waterml.x20.DefaultTVPMeasurementMetadataDocument) ReferenceType(net.opengis.gml.x32.ReferenceType) Test(org.junit.Test)

Example 7 with MeasurementTimeseriesDocument

use of net.opengis.waterml.x20.MeasurementTimeseriesDocument in project arctic-sea by 52North.

the class WmlTVPEncoderv20 method createMeasurementTimeseries.

private XmlObject createMeasurementTimeseries(AbstractObservationValue<?> observationValue) throws CodedException {
    MeasurementTimeseriesDocument measurementTimeseriesDoc = MeasurementTimeseriesDocument.Factory.newInstance();
    MeasurementTimeseriesType measurementTimeseries = measurementTimeseriesDoc.addNewMeasurementTimeseries();
    measurementTimeseries.setId(TIMESERIES_ID_PREFIX + observationValue.getObservationID());
    // Default value
    TimeseriesMetadata timeseriesMetadata = new MeasurementTimeseriesMetadata().setCumulative(false);
    if (observationValue.isSetValue() && observationValue.isSetMetadata() && observationValue.getMetadata().isSetTimeseriesMetadata()) {
        timeseriesMetadata = observationValue.getMetadata().getTimeseriesmetadata();
    }
    addTimeseriesMetadata(measurementTimeseries, observationValue.getPhenomenonTime().getGmlId(), timeseriesMetadata);
    TVPDefaultMetadataPropertyType xbMetaComponent = measurementTimeseries.addNewDefaultPointMetadata();
    DefaultTVPMeasurementMetadataDocument xbDefMeasureMetaComponent = DefaultTVPMeasurementMetadataDocument.Factory.newInstance();
    TVPMeasurementMetadataType defaultTVPMeasurementMetadata = xbDefMeasureMetaComponent.addNewDefaultTVPMeasurementMetadata();
    // Default value
    InterpolationType interpolationType = InterpolationType.Continuous;
    if (observationValue.isSetValue() && observationValue.isSetDefaultPointMetadata() && observationValue.getDefaultPointMetadata().isSetDefaultTVPMeasurementMetadata() && observationValue.getDefaultPointMetadata().getDefaultTVPMeasurementMetadata().isSetInterpolationType()) {
        interpolationType = observationValue.getDefaultPointMetadata().getDefaultTVPMeasurementMetadata().getInterpolationtype();
    }
    defaultTVPMeasurementMetadata.addNewInterpolationType().setHref(interpolationType.getIdentifier());
    xbDefMeasureMetaComponent.getDefaultTVPMeasurementMetadata().getInterpolationType().setTitle(interpolationType.getTitle());
    String unit = addValues(measurementTimeseries, observationValue);
    // set uom
    if (unit != null && !unit.isEmpty()) {
        defaultTVPMeasurementMetadata.addNewUom().setCode(unit);
    // } else {
    // OmObservableProperty observableProperty =
    // (OmObservableProperty)
    // sosObservation.getObservationConstellation().getObservableProperty();
    // if (observableProperty.isSetUnit()) {
    // defaultTVPMeasurementMetadata.addNewUom().setCode(observableProperty.getUnit());
    // }
    }
    xbMetaComponent.set(xbDefMeasureMetaComponent);
    return measurementTimeseriesDoc;
}
Also used : TimeseriesMetadata(org.n52.shetland.ogc.om.series.wml.TimeseriesMetadata) MeasurementTimeseriesMetadata(org.n52.shetland.ogc.om.series.wml.MeasurementTimeseriesMetadata) MeasurementTimeseriesType(net.opengis.waterml.x20.MeasurementTimeseriesType) TVPDefaultMetadataPropertyType(net.opengis.waterml.x20.TVPDefaultMetadataPropertyType) MeasurementTimeseriesMetadata(org.n52.shetland.ogc.om.series.wml.MeasurementTimeseriesMetadata) TVPMeasurementMetadataType(net.opengis.waterml.x20.TVPMeasurementMetadataType) DefaultTVPMeasurementMetadataDocument(net.opengis.waterml.x20.DefaultTVPMeasurementMetadataDocument) InterpolationType(org.n52.shetland.ogc.om.series.wml.WaterMLConstants.InterpolationType) MeasurementTimeseriesDocument(net.opengis.waterml.x20.MeasurementTimeseriesDocument)

Aggregations

DefaultTVPMeasurementMetadataDocument (net.opengis.waterml.x20.DefaultTVPMeasurementMetadataDocument)5 MeasurementTimeseriesDocument (net.opengis.waterml.x20.MeasurementTimeseriesDocument)5 TVPDefaultMetadataPropertyType (net.opengis.waterml.x20.TVPDefaultMetadataPropertyType)5 XmlObject (org.apache.xmlbeans.XmlObject)4 Test (org.junit.Test)4 MeasurementTimeseriesType (net.opengis.waterml.x20.MeasurementTimeseriesType)3 TVPMeasurementMetadataType (net.opengis.waterml.x20.TVPMeasurementMetadataType)3 MeasurementTimeseriesMetadata (org.n52.shetland.ogc.om.series.wml.MeasurementTimeseriesMetadata)3 InterpolationType (org.n52.shetland.ogc.om.series.wml.WaterMLConstants.InterpolationType)3 ReferenceType (net.opengis.gml.x32.ReferenceType)2 DefaultPointMetadata (org.n52.shetland.ogc.om.series.wml.DefaultPointMetadata)2 DefaultTVPMeasurementMetadata (org.n52.shetland.ogc.om.series.wml.DefaultTVPMeasurementMetadata)2 TimeseriesMetadata (org.n52.shetland.ogc.om.series.wml.TimeseriesMetadata)2 List (java.util.List)1 MeasurementTimeseriesMetadataType (net.opengis.waterml.x20.MeasurementTimeseriesMetadataType)1 MultiObservationValues (org.n52.shetland.ogc.om.MultiObservationValues)1 OmObservableProperty (org.n52.shetland.ogc.om.OmObservableProperty)1 SingleObservationValue (org.n52.shetland.ogc.om.SingleObservationValue)1 TimeLocationValueTriple (org.n52.shetland.ogc.om.TimeLocationValueTriple)1 Metadata (org.n52.shetland.ogc.om.series.wml.Metadata)1