Search in sources :

Example 1 with ReferenceType

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

the class ParameterHolder method addSpatialFilteringProfileParameter.

/**
 * Add sampling geometry to observation
 *
 * @param samplingGeometry The sampling geometry to set
 *
 * @return this
 */
public ParameterHolder addSpatialFilteringProfileParameter(Geometry samplingGeometry) {
    final NamedValue<Geometry> namedValue = new NamedValue<>();
    namedValue.setName(new ReferenceType(OmConstants.PARAM_NAME_SAMPLING_GEOMETRY));
    namedValue.setValue(new GeometryValue(samplingGeometry));
    addParameter(namedValue);
    return this;
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) GeometryValue(org.n52.shetland.ogc.om.values.GeometryValue) ReferenceType(org.n52.shetland.ogc.gml.ReferenceType)

Example 2 with ReferenceType

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

the class OmObservationTest method should_have_SpatialFilteringProfileParameter.

@Test
public final void should_have_SpatialFilteringProfileParameter() throws OwsExceptionReport, DecodingException {
    OmObservation omObservation = new OmObservation();
    NamedValue<Geometry> namedValue = new NamedValue<>();
    namedValue.setName(new ReferenceType(OmConstants.PARAM_NAME_SAMPLING_GEOMETRY));
    GeometryFactory fac = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), 4326);
    namedValue.setValue(new GeometryValue(fac.createPoint(new Coordinate(34.5, 76.4))));
    // test no parameter is set
    assertFalse(omObservation.isSetParameter());
    assertFalse(omObservation.isSetSpatialFilteringProfileParameter());
    omObservation.addParameter(namedValue);
    // test with set SpatialFilteringProfile parameter
    assertTrue(omObservation.isSetParameter());
    assertTrue(omObservation.isSetSpatialFilteringProfileParameter());
    assertThat(omObservation.getSpatialFilteringProfileParameter(), is(equalTo(namedValue)));
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) GeometryValue(org.n52.shetland.ogc.om.values.GeometryValue) GeometryFactory(org.locationtech.jts.geom.GeometryFactory) Coordinate(org.locationtech.jts.geom.Coordinate) PrecisionModel(org.locationtech.jts.geom.PrecisionModel) ReferenceType(org.n52.shetland.ogc.gml.ReferenceType) Test(org.junit.Test)

Example 3 with ReferenceType

use of org.n52.shetland.ogc.gml.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 4 with ReferenceType

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

the class ObservationEncoder method encodeReferenceValue.

private JsonNode encodeReferenceValue(ReferenceValue value) {
    ReferenceType ref = value.getValue();
    ObjectNode node = nodeFactory().objectNode();
    node.put(JSONConstants.HREF, ref.getHref());
    if (ref.isSetRole()) {
        node.put(JSONConstants.ROLE, ref.getRole());
    }
    if (ref.isSetTitle()) {
        node.put(JSONConstants.TITLE, ref.getTitle());
    }
    return node;
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ReferenceType(org.n52.shetland.ogc.gml.ReferenceType)

Example 5 with ReferenceType

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

the class SpecimenDecoderv20 method parseSpatialSamplingFeature.

private AbstractFeature parseSpatialSamplingFeature(final SFSpecimenType sfst) throws DecodingException {
    final SfSpecimen specimen = new SfSpecimen(null, sfst.getId());
    // parse identifier, names, description
    parseAbstractFeatureType(sfst, specimen);
    specimen.setSampledFeatures(getSampledFeatures(sfst.getSampledFeatureArray()));
    specimen.setXml(getXmlDescription(sfst));
    if (sfst.getParameterArray() != null) {
        specimen.setParameters(parseNamedValueTypeArray(sfst.getParameterArray()));
    }
    // TODO
    sfst.getMaterialClass();
    specimen.setMaterialClass((ReferenceType) decodeXmlElement(sfst.getMaterialClass()));
    specimen.setSamplingTime(getSamplingTime(sfst));
    // samplingLocation
    if (sfst.isSetSamplingLocation()) {
        specimen.setSamplingLocation(getGeometry(sfst));
    }
    // sfst.getProcessingDetailsArray();
    if (sfst.isSetSize()) {
        specimen.setSize(getSize(sfst.getSize()));
    }
    // }
    if (sfst.isSetSpecimenType()) {
        specimen.setSpecimenType((ReferenceType) decodeXmlElement(sfst.getSpecimenType()));
    }
    return specimen;
}
Also used : SfSpecimen(org.n52.shetland.ogc.om.features.samplingFeatures.SfSpecimen)

Aggregations

ReferenceType (org.n52.shetland.ogc.gml.ReferenceType)11 Geometry (org.locationtech.jts.geom.Geometry)4 GeometryValue (org.n52.shetland.ogc.om.values.GeometryValue)4 XmlObject (org.apache.xmlbeans.XmlObject)3 Test (org.junit.Test)3 TimePeriod (org.n52.shetland.ogc.gml.time.TimePeriod)3 DataAvailability (org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse.DataAvailability)3 ReferenceType (net.opengis.gml.x32.ReferenceType)2 NamedValue (org.n52.shetland.ogc.om.NamedValue)2 SingleObservationValue (org.n52.shetland.ogc.om.SingleObservationValue)2 ReferenceValue (org.n52.shetland.ogc.om.values.ReferenceValue)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 NamedValueType (net.opengis.om.x20.NamedValueType)1 DataAvailabilityMemberType (net.opengis.sosgda.x10.DataAvailabilityMemberType)1 DefaultTVPMeasurementMetadataDocument (net.opengis.waterml.x20.DefaultTVPMeasurementMetadataDocument)1 TVPDefaultMetadataPropertyType (net.opengis.waterml.x20.TVPDefaultMetadataPropertyType)1 XmlBoolean (org.apache.xmlbeans.XmlBoolean)1 XmlException (org.apache.xmlbeans.XmlException)1 XmlInteger (org.apache.xmlbeans.XmlInteger)1