use of net.opengis.swes.x20.InsertSensorType.RelatedFeature in project arctic-sea by 52North.
the class SwesDecoderv20 method parseRelatedFeature.
private List<SwesFeatureRelationship> parseRelatedFeature(final RelatedFeature[] relatedFeatureArray) throws DecodingException {
List<SwesFeatureRelationship> sosRelatedFeatures = new ArrayList<>(relatedFeatureArray.length);
for (final RelatedFeature relatedFeature : relatedFeatureArray) {
final SwesFeatureRelationship sosFeatureRelationship = new SwesFeatureRelationship();
final FeaturePropertyType fpt = relatedFeature.getFeatureRelationship().getTarget();
if (fpt.getHref() != null && !fpt.getHref().isEmpty()) {
final String identifier = fpt.getHref();
final AbstractSamplingFeature feature = new SamplingFeature(new CodeWithAuthority(identifier));
if (fpt.getTitle() != null && !fpt.getTitle().isEmpty()) {
feature.setName(Lists.newArrayList(new CodeType(fpt.getTitle())));
}
if (checkForRequestUrl(fpt.getHref())) {
feature.setUrl(fpt.getHref());
}
feature.setFeatureType(OGCConstants.UNKNOWN);
sosFeatureRelationship.setFeature(feature);
} else {
final Object decodedObject = decodeXmlElement(fpt);
if (decodedObject instanceof AbstractSamplingFeature) {
sosFeatureRelationship.setFeature((AbstractSamplingFeature) decodedObject);
} else {
throw new DecoderResponseUnsupportedException(fpt.xmlText(), decodedObject);
}
}
sosFeatureRelationship.setRole(relatedFeature.getFeatureRelationship().getRole());
sosRelatedFeatures.add(sosFeatureRelationship);
}
return sosRelatedFeatures;
}
use of net.opengis.swes.x20.InsertSensorType.RelatedFeature in project arctic-sea by 52North.
the class CapabilitiesTypeDecoder method parseRelatedFeatures.
private Map<String, Set<String>> parseRelatedFeatures(ObservationOfferingType obsOff) {
HashMap<String, Set<String>> map = new HashMap<>(obsOff.getRelatedFeatureArray().length);
for (RelatedFeature releatedFeature : obsOff.getRelatedFeatureArray()) {
String feature = releatedFeature.getFeatureRelationship().getTarget().getHref();
String role = releatedFeature.getFeatureRelationship().getRole();
Set<String> roles = map.computeIfAbsent(feature, key -> new HashSet<>(1));
if (role != null) {
roles.add(role);
}
}
return map;
}
Aggregations