Search in sources :

Example 1 with SPATIAL_OPERATORS

use of org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.common.Wfs20Constants.SPATIAL_OPERATORS in project ddf by codice.

the class TestWfsFilterDelegate method testBinarySpatialFilter.

private void testBinarySpatialFilter(Map<SPATIAL_OPERATORS, String> acceptedSpatialTypes, String delegateMethodName) throws Exception {
    List<SPATIAL_OPERATORS> failTypes = new ArrayList<>(Arrays.asList(SPATIAL_OPERATORS.values()));
    failTypes.removeAll(acceptedSpatialTypes.keySet());
    Method spatialOpMeth = WfsFilterDelegate.class.getMethod(delegateMethodName, String.class, String.class);
    for (Map.Entry<SPATIAL_OPERATORS, String> row : acceptedSpatialTypes.entrySet()) {
        WfsFilterDelegate delegate = setupFilterDelegate(row.getKey().toString());
        FilterType filter = (FilterType) spatialOpMeth.invoke(delegate, Metacard.ANY_GEO, POLYGON);
        assertThat(filter.getSpatialOps().getValue(), instanceOf(BinarySpatialOpType.class));
        assertFalse(filter.isSetLogicOps());
        assertXMLEqual(row.getValue(), getXmlFromMarshaller(filter));
    }
    for (SPATIAL_OPERATORS failType : failTypes) {
        testUnsupportedFilterType(spatialOpMeth, failType);
    }
}
Also used : SPATIAL_OPERATORS(org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.common.Wfs20Constants.SPATIAL_OPERATORS) FilterType(net.opengis.filter.v_2_0_0.FilterType) ArrayList(java.util.ArrayList) BinarySpatialOpType(net.opengis.filter.v_2_0_0.BinarySpatialOpType) Method(java.lang.reflect.Method) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap)

Example 2 with SPATIAL_OPERATORS

use of org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.common.Wfs20Constants.SPATIAL_OPERATORS 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());
    }
}
Also used : SPATIAL_OPERATORS(org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.common.Wfs20Constants.SPATIAL_OPERATORS) SpatialOperatorType(net.opengis.filter.v_2_0_0.SpatialOperatorType) EnumMap(java.util.EnumMap)

Example 3 with SPATIAL_OPERATORS

use of org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.common.Wfs20Constants.SPATIAL_OPERATORS 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;
}
Also used : SpatialCapabilitiesType(net.opengis.filter.v_2_0_0.SpatialCapabilitiesType) FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) DomainType(net.opengis.ows.v_1_1_0.DomainType) SpatialOperatorsType(net.opengis.filter.v_2_0_0.SpatialOperatorsType) GeometryOperandsType(net.opengis.filter.v_2_0_0.GeometryOperandsType) TemporalOperatorsType(net.opengis.filter.v_2_0_0.TemporalOperatorsType) NoValues(net.opengis.ows.v_1_1_0.NoValues) ComparisonOperatorType(net.opengis.filter.v_2_0_0.ComparisonOperatorType) TemporalOperand(net.opengis.filter.v_2_0_0.TemporalOperandsType.TemporalOperand) ConformanceType(net.opengis.filter.v_2_0_0.ConformanceType) COMPARISON_OPERATORS(org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.common.Wfs20Constants.COMPARISON_OPERATORS) TemporalCapabilitiesType(net.opengis.filter.v_2_0_0.TemporalCapabilitiesType) SPATIAL_OPERATORS(org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.common.Wfs20Constants.SPATIAL_OPERATORS) ValueType(net.opengis.ows.v_1_1_0.ValueType) QName(javax.xml.namespace.QName) SpatialOperatorType(net.opengis.filter.v_2_0_0.SpatialOperatorType) TEMPORAL_OPERATORS(org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.common.Wfs20Constants.TEMPORAL_OPERATORS) LogicalOperators(net.opengis.filter.v_2_0_0.LogicalOperators) GeometryOperand(net.opengis.filter.v_2_0_0.GeometryOperandsType.GeometryOperand) CONFORMANCE_CONSTRAINTS(org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.common.Wfs20Constants.CONFORMANCE_CONSTRAINTS) ComparisonOperatorsType(net.opengis.filter.v_2_0_0.ComparisonOperatorsType) ScalarCapabilitiesType(net.opengis.filter.v_2_0_0.ScalarCapabilitiesType) TemporalOperatorType(net.opengis.filter.v_2_0_0.TemporalOperatorType) TemporalOperandsType(net.opengis.filter.v_2_0_0.TemporalOperandsType)

Aggregations

SPATIAL_OPERATORS (org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.common.Wfs20Constants.SPATIAL_OPERATORS)3 SpatialOperatorType (net.opengis.filter.v_2_0_0.SpatialOperatorType)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 EnumMap (java.util.EnumMap)1 Map (java.util.Map)1 QName (javax.xml.namespace.QName)1 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)1 ComparisonOperatorType (net.opengis.filter.v_2_0_0.ComparisonOperatorType)1 ComparisonOperatorsType (net.opengis.filter.v_2_0_0.ComparisonOperatorsType)1 ConformanceType (net.opengis.filter.v_2_0_0.ConformanceType)1 FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)1 FilterType (net.opengis.filter.v_2_0_0.FilterType)1 GeometryOperandsType (net.opengis.filter.v_2_0_0.GeometryOperandsType)1 GeometryOperand (net.opengis.filter.v_2_0_0.GeometryOperandsType.GeometryOperand)1 LogicalOperators (net.opengis.filter.v_2_0_0.LogicalOperators)1 ScalarCapabilitiesType (net.opengis.filter.v_2_0_0.ScalarCapabilitiesType)1 SpatialCapabilitiesType (net.opengis.filter.v_2_0_0.SpatialCapabilitiesType)1 SpatialOperatorsType (net.opengis.filter.v_2_0_0.SpatialOperatorsType)1