use of net.opengis.gml.v_3_1_1.EnvelopeType in project ddf by codice.
the class WfsFilterDelegate method buildBBoxType.
private JAXBElement<BBOXType> buildBBoxType(String propertyName, String wkt) {
BBOXType bboxType = new BBOXType();
bboxType.setPropertyName(createPropertyNameType(propertyName).getValue());
EnvelopeType envelopeType = gmlObjectFactory.createEnvelopeType();
Envelope envelope = createEnvelopeFromWkt(wkt);
List<Double> lowerCornerCoordinates = coordinateStrategy.lowerCorner(envelope);
List<Double> upperCornerCoordinates = coordinateStrategy.upperCorner(envelope);
DirectPositionType lowerCorner = new DirectPositionType();
lowerCorner.setValue(lowerCornerCoordinates);
envelopeType.setLowerCorner(lowerCorner);
DirectPositionType upperCorner = new DirectPositionType();
upperCorner.setValue(upperCornerCoordinates);
envelopeType.setUpperCorner(upperCorner);
bboxType.setEnvelope(gmlObjectFactory.createEnvelope(envelopeType));
return filterObjectFactory.createBBOX(bboxType);
}
use of net.opengis.gml.v_3_1_1.EnvelopeType in project ddf by codice.
the class WfsFilterDelegate method createEnvelope.
private JAXBElement<EnvelopeType> createEnvelope(Geometry geometry) {
EnvelopeType envelopeType = gml320ObjectFactory.createEnvelopeType();
envelopeType.setSrsName(GeospatialUtil.EPSG_4326_URN);
Envelope envelope = geometry.getEnvelopeInternal();
DirectPositionType lowerCorner = gml320ObjectFactory.createDirectPositionType();
lowerCorner.getValue().add(envelope.getMinX());
lowerCorner.getValue().add(envelope.getMinY());
envelopeType.setLowerCorner(lowerCorner);
DirectPositionType upperCorner = gml320ObjectFactory.createDirectPositionType();
upperCorner.getValue().add(envelope.getMaxX());
upperCorner.getValue().add(envelope.getMaxY());
envelopeType.setUpperCorner(upperCorner);
return gml320ObjectFactory.createEnvelope(envelopeType);
}
use of net.opengis.gml.v_3_1_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_1_1.EnvelopeType in project ddf by codice.
the class SlotTypeConverter method getWrsValueList.
private Optional<net.opengis.cat.wrs.v_1_0_2.ValueListType> getWrsValueList(Map<String, Object> map) {
Optional<net.opengis.cat.wrs.v_1_0_2.ValueListType> optionalValueList = Optional.empty();
if (MapUtils.isEmpty(map) || !map.containsKey(VALUE)) {
return optionalValueList;
}
Map<String, Object> valueMap = (Map<String, Object>) map.get(VALUE);
if (valueMap.containsKey(POINT_KEY)) {
Optional<PointType> optionalPoint = getPoint((Map<String, Object>) valueMap.get(POINT_KEY));
if (optionalPoint.isPresent()) {
AnyValueType anyValue = WRS_FACTORY.createAnyValueType();
anyValue.getContent().add(GML_FACTORY.createPoint(optionalPoint.get()));
net.opengis.cat.wrs.v_1_0_2.ValueListType valueList = WRS_FACTORY.createValueListType();
valueList.getAnyValue().add(anyValue);
if (!optionalValueList.isPresent()) {
optionalValueList = Optional.of(WRS_FACTORY.createValueListType());
}
optionalValueList.get().getAnyValue().add(anyValue);
}
} else if (valueMap.containsKey(ENVELOPE_KEY)) {
Optional<EnvelopeType> optionalEnvelope = getEnvelope((Map<String, Object>) valueMap.get(ENVELOPE_KEY));
if (optionalEnvelope.isPresent()) {
AnyValueType anyValue = WRS_FACTORY.createAnyValueType();
anyValue.getContent().add(GML_FACTORY.createEnvelope(optionalEnvelope.get()));
net.opengis.cat.wrs.v_1_0_2.ValueListType valueList = WRS_FACTORY.createValueListType();
valueList.getAnyValue().add(anyValue);
if (!optionalValueList.isPresent()) {
optionalValueList = Optional.of(WRS_FACTORY.createValueListType());
}
optionalValueList.get().getAnyValue().add(anyValue);
}
}
return optionalValueList;
}
use of net.opengis.gml.v_3_1_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