use of org.n52.shetland.ogc.om.values.CvDiscretePointCoverage in project arctic-sea by 52North.
the class PointObservation method setValue.
@Override
public void setValue(ObservationValue<?> value) {
if (value instanceof StreamingValue<?>) {
super.setValue(value);
} else if (value.getValue() instanceof CvDiscretePointCoverage) {
super.setValue(value);
} else {
CvDiscretePointCoverage cvDiscretePointCoverage = new CvDiscretePointCoverage(getObservationID());
cvDiscretePointCoverage.setRangeType(new ReferenceType(getObservationConstellation().getObservablePropertyIdentifier()));
cvDiscretePointCoverage.setUnit(((AbstractObservationValue<?>) value).getUnit());
Geometry geometry = null;
String domainExtent = "";
if (isSetSpatialFilteringProfileParameter() && getSpatialFilteringProfileParameter().getValue() instanceof GeometryValue) {
GeometryValue geometryValue = (GeometryValue) getSpatialFilteringProfileParameter().getValue();
geometry = getSpatialFilteringProfileParameter().getValue().getValue();
domainExtent = geometryValue.getGmlId();
} else if (checkForFeatureGeometry(this)) {
geometry = getGeometryFromFeature(this);
domainExtent = getObservationConstellation().getFeatureOfInterest().getGmlId();
}
if (geometry != null) {
cvDiscretePointCoverage.setDomainExtent("#" + geometry.getGeometryType() + "_" + domainExtent);
Point point = null;
if (geometry instanceof Point) {
point = (Point) geometry;
} else {
point = geometry.getCentroid();
}
cvDiscretePointCoverage.setValue(new PointValuePair(point, value.getValue()));
}
super.setValue(new SingleObservationValue<>(value.getPhenomenonTime(), cvDiscretePointCoverage));
}
}
Aggregations