Search in sources :

Example 1 with SpatialOperatorsType

use of net.opengis.fes.x20.SpatialOperatorsType in project ddf by codice.

the class CswEndpoint method buildFilterCapabilities.

/**
     * Creates the Filter_Capabilities section of the GetCapabilities response. These are defined
     * statically by the DDF FilterAdapter implementation TODO: If the implementation changes,
     * update this method to reflect the changes.
     *
     * @return The constructed FilterCapabilities object
     */
private FilterCapabilities buildFilterCapabilities() {
    // Create the FilterCapabilites - These are defined statically by the
    // DDF FilterAdapter implementation
    FilterCapabilities filterCapabilities = new FilterCapabilities();
    ScalarCapabilitiesType scalarCapabilities = new ScalarCapabilitiesType();
    ComparisonOperatorsType cot = new ComparisonOperatorsType();
    cot.setComparisonOperator(COMPARISON_OPERATORS);
    scalarCapabilities.setLogicalOperators(new LogicalOperators());
    scalarCapabilities.setComparisonOperators(cot);
    filterCapabilities.setScalarCapabilities(scalarCapabilities);
    SpatialOperatorsType spatialOpsType = new SpatialOperatorsType();
    ArrayList<SpatialOperatorType> spatialOpTypes = new ArrayList<>();
    for (SpatialOperatorNameType sont : SPATIAL_OPERATORS) {
        SpatialOperatorType sot = new SpatialOperatorType();
        sot.setName(sont);
        spatialOpTypes.add(sot);
    }
    GeometryOperandsType geometryOperands = new GeometryOperandsType();
    List<QName> geoOperandsList = geometryOperands.getGeometryOperand();
    geoOperandsList.add(new QName(CswConstants.GML_SCHEMA, CswConstants.GML_POINT, CswConstants.GML_NAMESPACE_PREFIX));
    geoOperandsList.add(new QName(CswConstants.GML_SCHEMA, CswConstants.GML_LINESTRING, CswConstants.GML_NAMESPACE_PREFIX));
    geoOperandsList.add(new QName(CswConstants.GML_SCHEMA, CswConstants.GML_POLYGON, CswConstants.GML_NAMESPACE_PREFIX));
    spatialOpsType.setSpatialOperator(spatialOpTypes);
    SpatialCapabilitiesType spatialCaps = new SpatialCapabilitiesType();
    spatialCaps.setSpatialOperators(spatialOpsType);
    spatialCaps.setGeometryOperands(geometryOperands);
    filterCapabilities.setSpatialCapabilities(spatialCaps);
    IdCapabilitiesType idCapabilities = new IdCapabilitiesType();
    idCapabilities.getEIDOrFID().add(new EID());
    filterCapabilities.setIdCapabilities(idCapabilities);
    return filterCapabilities;
}
Also used : EID(net.opengis.filter.v_1_1_0.EID) QName(javax.xml.namespace.QName) SpatialOperatorType(net.opengis.filter.v_1_1_0.SpatialOperatorType) LogicalOperators(net.opengis.filter.v_1_1_0.LogicalOperators) ArrayList(java.util.ArrayList) SpatialOperatorNameType(net.opengis.filter.v_1_1_0.SpatialOperatorNameType) SpatialCapabilitiesType(net.opengis.filter.v_1_1_0.SpatialCapabilitiesType) FilterCapabilities(net.opengis.filter.v_1_1_0.FilterCapabilities) IdCapabilitiesType(net.opengis.filter.v_1_1_0.IdCapabilitiesType) ComparisonOperatorsType(net.opengis.filter.v_1_1_0.ComparisonOperatorsType) ScalarCapabilitiesType(net.opengis.filter.v_1_1_0.ScalarCapabilitiesType) SpatialOperatorsType(net.opengis.filter.v_1_1_0.SpatialOperatorsType) GeometryOperandsType(net.opengis.filter.v_1_1_0.GeometryOperandsType)

Example 2 with SpatialOperatorsType

use of net.opengis.fes.x20.SpatialOperatorsType in project ddf by codice.

the class WfsSource method updateSupportedSpatialOperators.

private void updateSupportedSpatialOperators(SpatialOperatorsType spatialOperatorsType) {
    if (spatialOperatorsType == null) {
        return;
    }
    supportedSpatialOperators = spatialOperatorsType;
    if (NO_FORCED_SPATIAL_FILTER.equals(forceSpatialFilter)) {
        return;
    }
    SpatialOperatorsType forcedSpatialOpType = new SpatialOperatorsType();
    SpatialOperatorType sot = new SpatialOperatorType();
    sot.setName(forceSpatialFilter);
    forcedSpatialOpType.getSpatialOperator().add(sot);
    for (WfsFilterDelegate delegate : featureTypeFilters.values()) {
        delegate.setSpatialOps(forcedSpatialOpType);
    }
}
Also used : SpatialOperatorsType(net.opengis.filter.v_2_0_0.SpatialOperatorsType) SpatialOperatorType(net.opengis.filter.v_2_0_0.SpatialOperatorType)

