Search in sources :

Example 1 with GetFeatureOfInterestResponse

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);
}
Also used : GetFeatureOfInterestResponse(org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse) GetFeatureOfInterestResponseType(net.opengis.sos.x20.GetFeatureOfInterestResponseType) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 2 with GetFeatureOfInterestResponse

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;
    }
}
Also used : GetFeatureOfInterestResponse(org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse) FeatureCollection(org.n52.shetland.ogc.om.features.FeatureCollection) XmlObject(org.apache.xmlbeans.XmlObject) Test(org.junit.Test)

Example 3 with GetFeatureOfInterestResponse

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;
}
Also used : FeatureCollection(org.n52.shetland.ogc.om.features.FeatureCollection) GetFeatureOfInterestResponseType(net.opengis.sos.x20.GetFeatureOfInterestResponseType) GetFeatureOfInterestResponseDocument(net.opengis.sos.x20.GetFeatureOfInterestResponseDocument) AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature)

Aggregations

GetFeatureOfInterestResponseType (net.opengis.sos.x20.GetFeatureOfInterestResponseType)2 FeatureCollection (org.n52.shetland.ogc.om.features.FeatureCollection)2 GetFeatureOfInterestResponse (org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 GetFeatureOfInterestResponseDocument (net.opengis.sos.x20.GetFeatureOfInterestResponseDocument)1 XmlObject (org.apache.xmlbeans.XmlObject)1 Test (org.junit.Test)1 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)1 SamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature)1 UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)1