use of net.opengis.filter.v_1_1_0.SpatialOperatorType 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.filter.v_1_1_0.SpatialOperatorType in project ddf by codice.
the class WfsFilterDelegate method setSpatialOps.
public void setSpatialOps(SpatialOperatorsType spatialOperators) {
spatialOps = new ConcurrentHashMap<SPATIAL_OPERATORS, SpatialOperatorType>(new EnumMap<SPATIAL_OPERATORS, SpatialOperatorType>(SPATIAL_OPERATORS.class));
for (SpatialOperatorType spatialOp : spatialOperators.getSpatialOperator()) {
LOGGER.debug("Adding key [spatialOp Name: {}]", spatialOp.getName());
spatialOps.put(SPATIAL_OPERATORS.valueOf(spatialOp.getName()), spatialOp);
LOGGER.debug("spatialOps Map: {}", spatialOps.toString());
}
}
use of net.opengis.filter.v_1_1_0.SpatialOperatorType in project ddf by codice.
the class TestCswEndpoint method verifyFilterCapabilities.
/**
* Helper method to verify the FilterCapabilities section matches the endpoint's definition
*
* @param ct The CapabilitiesType to verify
*/
private void verifyFilterCapabilities(CapabilitiesType ct) {
FilterCapabilities fc = ct.getFilterCapabilities();
assertThat(fc.getIdCapabilities(), notNullValue());
assertThat(fc.getIdCapabilities().getEIDOrFID(), hasSize(1));
assertThat(fc.getScalarCapabilities(), notNullValue());
assertThat(CswEndpoint.COMPARISON_OPERATORS, hasSize(fc.getScalarCapabilities().getComparisonOperators().getComparisonOperator().size()));
for (ComparisonOperatorType cot : CswEndpoint.COMPARISON_OPERATORS) {
assertThat(fc.getScalarCapabilities().getComparisonOperators().getComparisonOperator(), hasItem(cot));
}
assertThat(fc.getSpatialCapabilities(), notNullValue());
assertThat(CswEndpoint.SPATIAL_OPERATORS, hasSize(fc.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().size()));
for (SpatialOperatorType sot : fc.getSpatialCapabilities().getSpatialOperators().getSpatialOperator()) {
assertThat(CswEndpoint.SPATIAL_OPERATORS, hasItem(sot.getName()));
}
}
use of net.opengis.filter.v_1_1_0.SpatialOperatorType in project ddf by codice.
the class TestCswFilterDelegate method getMockFilterCapabilitiesForSpatialFallback.
private FilterCapabilities getMockFilterCapabilitiesForSpatialFallback(List<SpatialOperatorNameType> spatialOperatorNameTypes, List<String> geometries) {
FilterCapabilities mockFilterCapabilities = mock(FilterCapabilities.class);
ComparisonOperatorsType mockComparisonOps = mock(ComparisonOperatorsType.class);
when(mockComparisonOps.getComparisonOperator()).thenReturn(getFullComparisonOpsList());
List<SpatialOperatorType> spatialOperatorList = new ArrayList<>();
for (SpatialOperatorNameType spatialOperatorNameType : spatialOperatorNameTypes) {
SpatialOperatorType spatialOperatorType = new SpatialOperatorType();
spatialOperatorType.setName(spatialOperatorNameType);
spatialOperatorList.add(spatialOperatorType);
}
SpatialOperatorsType mockSpatialOperatorsType = mock(SpatialOperatorsType.class);
when(mockSpatialOperatorsType.getSpatialOperator()).thenReturn(spatialOperatorList);
SpatialCapabilitiesType mockSpatialCapabilities = getSpatialCapabilities(geometries);
when(mockSpatialCapabilities.getSpatialOperators()).thenReturn(mockSpatialOperatorsType);
ScalarCapabilitiesType mockScalarCapabilities = mock(ScalarCapabilitiesType.class);
when(mockScalarCapabilities.getComparisonOperators()).thenReturn(mockComparisonOps);
when(mockFilterCapabilities.getScalarCapabilities()).thenReturn(mockScalarCapabilities);
when(mockFilterCapabilities.getSpatialCapabilities()).thenReturn(mockSpatialCapabilities);
when(mockScalarCapabilities.getLogicalOperators()).thenReturn(mock(LogicalOperators.class));
return mockFilterCapabilities;
}
use of net.opengis.filter.v_1_1_0.SpatialOperatorType 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;
}
Aggregations