Search in sources :

Example 1 with BBOXTypeImpl

use of net.opengis.ogc.impl.BBOXTypeImpl in project arctic-sea by 52North.

the class OgcDecoderv100 method parseSpatialOperatorType.

private Object parseSpatialOperatorType(BinarySpatialOpType xbSpatialOpsType) throws DecodingException {
    SpatialFilter spatialFilter = new SpatialFilter();
    try {
        if (xbSpatialOpsType instanceof BBOXTypeImpl) {
            spatialFilter.setOperator(FilterConstants.SpatialOperator.BBOX);
            BBOXTypeImpl xbBBOX = (BBOXTypeImpl) xbSpatialOpsType;
            spatialFilter.setOperator(FilterConstants.SpatialOperator.BBOX);
            XmlCursor geometryCursor = xbBBOX.newCursor();
            if (geometryCursor.toChild(GmlConstants.QN_ENVELOPE)) {
                Object sosGeometry = decodeXmlElement(XmlObject.Factory.parse(geometryCursor.getDomNode()));
                if (sosGeometry instanceof Geometry) {
                    spatialFilter.setGeometry((Geometry) sosGeometry);
                }
            } else {
                throw unsupportedSpatialFilter();
            }
            geometryCursor.dispose();
        } else {
            throw unsupportedSpatialFilter();
        }
    } catch (XmlException xmle) {
        throw errorParsingSpatialFilter(xmle);
    }
    return spatialFilter;
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) XmlException(org.apache.xmlbeans.XmlException) SpatialFilter(org.n52.shetland.ogc.filter.SpatialFilter) XmlObject(org.apache.xmlbeans.XmlObject) BBOXTypeImpl(net.opengis.ogc.impl.BBOXTypeImpl) XmlCursor(org.apache.xmlbeans.XmlCursor)

Aggregations

BBOXTypeImpl (net.opengis.ogc.impl.BBOXTypeImpl)1 XmlCursor (org.apache.xmlbeans.XmlCursor)1 XmlException (org.apache.xmlbeans.XmlException)1 XmlObject (org.apache.xmlbeans.XmlObject)1 Geometry (org.locationtech.jts.geom.Geometry)1 SpatialFilter (org.n52.shetland.ogc.filter.SpatialFilter)1