use of net.opengis.fes.x20.GeometryOperandsType in project ddf by codice.
the class MockWfsServer method getFilterCapabilities.
public static FilterCapabilities getFilterCapabilities() {
FilterCapabilities capabilities = new FilterCapabilities();
ConformanceType conformance = new ConformanceType();
for (CONFORMANCE_CONSTRAINTS constraint : CONFORMANCE_CONSTRAINTS.values()) {
DomainType domain = new DomainType();
NoValues noValues = new NoValues();
domain.setNoValues(noValues);
ValueType value = new ValueType();
value.setValue("TRUE");
domain.setDefaultValue(value);
domain.setName(constraint.toString());
conformance.getConstraint().add(domain);
}
capabilities.setConformance(conformance);
ScalarCapabilitiesType scalar = new ScalarCapabilitiesType();
scalar.setLogicalOperators(new LogicalOperators());
scalar.setComparisonOperators(new ComparisonOperatorsType());
for (COMPARISON_OPERATORS compOp : COMPARISON_OPERATORS.values()) {
ComparisonOperatorType operator = new ComparisonOperatorType();
operator.setName(compOp.toString());
scalar.getComparisonOperators().getComparisonOperator().add(operator);
}
capabilities.setScalarCapabilities(scalar);
SpatialCapabilitiesType spatial = new SpatialCapabilitiesType();
spatial.setSpatialOperators(new SpatialOperatorsType());
for (SPATIAL_OPERATORS spatialOp : SPATIAL_OPERATORS.values()) {
SpatialOperatorType operator = new SpatialOperatorType();
operator.setName(spatialOp.toString());
spatial.getSpatialOperators().getSpatialOperator().add(operator);
}
GeometryOperandsType geometryOperands = new GeometryOperandsType();
List<QName> qnames = Arrays.asList(Wfs20Constants.POINT, Wfs20Constants.ENVELOPE, Wfs20Constants.POLYGON, Wfs20Constants.LINESTRING);
for (QName qName : qnames) {
GeometryOperand operand = new GeometryOperand();
operand.setName(qName);
geometryOperands.getGeometryOperand().add(operand);
}
spatial.setGeometryOperands(geometryOperands);
capabilities.setSpatialCapabilities(spatial);
TemporalCapabilitiesType temporal = new TemporalCapabilitiesType();
temporal.setTemporalOperators(new TemporalOperatorsType());
for (TEMPORAL_OPERATORS temporalOp : TEMPORAL_OPERATORS.values()) {
TemporalOperatorType operator = new TemporalOperatorType();
operator.setName(temporalOp.toString());
temporal.getTemporalOperators().getTemporalOperator().add(operator);
}
TemporalOperandsType temporalOperands = new TemporalOperandsType();
List<QName> timeQNames = Arrays.asList(new QName(Wfs20Constants.GML_3_2_NAMESPACE, "TimePeriod"), new QName(Wfs20Constants.GML_3_2_NAMESPACE, "TimeInstant"));
for (QName qName : timeQNames) {
TemporalOperand operand = new TemporalOperand();
operand.setName(qName);
temporalOperands.getTemporalOperand().add(operand);
}
temporal.setTemporalOperands(temporalOperands);
capabilities.setTemporalCapabilities(temporal);
return capabilities;
}
use of net.opengis.fes.x20.GeometryOperandsType in project ddf by codice.
the class CswFilterDelegate method updateAllowedOperations.
/**
* Reads the {@link net.opengis.filter.v_1_1_0.FilterCapabilities} in order to determine what types of queries the server
* can handle.
*
* @param filterCapabilities The {@link net.opengis.filter.v_1_1_0.FilterCapabilities} understood by the Csw service
*/
private final void updateAllowedOperations(FilterCapabilities filterCapabilities) {
comparisonOps = Collections.newSetFromMap(new ConcurrentHashMap<>(new EnumMap<>(ComparisonOperatorType.class)));
spatialOps = new ConcurrentHashMap<>(new EnumMap<>(SpatialOperatorNameType.class));
logicalOps = true;
if (null == filterCapabilities) {
LOGGER.info("CSW Service doesn't support any filters");
return;
}
ScalarCapabilitiesType scalarCapabilities = filterCapabilities.getScalarCapabilities();
if (null != scalarCapabilities) {
ComparisonOperatorsType comparisonOperators = scalarCapabilities.getComparisonOperators();
if (null != comparisonOperators) {
// filter out nulls
for (ComparisonOperatorType comp : comparisonOperators.getComparisonOperator()) {
if (null != comp) {
comparisonOps.add(comp);
}
}
}
logicalOps = (null != scalarCapabilities.getLogicalOperators());
}
SpatialCapabilitiesType spatialCapabilities = filterCapabilities.getSpatialCapabilities();
if (null != spatialCapabilities && null != spatialCapabilities.getSpatialOperators()) {
setSpatialOps(spatialCapabilities.getSpatialOperators());
}
GeometryOperandsType geometryOperandsType = null;
if (spatialCapabilities != null) {
geometryOperandsType = spatialCapabilities.getGeometryOperands();
}
if (geometryOperandsType != null) {
globalGeometryOperands = geometryOperandsType.getGeometryOperand();
LOGGER.debug("globalGeometryOperands: {}", globalGeometryOperands);
}
}
use of net.opengis.fes.x20.GeometryOperandsType in project ddf by codice.
the class CswFilterDelegate method getGeometryOperands.
private List<QName> getGeometryOperands(SpatialOperatorNameType spatialOperatorName) {
SpatialOperatorType spatialOperatorType = spatialOps.get(spatialOperatorName);
List<QName> geometryOperands = new ArrayList<>();
if (spatialOperatorType != null) {
GeometryOperandsType geometryOperandsType = spatialOperatorType.getGeometryOperands();
if (geometryOperandsType != null) {
geometryOperands = geometryOperandsType.getGeometryOperand();
}
}
return geometryOperands;
}
use of net.opengis.fes.x20.GeometryOperandsType in project arctic-sea by 52North.
the class FesEncoderv20 method setSpatialFilterCapabilities.
/**
* Sets the SpatialFilterCapabilities.
*
* @param spatialCapabilitiesType FES SpatialCapabilities.
* @param sosFilterCaps SOS spatial filter information
*
* @throws EncodingException if the spatial operator is not supported
*/
private void setSpatialFilterCapabilities(final SpatialCapabilitiesType spatialCapabilitiesType, org.n52.shetland.ogc.filter.FilterCapabilities sosFilterCaps) throws EncodingException {
// set GeometryOperands
if (sosFilterCaps.getSpatialOperands() != null && !sosFilterCaps.getSpatialOperands().isEmpty()) {
GeometryOperandsType spatialOperands = spatialCapabilitiesType.addNewGeometryOperands();
sosFilterCaps.getSpatialOperands().forEach(operand -> spatialOperands.addNewGeometryOperand().setName(operand));
}
// set SpatialOperators
if (sosFilterCaps.getSpatialOperators() != null && !sosFilterCaps.getSpatialOperators().isEmpty()) {
SpatialOperatorsType spatialOps = spatialCapabilitiesType.addNewSpatialOperators();
Set<SpatialOperator> keys = sosFilterCaps.getSpatialOperators().keySet();
for (SpatialOperator spatialOperator : keys) {
SpatialOperatorType operator = spatialOps.addNewSpatialOperator();
operator.setName(getEnum4SpatialOperator(spatialOperator));
GeometryOperandsType geomOps = operator.addNewGeometryOperands();
sosFilterCaps.getSpatialOperators().get(spatialOperator).forEach(operand -> geomOps.addNewGeometryOperand().setName(operand));
}
}
}
Aggregations