Example 3 with SpatialOperatorsType

use of net.opengis.fes.x20.SpatialOperatorsType in project ddf by codice.

the class AbstractCswSource method readGetRecordsOperation.

/**
     * Parses the getRecords {@link Operation} to understand the capabilities of the org.codice.ddf.spatial.ogc.csw.catalog.common.Csw Server. A
     * sample GetRecords Operation may look like this:
     * <p>
     * <pre>
     *   <ows:Operation name="GetRecords">
     *     <ows:DCP>
     *       <ows:HTTP>
     *         <ows:Get  xlink:href="http://www.cubewerx.com/cwcsw.cgi?" />
     *         <ows:Post xlink:href="http://www.cubewerx.com/cwcsw.cgi" />
     *       </ows:HTTP>
     *     </ows:DCP>
     *     <ows:Parameter name="TypeName">
     *       <ows:Value>csw:Record</ows:Value>
     *     </ows:Parameter>
     *     <ows:Parameter name="outputFormat">
     *       <ows:Value>application/xml</ows:Value>
     *       <ows:Value>text/html</ows:Value>
     *       <ows:Value>text/plain</ows:Value>
     *     </ows:Parameter>
     *     <ows:Parameter name="outputSchema">
     *       <ows:Value>http://www.opengis.net/cat/csw/2.0.2</ows:Value>
     *     </ows:Parameter>
     *     <ows:Parameter name="resultType">
     *       <ows:Value>hits</ows:Value>
     *       <ows:Value>results</ows:Value>
     *       <ows:Value>validate</ows:Value>
     *     </ows:Parameter>
     *     <ows:Parameter name="ElementSetName">
     *       <ows:Value>brief</ows:Value>
     *       <ows:Value>summary</ows:Value>
     *       <ows:Value>full</ows:Value>
     *     </ows:Parameter>
     *     <ows:Parameter name="CONSTRAINTLANGUAGE">
     *       <ows:Value>Filter</ows:Value>
     *     </ows:Parameter>
     *   </ows:Operation>
     * </pre>
     *
     * @param capabilitiesType The capabilities the org.codice.ddf.spatial.ogc.csw.catalog.common.Csw Server supports
     */
private void readGetRecordsOperation(CapabilitiesType capabilitiesType) {
    OperationsMetadata operationsMetadata = capabilitiesType.getOperationsMetadata();
    if (null == operationsMetadata) {
        LOGGER.info("{}: CSW Source contains no operations", cswSourceConfiguration.getId());
        return;
    }
    description = capabilitiesType.getServiceIdentification().getAbstract();
    Operation getRecordsOp = getOperation(operationsMetadata, CswConstants.GET_RECORDS);
    if (null == getRecordsOp) {
        LOGGER.info("{}: CSW Source contains no getRecords Operation", cswSourceConfiguration.getId());
        return;
    }
    this.supportedOutputSchemas = getParameter(getRecordsOp, CswConstants.OUTPUT_SCHEMA_PARAMETER);
    DomainType constraintLanguage = getParameter(getRecordsOp, CswConstants.CONSTRAINT_LANGUAGE_PARAMETER);
    if (null != constraintLanguage) {
        DomainType outputFormatValues = getParameter(getRecordsOp, CswConstants.OUTPUT_FORMAT_PARAMETER);
        DomainType resultTypesValues = getParameter(getRecordsOp, CswConstants.RESULT_TYPE_PARAMETER);
        readSetDetailLevels(getParameter(getRecordsOp, CswConstants.ELEMENT_SET_NAME_PARAMETER));
        List<String> constraints = new ArrayList<>();
        for (String s : constraintLanguage.getValue()) {
            constraints.add(s.toLowerCase());
        }
        if (constraints.contains(CswConstants.CONSTRAINT_LANGUAGE_CQL.toLowerCase()) && !constraints.contains(CswConstants.CONSTRAINT_LANGUAGE_FILTER.toLowerCase())) {
            isConstraintCql = true;
        } else {
            isConstraintCql = false;
        }
        setFilterDelegate(getRecordsOp, capabilitiesType.getFilterCapabilities(), outputFormatValues, resultTypesValues, cswSourceConfiguration);
        spatialCapabilities = capabilitiesType.getFilterCapabilities().getSpatialCapabilities();
        if (!NO_FORCE_SPATIAL_FILTER.equals(forceSpatialFilter)) {
            SpatialOperatorType sot = new SpatialOperatorType();
            SpatialOperatorNameType sont = SpatialOperatorNameType.fromValue(forceSpatialFilter);
            sot.setName(sont);
            sot.setGeometryOperands(cswFilterDelegate.getGeoOpsForSpatialOp(sont));
            SpatialOperatorsType spatialOperators = new SpatialOperatorsType();
            spatialOperators.setSpatialOperator(Arrays.asList(sot));
            cswFilterDelegate.setSpatialOps(spatialOperators);
        }
    }
}
Also used : OperationsMetadata(net.opengis.ows.v_1_0_0.OperationsMetadata) DomainType(net.opengis.ows.v_1_0_0.DomainType) SpatialOperatorsType(net.opengis.filter.v_1_1_0.SpatialOperatorsType) SpatialOperatorType(net.opengis.filter.v_1_1_0.SpatialOperatorType) ArrayList(java.util.ArrayList) Operation(net.opengis.ows.v_1_0_0.Operation) SpatialOperatorNameType(net.opengis.filter.v_1_1_0.SpatialOperatorNameType)

