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);
}
}
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"));
}
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"));
}
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;
}
Aggregations