use of net.opengis.gml.v_3_2_1.EnvelopeType in project ddf by codice.
the class SlotTypeConverter method getEnvelope.
private Optional<EnvelopeType> getEnvelope(Map<String, Object> envelopeMap) {
Optional<EnvelopeType> optionalEnvelope = Optional.empty();
if (MapUtils.isEmpty(envelopeMap)) {
return optionalEnvelope;
}
optionalEnvelope = Optional.of(GML_FACTORY.createEnvelopeType());
String valueToPopulate = MapUtils.getString(envelopeMap, SRS_NAME);
if (StringUtils.isNotBlank(valueToPopulate)) {
optionalEnvelope.get().setSrsName(valueToPopulate);
}
String upperCorner = MapUtils.getString(envelopeMap, UPPER_CORNER);
String lowerCorner = MapUtils.getString(envelopeMap, LOWER_CORNER);
if (StringUtils.isNotBlank(upperCorner)) {
List<Double> values = Arrays.stream(StringUtils.split(upperCorner)).map(e -> new Double(e)).collect(Collectors.toList());
DirectPositionType directPosition = GML_FACTORY.createDirectPositionType();
directPosition.setValue(values);
optionalEnvelope.get().setUpperCorner(directPosition);
}
if (StringUtils.isNotBlank(lowerCorner)) {
List<Double> values = Arrays.stream(StringUtils.split(lowerCorner)).map(e -> new Double(e)).collect(Collectors.toList());
DirectPositionType directPosition = GML_FACTORY.createDirectPositionType();
directPosition.setValue(values);
optionalEnvelope.get().setLowerCorner(directPosition);
}
return optionalEnvelope;
}
use of net.opengis.gml.v_3_2_1.EnvelopeType in project ddf by codice.
the class SlotWebConverter method getSlotBoundsMap.
private Map<String, Object> getSlotBoundsMap(SlotType1 slot) {
Map<String, Object> map = new HashMap<>();
if (!slot.isSetValueList()) {
return map;
}
ValueListType valueList = (ValueListType) slot.getValueList().getValue();
for (AnyValueType anyValue : valueList.getAnyValue()) {
anyValue.getContent().stream().filter(content -> content instanceof JAXBElement).forEach(content -> {
JAXBElement jaxbElement = (JAXBElement) content;
if (jaxbElement.getValue() instanceof EnvelopeType) {
Map<String, Object> boundsMap = getBoundsMapFromEnvelopeType((EnvelopeType) jaxbElement.getValue());
if (MapUtils.isNotEmpty(boundsMap)) {
Map<String, Object> valueMap = new HashMap<>();
valueMap.put(ENVELOPE_KEY, boundsMap);
map.put(VALUE, valueMap);
}
}
});
}
return map;
}
Aggregations