Search in sources :

Example 1 with ReferenceType

use of net.opengis.gml.x32.ReferenceType in project arctic-sea by 52North.

the class AbstractGmlDecoderv321 method parseNamedValueType.

protected NamedValue<?> parseNamedValueType(NamedValuePropertyType namedValueProperty) throws DecodingException {
    if (namedValueProperty.isSetNamedValue()) {
        NamedValueType namedValue = namedValueProperty.getNamedValue();
        NamedValue<?> sosNamedValue = parseNamedValueValue(namedValue.getValue());
        org.n52.shetland.ogc.gml.ReferenceType referenceType = (org.n52.shetland.ogc.gml.ReferenceType) decodeXmlObject(namedValue.getName());
        sosNamedValue.setName(referenceType);
        return sosNamedValue;
    } else if (namedValueProperty.isSetHref()) {
        NamedValue<org.n52.shetland.ogc.gml.ReferenceType> sosNamedValue = new NamedValue<>();
        org.n52.shetland.ogc.gml.ReferenceType referenceType = new org.n52.shetland.ogc.gml.ReferenceType(namedValueProperty.getHref());
        if (namedValueProperty.isSetTitle()) {
            referenceType.setTitle(namedValueProperty.getTitle());
        }
        sosNamedValue.setName(referenceType);
        return sosNamedValue;
    } else {
        throw new UnsupportedDecoderInputException(this, namedValueProperty);
    }
}
Also used : NamedValueType(net.opengis.om.x20.NamedValueType) NamedValue(org.n52.shetland.ogc.om.NamedValue) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) ReferenceType(net.opengis.gml.x32.ReferenceType)

Example 2 with ReferenceType

use of net.opengis.gml.x32.ReferenceType in project arctic-sea by 52North.

the class WmlTVPEncoderv20Test method shouldEncodeInterpolationType.

@Test
public void shouldEncodeInterpolationType() throws EncodingException, XmlException {
    final InterpolationType type = WaterMLConstants.InterpolationType.MinPrec;
    mv.setDefaultPointMetadata(new DefaultPointMetadata().setDefaultTVPMeasurementMetadata(new DefaultTVPMeasurementMetadata().setInterpolationtype(type)));
    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/MinPrec"));
    Assert.assertThat(interpolationType.getTitle(), Is.is("MinPrec"));
}
Also used : DefaultPointMetadata(org.n52.shetland.ogc.om.series.wml.DefaultPointMetadata) TVPDefaultMetadataPropertyType(net.opengis.waterml.x20.TVPDefaultMetadataPropertyType) DefaultTVPMeasurementMetadata(org.n52.shetland.ogc.om.series.wml.DefaultTVPMeasurementMetadata) XmlObject(org.apache.xmlbeans.XmlObject) DefaultTVPMeasurementMetadataDocument(net.opengis.waterml.x20.DefaultTVPMeasurementMetadataDocument) InterpolationType(org.n52.shetland.ogc.om.series.wml.WaterMLConstants.InterpolationType) ReferenceType(net.opengis.gml.x32.ReferenceType) Test(org.junit.Test)

Example 3 with ReferenceType

use of net.opengis.gml.x32.ReferenceType 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 4 with ReferenceType

use of net.opengis.gml.x32.ReferenceType in project arctic-sea by 52North.

the class GmlEncoderv321 method createReferencType.

private ReferenceType createReferencType(org.n52.shetland.ogc.gml.ReferenceType sosReferenceType) {
    if (!sosReferenceType.isSetHref()) {
        String exceptionText = String.format("The required 'href' parameter is empty for encoding %s!", ReferenceType.class.getName());
        LOGGER.error(exceptionText);
        throw new IllegalArgumentException(exceptionText);
    }
    ReferenceType referenceType = ReferenceType.Factory.newInstance();
    referenceType.setHref(sosReferenceType.getHref());
    if (sosReferenceType.isSetTitle()) {
        referenceType.setTitle(sosReferenceType.getTitle());
    }
    if (sosReferenceType.isSetRole()) {
        referenceType.setRole(sosReferenceType.getRole());
    }
    return referenceType;
}
Also used : MultiLineString(org.locationtech.jts.geom.MultiLineString) LineString(org.locationtech.jts.geom.LineString) ReferenceType(net.opengis.gml.x32.ReferenceType)

Aggregations

ReferenceType (net.opengis.gml.x32.ReferenceType)4 DefaultTVPMeasurementMetadataDocument (net.opengis.waterml.x20.DefaultTVPMeasurementMetadataDocument)2 TVPDefaultMetadataPropertyType (net.opengis.waterml.x20.TVPDefaultMetadataPropertyType)2 XmlObject (org.apache.xmlbeans.XmlObject)2 Test (org.junit.Test)2 NamedValueType (net.opengis.om.x20.NamedValueType)1 LineString (org.locationtech.jts.geom.LineString)1 MultiLineString (org.locationtech.jts.geom.MultiLineString)1 NamedValue (org.n52.shetland.ogc.om.NamedValue)1 DefaultPointMetadata (org.n52.shetland.ogc.om.series.wml.DefaultPointMetadata)1 DefaultTVPMeasurementMetadata (org.n52.shetland.ogc.om.series.wml.DefaultTVPMeasurementMetadata)1 InterpolationType (org.n52.shetland.ogc.om.series.wml.WaterMLConstants.InterpolationType)1 UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)1