Search in sources :

Example 11 with AbstractFeature

use of org.n52.shetland.ogc.gml.AbstractFeature in project arctic-sea by 52North.

the class OmDecoderv20 method getObservationConstellation.

private OmObservationConstellation getObservationConstellation(OMObservationType omot, Map<String, AbstractFeature> featureMap) throws DecodingException {
    OmObservationConstellation observationConstellation = new OmObservationConstellation();
    observationConstellation.setObservationType(getObservationType(omot));
    observationConstellation.setProcedure(createProcedure(omot));
    observationConstellation.setObservableProperty(getObservableProperty(omot));
    observationConstellation.setFeatureOfInterest(createFeatureOfInterest(omot, featureMap));
    return observationConstellation;
}
Also used : OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation)

Example 12 with AbstractFeature

use of org.n52.shetland.ogc.gml.AbstractFeature in project arctic-sea by 52North.

the class OmDecoderv20 method parseOmObservation.

private OmObservation parseOmObservation(OMObservationType omObservation) throws DecodingException {
    Map<String, AbstractFeature> featureMap = Maps.newHashMap();
    OmObservation sosObservation = new OmObservation();
    // parse identifier, description
    parseAbstractFeatureType(omObservation, sosObservation);
    OmObservationConstellation observationConstallation = getObservationConstellation(omObservation, featureMap);
    sosObservation.setObservationConstellation(observationConstallation);
    sosObservation.setResultTime(getResultTime(omObservation));
    sosObservation.setValidTime(getValidTime(omObservation));
    if (omObservation.getParameterArray() != null) {
        sosObservation.setParameter(parseNamedValueTypeArray(omObservation.getParameterArray()));
    }
    sosObservation.setValue(getObservationValue(omObservation));
    return sosObservation;
}
Also used : OmObservation(org.n52.shetland.ogc.om.OmObservation) AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) XmlString(org.apache.xmlbeans.XmlString) OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation)

Example 13 with AbstractFeature

use of org.n52.shetland.ogc.gml.AbstractFeature in project arctic-sea by 52North.

the class SamplingDecoderv20 method parseSpatialSamplingFeature.

private AbstractFeature parseSpatialSamplingFeature(final SFSpatialSamplingFeatureType spatialSamplingFeature) throws DecodingException {
    final SamplingFeature sosFeat = new SamplingFeature(null, spatialSamplingFeature.getId());
    // parse identifier, names, description
    parseAbstractFeatureType(spatialSamplingFeature, sosFeat);
    sosFeat.setFeatureType(getFeatureType(spatialSamplingFeature.getType()));
    sosFeat.setSampledFeatures(getSampledFeatures(spatialSamplingFeature.getSampledFeatureArray()));
    sosFeat.setXml(getXmlDescription(spatialSamplingFeature));
    sosFeat.setGeometry(getGeometry(spatialSamplingFeature.getShape()));
    checkTypeAndGeometry(sosFeat);
    sosFeat.setGmlId(spatialSamplingFeature.getId());
    return sosFeat;
}
Also used : SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature)

Example 14 with AbstractFeature

use of org.n52.shetland.ogc.gml.AbstractFeature in project arctic-sea by 52North.

the class AbstractOmEncoderv20 method encode.

@Override
public XmlObject encode(Object element, EncodingContext additionalValues) throws EncodingException {
    XmlObject encodedObject = null;
    if (element instanceof OmObservation) {
        encodedObject = encodeOmObservation((OmObservation) element, additionalValues);
    } else if (element instanceof NamedValue) {
        NamedValueType nvt = createNamedValue((NamedValue<?>) element);
        if (additionalValues.has(XmlBeansEncodingFlags.DOCUMENT)) {
            NamedValueDocument nvd = NamedValueDocument.Factory.newInstance();
            nvd.setNamedValue(nvt);
            encodedObject = nvd;
        } else if (additionalValues.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
            NamedValuePropertyType nvpt = NamedValuePropertyType.Factory.newInstance();
            nvpt.setNamedValue(nvt);
            encodedObject = nvpt;
        } else {
            encodedObject = nvt;
        }
    } else if (element instanceof AbstractFeature) {
        encodedObject = encodeFeatureOfInterest((AbstractFeature) element);
    } else if (element instanceof SosProcedureDescription) {
        encodedObject = encodeProcedureDescription((SosProcedureDescription<?>) element);
    } else {
        throw new UnsupportedEncoderInputException(this, element);
    }
    // XmlHelper.validateDocument(encodedObject));
    return encodedObject;
}
Also used : NamedValueDocument(net.opengis.om.x20.NamedValueDocument) NamedValueType(net.opengis.om.x20.NamedValueType) OmObservation(org.n52.shetland.ogc.om.OmObservation) SosProcedureDescription(org.n52.shetland.ogc.sos.SosProcedureDescription) AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) XmlObject(org.apache.xmlbeans.XmlObject) NamedValue(org.n52.shetland.ogc.om.NamedValue) NamedValuePropertyType(net.opengis.om.x20.NamedValuePropertyType) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)

Example 15 with AbstractFeature

use of org.n52.shetland.ogc.gml.AbstractFeature in project arctic-sea by 52North.

the class AbstractOmEncoderv20 method setFeatureOfInterest.

private void setFeatureOfInterest(OmObservation observation, OMObservationType xb) throws EncodingException {
    AbstractFeature foi = observation.getObservationConstellation().getFeatureOfInterest();
    XmlObject xbFoi = encodeFeatureOfInterest(foi);
    xb.addNewFeatureOfInterest().set(xbFoi);
}
Also used : AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) XmlObject(org.apache.xmlbeans.XmlObject)

Aggregations

AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)33 XmlObject (org.apache.xmlbeans.XmlObject)23 XmlException (org.apache.xmlbeans.XmlException)10 AbstractSamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.AbstractSamplingFeature)10 FeatureCollection (org.n52.shetland.ogc.om.features.FeatureCollection)9 SamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature)9 OmObservation (org.n52.shetland.ogc.om.OmObservation)8 OmObservationConstellation (org.n52.shetland.ogc.om.OmObservationConstellation)8 DecodingException (org.n52.svalbard.decode.exception.DecodingException)8 UnsupportedEncoderInputException (org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)8 Test (org.junit.Test)6 LineString (org.locationtech.jts.geom.LineString)6 CodeWithAuthority (org.n52.shetland.ogc.gml.CodeWithAuthority)6 EncodingException (org.n52.svalbard.encode.exception.EncodingException)6 FeaturePropertyType (net.opengis.gml.x32.FeaturePropertyType)4 CodeType (org.n52.shetland.ogc.gml.CodeType)4 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)4 SosProcedureDescription (org.n52.shetland.ogc.sos.SosProcedureDescription)4 DateTime (org.joda.time.DateTime)3 Time (org.n52.shetland.ogc.gml.time.Time)3