Search in sources :

Example 1 with DistanceType

use of ogc.schema.opengis.filter.v_1_0_0.DistanceType in project ddf by codice.

the class CswQueryFactoryTest method createDistanceBufferType.

private DistanceBufferType createDistanceBufferType() {
    DistanceBufferType distanceBuffer = new DistanceBufferType();
    PropertyNameType propName = new PropertyNameType();
    propName.getContent().add(SPATIAL_TEST_ATTRIBUTE);
    distanceBuffer.setPropertyName(propName);
    DistanceType distance = filterObjectFactory.createDistanceType();
    distance.setUnits(REL_GEO_UNITS);
    distance.setContent(Double.toString(REL_GEO_DISTANCE));
    distanceBuffer.setDistance(distance);
    distanceBuffer.setGeometry(createPolygon());
    return distanceBuffer;
}
Also used : DistanceBufferType(net.opengis.filter.v_1_1_0.DistanceBufferType) DistanceType(net.opengis.filter.v_1_1_0.DistanceType) PropertyNameType(net.opengis.filter.v_1_1_0.PropertyNameType)

Example 2 with DistanceType

use of ogc.schema.opengis.filter.v_1_0_0.DistanceType in project ddf by codice.

the class WfsFilterDelegate method buildDistanceBufferType.

private JAXBElement<DistanceBufferType> buildDistanceBufferType(JAXBElement<DistanceBufferType> dbt, String propertyName, String wkt, double distance) {
    DistanceType distanceType = new DistanceType();
    distanceType.setContent(Double.toString(distance));
    // the filter adapter normalizes all distances to meters
    distanceType.setUnits(WfsConstants.METERS);
    dbt.getValue().setDistance(distanceType);
    dbt.getValue().setGeometry(createPoint(wkt));
    dbt.getValue().setPropertyName(createPropertyNameType(propertyName).getValue());
    return dbt;
}
Also used : DistanceType(ogc.schema.opengis.filter.v_1_0_0.DistanceType)

Example 3 with DistanceType

use of ogc.schema.opengis.filter.v_1_0_0.DistanceType in project ddf by codice.

the class CswFilterFactory method createBeyondType.

private JAXBElement<DistanceBufferType> createBeyondType(String propertyName, String wkt, double distance) {
    wkt = convertWktToLatLonOrdering(wkt);
    Geometry geometry = getGeometryFromWkt(wkt);
    JAXBElement<? extends AbstractGeometryType> geometryJaxbElement = convertGeometry(geometry);
    PropertyNameType propertyNameType = createPropertyNameType(propertyName);
    DistanceType distanceType = createDistanceType(distance, CswConstants.METERS);
    DistanceBufferType distanceBufferType = createDistanceBufferType(propertyNameType, geometryJaxbElement, distanceType);
    return filterObjectFactory.createBeyond(distanceBufferType);
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) DistanceType(net.opengis.filter.v_1_1_0.DistanceType) DistanceBufferType(net.opengis.filter.v_1_1_0.DistanceBufferType) PropertyNameType(net.opengis.filter.v_1_1_0.PropertyNameType)

Example 4 with DistanceType

use of ogc.schema.opengis.filter.v_1_0_0.DistanceType in project ddf by codice.

the class CswFilterFactory method createDWithinType.

private JAXBElement<DistanceBufferType> createDWithinType(String propertyName, String wkt, double distance) {
    wkt = convertWktToLatLonOrdering(wkt);
    Geometry geometry = getGeometryFromWkt(wkt);
    JAXBElement<? extends AbstractGeometryType> geometryJaxbElement = convertGeometry(geometry);
    PropertyNameType propertyNameType = createPropertyNameType(propertyName);
    DistanceType distanceType = createDistanceType(distance, CswConstants.METERS);
    DistanceBufferType distanceBufferType = createDistanceBufferType(propertyNameType, geometryJaxbElement, distanceType);
    return filterObjectFactory.createDWithin(distanceBufferType);
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) DistanceType(net.opengis.filter.v_1_1_0.DistanceType) DistanceBufferType(net.opengis.filter.v_1_1_0.DistanceBufferType) PropertyNameType(net.opengis.filter.v_1_1_0.PropertyNameType)

Example 5 with DistanceType

use of ogc.schema.opengis.filter.v_1_0_0.DistanceType in project ddf by codice.

the class CswFilterFactory method createDistanceType.

private DistanceType createDistanceType(double distance, String units) {
    DistanceType distanceType = new DistanceType();
    distanceType.setUnits(units);
    /**
         * With the original filter-v_1_1_0-schema_1.1.0.jar, we were unable to set content (the
         * actual distance value) on DistanceType. The attribute mixed="true" is missing from the
         * complexType DistanceType in filter.xsd. This prevents Beyond and DWithin from working. To
         * correct this, we fixed filter.xsd and rebuilt the JAXB bindings (see project
         * ogc-filter-v_1_1_0-schema-bindings).
         */
    distanceType.setContent(String.valueOf(distance));
    return distanceType;
}
Also used : DistanceType(net.opengis.filter.v_1_1_0.DistanceType)

Aggregations

DistanceType (net.opengis.filter.v_1_1_0.DistanceType)4 DistanceBufferType (net.opengis.filter.v_1_1_0.DistanceBufferType)3 PropertyNameType (net.opengis.filter.v_1_1_0.PropertyNameType)3 Geometry (com.vividsolutions.jts.geom.Geometry)2 DistanceType (ogc.schema.opengis.filter.v_1_0_0.DistanceType)1