use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class TextObservationDecodingTest method testObservation.
@Test
public void testObservation() {
assertThat(observation, is(notNullValue()));
final String type = observation.getObservationConstellation().getObservationType();
assertThat(type, is(equalTo(OmConstants.OBS_TYPE_TEXT_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(TextValue.class)));
TextValue v = (TextValue) value.getValue();
assertThat(v.getValue(), is(equalTo("Some Value")));
assertThat(v.getUnit(), is(nullValue()));
}
use of org.n52.shetland.ogc.om.values.Value 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/")));
}
use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class GeometryObservationDecodingTest method testObservation.
@Test
public void testObservation() {
assertThat(observation, is(notNullValue()));
final String type = observation.getObservationConstellation().getObservationType();
assertThat(type, is(equalTo(OmConstants.OBS_TYPE_GEOMETRY_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(GeometryValue.class)));
GeometryValue v = (GeometryValue) value.getValue();
assertThat(v.getUnit(), is(nullValue()));
Geometry g = v.getValue();
assertThat(g, is(instanceOf(LineString.class)));
assertThat(g.getSRID(), is(2000));
assertThat(g.getNumPoints(), is(2));
assertThat(g.getCoordinates()[0], is(equalTo(new Coordinate(52, 7))));
assertThat(g.getCoordinates()[1], is(equalTo(new Coordinate(51, 7))));
}
use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class SweCommonDecoderV101 method parseCountRange.
private SweCountRange parseCountRange(CountRange xbCountRange) throws DecodingException {
SweCountRange sosCountRange = new SweCountRange();
// }
if (xbCountRange.getQualityArray() != null) {
sosCountRange.setQuality(parseQuality(xbCountRange.getQualityArray()));
}
// }
if (xbCountRange.isSetDefinition()) {
sosCountRange.setDefinition(xbCountRange.getDefinition());
}
if (xbCountRange.isSetDescription()) {
sosCountRange.setDescription(xbCountRange.getDescription().getStringValue());
}
if (xbCountRange.isSetValue()) {
List<?> value = xbCountRange.getValue();
Integer rangeStart = Integer.parseInt(value.get(0).toString());
Integer rangeEnd = Integer.parseInt(value.get(1).toString());
sosCountRange.setValue(new RangeValue<>(rangeStart, rangeEnd));
}
return sosCountRange;
}
use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class SweCommonDecoderV101 method parseEnvelope.
private SweAbstractDataComponent parseEnvelope(EnvelopeType envelopeType) throws DecodingException {
String referenceFrame = null;
SweVector lowerCorner = null;
SweVector upperCorner = null;
SweTimeRange time = null;
if (envelopeType.isSetReferenceFrame()) {
referenceFrame = envelopeType.getReferenceFrame();
}
if (envelopeType.getLowerCorner() != null) {
lowerCorner = parseVectorProperty(envelopeType.getLowerCorner());
}
if (envelopeType.getUpperCorner() != null) {
upperCorner = parseVectorProperty(envelopeType.getUpperCorner());
}
if (envelopeType.isSetTime()) {
time = parseTimeRange(envelopeType.getTime().getTimeRange());
}
// FIXME get the northing first value for the reference frame
boolean northingFirst = false;
return new SweEnvelope(referenceFrame, upperCorner, lowerCorner, time, northingFirst);
}
Aggregations