Example 4 with SpatialOperatorsType

use of net.opengis.fes.x20.SpatialOperatorsType 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;
}
Also used : FilterCapabilities(net.opengis.filter.v_1_1_0.FilterCapabilities) ComparisonOperatorsType(net.opengis.filter.v_1_1_0.ComparisonOperatorsType) ScalarCapabilitiesType(net.opengis.filter.v_1_1_0.ScalarCapabilitiesType) SpatialOperatorsType(net.opengis.filter.v_1_1_0.SpatialOperatorsType) SpatialOperatorType(net.opengis.filter.v_1_1_0.SpatialOperatorType) ArrayList(java.util.ArrayList) LogicalOperators(net.opengis.filter.v_1_1_0.LogicalOperators) SpatialOperatorNameType(net.opengis.filter.v_1_1_0.SpatialOperatorNameType) SpatialCapabilitiesType(net.opengis.filter.v_1_1_0.SpatialCapabilitiesType)

Example 5 with SpatialOperatorsType

use of net.opengis.fes.x20.SpatialOperatorsType in project ddf by codice.

the class TestCswFilterDelegate method getMockFilterCapabilities.

private static FilterCapabilities getMockFilterCapabilities() {
    FilterCapabilities mockFilterCapabilities = mock(FilterCapabilities.class);
    ComparisonOperatorsType mockComparisonOps = mock(ComparisonOperatorsType.class);
    when(mockComparisonOps.getComparisonOperator()).thenReturn(getFullComparisonOpsList());
    SpatialOperatorsType mockSpatialOperatorsType = mock(SpatialOperatorsType.class);
    when(mockSpatialOperatorsType.getSpatialOperator()).thenReturn(getSpatialOperatorsList());
    SpatialCapabilitiesType mockSpatialCapabilities = getAllSpatialCapabilities();
    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;
}
Also used : FilterCapabilities(net.opengis.filter.v_1_1_0.FilterCapabilities) ComparisonOperatorsType(net.opengis.filter.v_1_1_0.ComparisonOperatorsType) ScalarCapabilitiesType(net.opengis.filter.v_1_1_0.ScalarCapabilitiesType) SpatialOperatorsType(net.opengis.filter.v_1_1_0.SpatialOperatorsType) LogicalOperators(net.opengis.filter.v_1_1_0.LogicalOperators) SpatialCapabilitiesType(net.opengis.filter.v_1_1_0.SpatialCapabilitiesType)

Aggregations

SpatialOperatorsType (net.opengis.filter.v_1_1_0.SpatialOperatorsType)5 ArrayList (java.util.ArrayList)4 ComparisonOperatorsType (net.opengis.filter.v_1_1_0.ComparisonOperatorsType)4 FilterCapabilities (net.opengis.filter.v_1_1_0.FilterCapabilities)4 LogicalOperators (net.opengis.filter.v_1_1_0.LogicalOperators)4 ScalarCapabilitiesType (net.opengis.filter.v_1_1_0.ScalarCapabilitiesType)4 SpatialCapabilitiesType (net.opengis.filter.v_1_1_0.SpatialCapabilitiesType)4 QName (javax.xml.namespace.QName)3 SpatialOperatorNameType (net.opengis.filter.v_1_1_0.SpatialOperatorNameType)3 SpatialOperatorType (net.opengis.filter.v_1_1_0.SpatialOperatorType)3 SpatialOperatorType (net.opengis.filter.v_2_0_0.SpatialOperatorType)2 SpatialOperatorsType (net.opengis.filter.v_2_0_0.SpatialOperatorsType)2 Metacard (ddf.catalog.data.Metacard)1 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)1 GeotoolsFilterAdapterImpl (ddf.catalog.filter.proxy.adapter.GeotoolsFilterAdapterImpl)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 BigInteger (java.math.BigInteger)1 List (java.util.List)1 StreamSource (javax.xml.transform.stream.StreamSource)1 GeometryOperandsType (net.opengis.fes.x20.GeometryOperandsType)1