Search in sources :

Example 6 with CategoryValue

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

the class SweCommonDecoderV101Test method should_decode_Quantity_with_Quality_Category.

@Test
public void should_decode_Quantity_with_Quality_Category() throws DecodingException {
    final QuantityDocument xbQuantity = QuantityDocument.Factory.newInstance();
    final String categoryValue = "quality-category";
    xbQuantity.addNewQuantity().addNewQuality().addNewCategory().setValue(categoryValue);
    final Object decodedObject = new SweCommonDecoderV101().decode(xbQuantity);
    assertThat(decodedObject, is(instanceOf(SweQuantity.class)));
    final SweQuantity sweQuantity = (SweQuantity) decodedObject;
    assertThat(sweQuantity.isSetQuality(), is(true));
    assertThat(sweQuantity.getQuality().size(), is(1));
    assertThat(sweQuantity.getQuality().iterator().next(), is(instanceOf(SweCategory.class)));
    assertThat(((SweCategory) sweQuantity.getQuality().iterator().next()).getValue(), is(categoryValue));
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) QuantityDocument(net.opengis.swe.x101.QuantityDocument) Test(org.junit.Test)

Example 7 with CategoryValue

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

the class SweCommonDecoderV101Test method should_decode_Category_with_Quality_QuantityRange.

@Test
public void should_decode_Category_with_Quality_QuantityRange() throws DecodingException {
    final CategoryDocument xbQuantity = CategoryDocument.Factory.newInstance();
    final BigDecimal rangeStart = BigDecimal.valueOf(1.0);
    final BigDecimal rangeEnd = BigDecimal.valueOf(2.0);
    final ArrayList<BigDecimal> categoryValue = Lists.newArrayList(rangeStart, rangeEnd);
    xbQuantity.addNewCategory().addNewQuality().addNewQuantityRange().setValue(categoryValue);
    final Object decodedObject = new SweCommonDecoderV101().decode(xbQuantity);
    assertThat(decodedObject, is(instanceOf(SweCategory.class)));
    final SweCategory sweCategory = (SweCategory) decodedObject;
    assertThat(sweCategory.isSetQuality(), is(true));
    assertThat(sweCategory.getQuality().size(), is(1));
    assertThat(sweCategory.getQuality().iterator().next(), is(instanceOf(SweQuantityRange.class)));
    assertThat(((SweQuantityRange) sweCategory.getQuality().iterator().next()).getValue(), is(new RangeValue<BigDecimal>(rangeStart, rangeEnd)));
}
Also used : CategoryDocument(net.opengis.swe.x101.CategoryDocument) SweCategory(org.n52.shetland.ogc.swe.simpleType.SweCategory) BigDecimal(java.math.BigDecimal) RangeValue(org.n52.shetland.ogc.swe.RangeValue) Test(org.junit.Test)

Example 8 with CategoryValue

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

the class GWGeologyLogCoveragePropertyEncoderTest method createProfileLevel.

private List<Value<?>> createProfileLevel() {
    List<Value<?>> list = Lists.newArrayList();
    CategoryValue category = new CategoryValue("weathered grey brown basalt", "unknown");
    category.setDefinition("http://www.opengis.net/def/gwml/2.0/observedProperty/earthMaterial");
    category.addName(new CodeType("lithology"));
    list.add(category);
    TextValue text = new TextValue("weathered grey brown basalt");
    text.setDefinition("http://www.opengis.net/def/gwml/2.0/observedProperty/earthMaterial");
    text.addName(new CodeType("text"));
    list.add(text);
    return list;
}
Also used : TextValue(org.n52.shetland.ogc.om.values.TextValue) ProfileValue(org.n52.shetland.ogc.om.values.ProfileValue) QuantityValue(org.n52.shetland.ogc.om.values.QuantityValue) TextValue(org.n52.shetland.ogc.om.values.TextValue) CategoryValue(org.n52.shetland.ogc.om.values.CategoryValue) Value(org.n52.shetland.ogc.om.values.Value) CategoryValue(org.n52.shetland.ogc.om.values.CategoryValue) CodeType(org.n52.shetland.ogc.gml.CodeType)

Example 9 with CategoryValue

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

the class ProfileValueTest method createProfileLevel.

private List<Value<?>> createProfileLevel() {
    List<Value<?>> list = Lists.newArrayList();
    CategoryValue category = new CategoryValue("weathered grey brown basalt", "unknown");
    category.setDefinition("http://www.opengis.net/def/gwml/2.0/observedProperty/earthMaterial");
    category.addName(new CodeType("lithology"));
    list.add(category);
    return list;
}
Also used : CategoryValue(org.n52.shetland.ogc.om.values.CategoryValue) ProfileValue(org.n52.shetland.ogc.om.values.ProfileValue) QuantityValue(org.n52.shetland.ogc.om.values.QuantityValue) Value(org.n52.shetland.ogc.om.values.Value) CategoryValue(org.n52.shetland.ogc.om.values.CategoryValue) CodeType(org.n52.shetland.ogc.gml.CodeType)

Example 10 with CategoryValue

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

the class CategoryObservationDecodingTest method testObservation.

@Test
public void testObservation() {
    assertThat(observation, is(notNullValue()));
    final String type = observation.getObservationConstellation().getObservationType();
    assertThat(type, is(equalTo(OmConstants.OBS_TYPE_CATEGORY_OBSERVATION)));
    final ObservationValue<?> value = observation.getValue();
    assertThat(value, is(instanceOf(SingleObservationValue.class)));
    assertThat(value.getPhenomenonTime(), is(instanceOf(TimeInstant.class)));
    TimeInstant pt = (TimeInstant) value.getPhenomenonTime();
    assertThat(pt.getValue(), is(equalTo(phenomenonTime)));
    assertThat(value.getValue(), is(instanceOf(CategoryValue.class)));
    CategoryValue v = (CategoryValue) value.getValue();
    assertThat(v.getValue(), is(equalTo("Some Value")));
    assertThat(v.getUnit(), is(equalTo("http://52north.org/")));
}
Also used : CategoryValue(org.n52.shetland.ogc.om.values.CategoryValue) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant) Test(org.junit.Test)

Aggregations

CategoryValue (org.n52.shetland.ogc.om.values.CategoryValue)13 QuantityValue (org.n52.shetland.ogc.om.values.QuantityValue)8 TextValue (org.n52.shetland.ogc.om.values.TextValue)6 BooleanValue (org.n52.shetland.ogc.om.values.BooleanValue)5 CountValue (org.n52.shetland.ogc.om.values.CountValue)5 GeometryValue (org.n52.shetland.ogc.om.values.GeometryValue)4 SweCategory (org.n52.shetland.ogc.swe.simpleType.SweCategory)4 XmlBoolean (org.apache.xmlbeans.XmlBoolean)3 XmlInteger (org.apache.xmlbeans.XmlInteger)3 XmlObject (org.apache.xmlbeans.XmlObject)3 XmlString (org.apache.xmlbeans.XmlString)3 Test (org.junit.Test)3 Geometry (org.locationtech.jts.geom.Geometry)3 SweQuantity (org.n52.shetland.ogc.swe.simpleType.SweQuantity)3 BigDecimal (java.math.BigDecimal)2 XmlException (org.apache.xmlbeans.XmlException)2 AbstractGeometry (org.n52.shetland.ogc.gml.AbstractGeometry)2 CodeType (org.n52.shetland.ogc.gml.CodeType)2 GmlMeasureType (org.n52.shetland.ogc.gml.GmlMeasureType)2 SingleObservationValue (org.n52.shetland.ogc.om.SingleObservationValue)2