use of org.geosdi.geoplatform.xml.gml.v311.EnvelopeType in project geo-platform by geosdi.
the class AreaSearchRequestFilter method createFilterAreaPredicate.
/**
* @param areaSearchType
* @param bBox
* @return {@link List<JAXBElement<?>}
*/
private List<JAXBElement<?>> createFilterAreaPredicate(AreaSearchType areaSearchType, BBox bBox) {
List<JAXBElement<?>> areaPredicate = new ArrayList(2);
BinarySpatialOpType binarySpatial = new BinarySpatialOpType();
PropertyNameType propertyNameType = new PropertyNameType();
propertyNameType.setContent(Arrays.<Object>asList(BOUNDING_BOX));
binarySpatial.setPropertyName(propertyNameType);
EnvelopeType envelope = this.createEnvelope(bBox);
binarySpatial.setEnvelope(gmlFactory.createEnvelope(envelope));
switch(areaSearchType) {
case ENCLOSES:
areaPredicate.add(filterFactory.createContains(binarySpatial));
break;
case IS:
areaPredicate.add(filterFactory.createEquals(binarySpatial));
break;
case OUTSIDE:
// Workaround for GeoNetwork bug: DISJOINT = NOT(INTERSECTS)
UnaryLogicOpType unary = new UnaryLogicOpType();
unary.setSpatialOps(filterFactory.createIntersects(binarySpatial));
areaPredicate.add(filterFactory.createNot(unary));
// areaPredicate.add(filterFactory.createDisjoint(binarySpatial));
break;
case OVERLAP:
areaPredicate.add(filterFactory.createIntersects(binarySpatial));
break;
}
return areaPredicate;
}
use of org.geosdi.geoplatform.xml.gml.v311.EnvelopeType in project geo-platform by geosdi.
the class WFSGetFeatureRequestV110 method createEnvelope.
/**
* @param bbox
* @return {@link EnvelopeType}
*/
private EnvelopeType createEnvelope(BBox bbox) {
EnvelopeType envelope = new EnvelopeType();
DirectPositionType lower = new DirectPositionType();
lower.setValue(asList(bbox.getMinX(), bbox.getMinY()));
envelope.setLowerCorner(lower);
DirectPositionType upper = new DirectPositionType();
upper.setValue(asList(bbox.getMaxX(), bbox.getMaxY()));
envelope.setUpperCorner(upper);
return envelope;
}
use of org.geosdi.geoplatform.xml.gml.v311.EnvelopeType in project geo-platform by geosdi.
the class QueryRestrictionsBuilderTest method createFilterType.
/**
* @return {@link FilterType}
*/
private FilterType createFilterType() {
FilterType filter = new FilterType();
BBox bbox = new BBox(14.131237640976908, 36.56356461583572, 15.821758881211283, 37.143760728459014);
BBOXType bBoxType = new BBOXType();
PropertyNameType propertyNameType = new PropertyNameType();
propertyNameType.setContent(Arrays.asList("the_geom"));
bBoxType.setPropertyName(propertyNameType);
EnvelopeType envelope = new EnvelopeType();
DirectPositionType lower = new DirectPositionType();
lower.setValue(asList(bbox.getMinX(), bbox.getMinY()));
envelope.setLowerCorner(lower);
DirectPositionType upper = new DirectPositionType();
upper.setValue(asList(bbox.getMaxX(), bbox.getMaxY()));
envelope.setUpperCorner(upper);
envelope.setSrsName("EPSG:4326");
bBoxType.setEnvelope(new ObjectFactory().createEnvelope(envelope));
filter.setSpatialOps(new org.geosdi.geoplatform.xml.filter.v110.ObjectFactory().createBBOX(bBoxType));
return filter;
}
use of org.geosdi.geoplatform.xml.gml.v311.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 org.geosdi.geoplatform.xml.gml.v311.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