Search in sources :

Example 21 with QuantityValue

use of org.n52.shetland.ogc.om.values.QuantityValue in project arctic-sea by 52North.

the class SweCommonDecoderV101Test method should_decode_Boolean_with_Quality_Quantity.

@Test
public void should_decode_Boolean_with_Quality_Quantity() throws DecodingException {
    final BooleanDocument xbBoolean = BooleanDocument.Factory.newInstance();
    final BigDecimal quantityValue = BigDecimal.valueOf(42.5);
    xbBoolean.addNewBoolean().addNewQuality().addNewQuantity().setValue(quantityValue.doubleValue());
    final Object decodedObject = new SweCommonDecoderV101().decode(xbBoolean);
    assertThat(decodedObject, is(instanceOf(SweBoolean.class)));
    final SweBoolean sweBoolean = (SweBoolean) decodedObject;
    assertThat(sweBoolean.isSetQuality(), is(true));
    assertThat(sweBoolean.getQuality().size(), is(1));
    assertThat(sweBoolean.getQuality().iterator().next(), is(instanceOf(SweQuantity.class)));
    assertThat(((SweQuantity) sweBoolean.getQuality().iterator().next()).getValue(), is(quantityValue));
}
Also used : BooleanDocument(net.opengis.swe.x101.BooleanDocument) BigDecimal(java.math.BigDecimal) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) Test(org.junit.Test)

Example 22 with QuantityValue

use of org.n52.shetland.ogc.om.values.QuantityValue in project arctic-sea by 52North.

the class GWGeologyLogCoveragePropertyEncoderTest method createQuantity.

private QuantityValue createQuantity(String definition, double value, String unit) {
    QuantityValue quantity = new QuantityValue(value, unit);
    quantity.setValue(value).setUom(unit).setDefinition(definition);
    return quantity;
}
Also used : QuantityValue(org.n52.shetland.ogc.om.values.QuantityValue)

Example 23 with QuantityValue

use of org.n52.shetland.ogc.om.values.QuantityValue in project arctic-sea by 52North.

the class TrajectoryObservationTypeEncoderTest method getQuantityObservation.

private OmObservation getQuantityObservation() throws EncodingException, ParseException, DecodingException, XmlException, IOException {
    MultiObservationValues<List<TimeLocationValueTriple>> multiObservationValues = new MultiObservationValues<List<TimeLocationValueTriple>>();
    TLVTValue tlvtValue = new TLVTValue();
    tlvtValue.addValue(getTimeLocationValueTriple(new QuantityValue(15.6, "C")));
    tlvtValue.addValue(getTimeLocationValueTriple(new QuantityValue(16.5, "C")));
    tlvtValue.addValue(getTimeLocationValueTriple(new QuantityValue(17.6, "C")));
    tlvtValue.addValue(getTimeLocationValueTriple(new QuantityValue(18.7, "C")));
    multiObservationValues.setValue(tlvtValue);
    OmObservation observation = createObservation();
    observation.setValue(multiObservationValues);
    return observation;
}
Also used : QuantityValue(org.n52.shetland.ogc.om.values.QuantityValue) OmObservation(org.n52.shetland.ogc.om.OmObservation) List(java.util.List) TLVTValue(org.n52.shetland.ogc.om.values.TLVTValue) MultiObservationValues(org.n52.shetland.ogc.om.MultiObservationValues) TimeLocationValueTriple(org.n52.shetland.ogc.om.TimeLocationValueTriple)

Example 24 with QuantityValue

use of org.n52.shetland.ogc.om.values.QuantityValue in project arctic-sea by 52North.

the class WmlTVPEncoderv20Test method initObjects.

@Before
public void initObjects() {
    encoder = new WmlTVPEncoderv20();
    MultiValue<List<TimeValuePair>> value = new TVPValue();
    String unit = "test-unit";
    value.setUnit(unit);
    TimeValuePair tvp1 = new TimeValuePair(new TimeInstant(new Date(UTC_TIMESTAMP)), new QuantityValue(52.1234567890));
    List<TimeValuePair> valueList = CollectionHelper.list(tvp1);
    value.setValue(valueList);
    mv = new MultiObservationValues<>();
    mv.setValue(value);
}
Also used : TVPValue(org.n52.shetland.ogc.om.values.TVPValue) QuantityValue(org.n52.shetland.ogc.om.values.QuantityValue) List(java.util.List) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant) Date(java.util.Date) TimeValuePair(org.n52.shetland.ogc.om.TimeValuePair) Before(org.junit.Before)

Example 25 with QuantityValue

use of org.n52.shetland.ogc.om.values.QuantityValue in project arctic-sea by 52North.

the class MeasurementDecodingTest method testValue.

@Test
public void testValue() {
    assertThat(observation, is(notNullValue()));
    final ObservationValue<?> ov = observation.getValue();
    assertThat(ov, is(notNullValue()));
    assertThat(ov.getValue(), is(instanceOf(QuantityValue.class)));
    QuantityValue qv = (QuantityValue) ov.getValue();
    assertThat(qv.getUnit(), is(equalTo("testunit1")));
    assertThat(qv.getValue(), is(equalTo(new BigDecimal("123123"))));
}
Also used : QuantityValue(org.n52.shetland.ogc.om.values.QuantityValue) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Aggregations

QuantityValue (org.n52.shetland.ogc.om.values.QuantityValue)21 QuantityValue (org.n52.io.response.dataset.quantity.QuantityValue)8 CountValue (org.n52.shetland.ogc.om.values.CountValue)7 CategoryValue (org.n52.shetland.ogc.om.values.CategoryValue)6 XmlObject (org.apache.xmlbeans.XmlObject)5 Test (org.junit.Test)5 BooleanValue (org.n52.shetland.ogc.om.values.BooleanValue)5 TextValue (org.n52.shetland.ogc.om.values.TextValue)5 QuantityData (org.n52.io.response.dataset.quantity.QuantityData)4 SingleObservationValue (org.n52.shetland.ogc.om.SingleObservationValue)4 GeometryValue (org.n52.shetland.ogc.om.values.GeometryValue)4 BigDecimal (java.math.BigDecimal)3 List (java.util.List)3 XmlBoolean (org.apache.xmlbeans.XmlBoolean)3 XmlInteger (org.apache.xmlbeans.XmlInteger)3 XmlString (org.apache.xmlbeans.XmlString)3 Geometry (org.locationtech.jts.geom.Geometry)3 SweBoolean (org.n52.shetland.ogc.swe.simpleType.SweBoolean)3 Coordinate (com.vividsolutions.jts.geom.Coordinate)2 ArrayList (java.util.ArrayList)2