use of org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse in project arctic-sea by 52North.
the class GetFeatureOfInterestResponseDocumentDecoder method decode.
@Override
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE")
public GetFeatureOfInterestResponse decode(GetFeatureOfInterestResponseDocument gfoird) throws DecodingException {
if (gfoird != null) {
GetFeatureOfInterestResponse response = new GetFeatureOfInterestResponse();
setService(response);
setVersions(response);
GetFeatureOfInterestResponseType gfoirt = gfoird.getGetFeatureOfInterestResponse();
response.setExtensions(parseExtensibleResponse(gfoirt));
response.setAbstractFeature(parseFeatures(gfoirt));
return response;
}
throw new UnsupportedDecoderInputException(this, gfoird);
}
use of org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse in project arctic-sea by 52North.
the class GetFeatureOfInterestResponseDecoderTest method testMultiCurve.
@Test
public void testMultiCurve() throws XmlException, IOException, DecodingException {
try {
XmlObject xml = XmlObject.Factory.parse(getClass().getResourceAsStream("/GetFeatureOfInterestResponse.xml"));
DecoderKey decoderKey = CodingHelper.getDecoderKey(xml);
System.out.println(decoderKey);
Decoder<GetFeatureOfInterestResponse, XmlObject> decoder = decoderRepository.getDecoder(decoderKey);
GetFeatureOfInterestResponse response = decoder.decode(xml);
assertThat(response, is(notNullValue()));
assertThat(response.getAbstractFeature(), is(instanceOf(FeatureCollection.class)));
FeatureCollection abstractFeature = (FeatureCollection) response.getAbstractFeature();
assertThat(abstractFeature.getMembers().size(), is(266));
System.out.println("feature: " + response.getAbstractFeature());
} catch (Throwable t) {
t.printStackTrace(System.out);
throw t;
}
}
use of org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse in project arctic-sea by 52North.
the class GetFeatureOfInterestResponseEncoder method create.
@Override
protected XmlObject create(GetFeatureOfInterestResponse response) throws EncodingException {
GetFeatureOfInterestResponseDocument document = GetFeatureOfInterestResponseDocument.Factory.newInstance(getXmlOptions());
GetFeatureOfInterestResponseType xbGetFoiResponse = document.addNewGetFeatureOfInterestResponse();
AbstractFeature feature = response.getAbstractFeature();
if (feature instanceof FeatureCollection) {
for (AbstractFeature f : (FeatureCollection) feature) {
addFeatureOfInterest(f, xbGetFoiResponse);
}
} else if (feature instanceof SamplingFeature) {
addFeatureOfInterest(feature, xbGetFoiResponse);
}
XmlHelper.makeGmlIdsUnique(document.getDomNode());
return document;
}
Aggregations