use of net.opengis.fes.x20.SpatialOperatorType in project ddf by codice.
the class CswFilterDelegate method setSpatialOps.
public void setSpatialOps(SpatialOperatorsType spatialOperators) {
spatialOps = new ConcurrentHashMap<>(new EnumMap<>(SpatialOperatorNameType.class));
for (SpatialOperatorType spatialOp : spatialOperators.getSpatialOperator()) {
LOGGER.debug("Adding key [spatialOp Name: {}]", spatialOp.getName());
spatialOps.put(spatialOp.getName(), spatialOp);
LOGGER.debug("spatialOps Map: {}", spatialOps.toString());
}
}
use of net.opengis.fes.x20.SpatialOperatorType 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;
}
use of net.opengis.fes.x20.SpatialOperatorType 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);
}
}
use of net.opengis.fes.x20.SpatialOperatorType 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);
}
}
}
use of net.opengis.fes.x20.SpatialOperatorType in project ddf by codice.
the class TestWfsFilterDelegate method testIntersectsLonLat.
@Test
public void testIntersectsLonLat() throws SAXException, IOException, JAXBException {
List<String> gmlProps = new ArrayList<>();
gmlProps.add(MOCK_GEOM);
when(mockFeatureMetacardType.getGmlProperties()).thenReturn(gmlProps);
when(mockFeatureMetacardType.getAttributeDescriptor(MOCK_GEOM)).thenReturn(new FeatureAttributeDescriptor(MOCK_GEOM, MOCK_GEOM, true, false, false, false, BasicTypes.STRING_TYPE));
SpatialOperatorType operator = new SpatialOperatorType();
operator.setName(SPATIAL_OPERATORS.Intersects.toString());
FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().clear();
capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().add(operator);
WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LON_LAT_ORDER);
FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
assertTrue(filter.getSpatialOps().getValue() instanceof BinarySpatialOpType);
assertFalse(filter.isSetLogicOps());
assertXMLEqual(MockWfsServer.getIntersectsLonLatXmlFilter(), getXmlFromMarshaller(filter));
}
Aggregations