Package org.opengis.filter.spatial

Examples of org.opengis.filter.spatial.DistanceBufferOperator


            Map hints) throws IOException, OperationNotSupportedException {
            if (!canEncode(element, value, hints)) {
                return;
            }

            DistanceBufferOperator lf = (DistanceBufferOperator) value;

            output.startElement(element.getNamespace(), element.getName(), null);

            if (Filters.getExpressionType(lf.getExpression1()) == org.geotools.filter.ExpressionType.ATTRIBUTE) {
                elems[0].getType().encode(elems[0], lf.getExpression1(),
                    output, hints); // prop name
                elems[1].getType().encode(elems[1], lf.getExpression2().evaluate(null, Geometry.class),
                    output, hints); // geom
                elems[2].getType().encode(elems[2], lf, output, hints); // distancetype
            } else {
                if (Filters.getExpressionType(lf.getExpression2()) == org.geotools.filter.ExpressionType.ATTRIBUTE) {
                    elems[0].getType().encode(elems[0], lf.getExpression2(),
                        output, hints); // prop name
                    elems[1].getType().encode(elems[1], lf.getExpression1().evaluate(null,Geometry.class),
                        output, hints); // geom
                    elems[2].getType().encode(elems[2], lf, output, hints); // distancetype
                } else {
                    throw new OperationNotSupportedException(
                        "Either the left or right expr must be a literal for the property name");
View Full Code Here


            Map hints) throws IOException{
            if (!canEncode(element, value, hints)) {
                return;
            }

            DistanceBufferOperator distanceFilter = (DistanceBufferOperator) value;

            AttributesImpl ai = new AttributesImpl();

            String name = attrs[0].getName();
            String uri = getNamespace().toString();
           
            if (Filters.getExpressionType( distanceFilter.getExpression1() ) == ExpressionType.LITERAL_GEOMETRY) {
                Geometry geometry = distanceFilter.getExpression1().evaluate(null,Geometry.class);
                if( geometry.getUserData() != null ){
                    // code assume user data is an srsName see GEOT-693
                    String srsName = String.valueOf( geometry.getUserData() );
                    ai.addAttribute(uri, name, null, "string", srsName);
                }
            } else {
                Geometry geometry = distanceFilter.getExpression2().evaluate(null,Geometry.class);
                if( geometry.getUserData() != null ){
                    // code assume user data is an srsName see GEOT-693
                    String srsName = String.valueOf( geometry.getUserData() );
                    ai.addAttribute(uri, name, null, "string", srsName);
                }
            }

            output.startElement(element.getNamespace(), element.getName(), null);
            output.characters("" + distanceFilter.getDistance());
            output.endElement(element.getNamespace(), element.getName());
        }
View Full Code Here

        //        }
    }

    public Object getProperty(Object object, QName name)
        throws Exception {
        DistanceBufferOperator operator = (DistanceBufferOperator) object;
        Object property = OGCUtils.property(operator.getExpression1(), operator.getExpression2(),
                name);

        if (property != null) {
            return property;
        }

        if ("Distance".equals(name.getLocalPart())) {
            return new Double(operator.getDistance());
        }

        return null;
    }
View Full Code Here

                + ", POINT(1 2), 10, kilometers) ");

        Assert.assertTrue("DistanceBufferOperator filter was expected",
                resultFilter instanceof DWithin);

        DistanceBufferOperator filter = (DWithin) resultFilter;
        Expression property = filter.getExpression1();

        Assert.assertEquals(propExpected, property.toString());

    }
View Full Code Here

     * @throws CQLException
     */
    private DistanceBufferOperator buildDistanceBufferOperator(
            final int nodeType) throws CQLException {

        DistanceBufferOperator filter = null;

        switch (nodeType) {
        case JJTROUTINEINVOCATION_RELOP_DWITHIN_NODE:
            filter = this.builder.buildSpatialDWithinFilter();
            break;
View Full Code Here

     * @throws CQLException
     */
    private DistanceBufferOperator buildDistanceBufferOperator(
            final int nodeType) throws CQLException {

        DistanceBufferOperator filter = null;

        switch (nodeType) {
        case JJTROUTINEINVOCATION_RELOP_DWITHIN_NODE:
            filter = this.builder.buildSpatialDWithinFilter();
            break;
View Full Code Here

        resultFilter = CompilerUtil.parseFilter(this.language,
                "DWITHIN(buffer(the_geom,5), POINT(1 2), 10, kilometers)");

        Assert.assertTrue(resultFilter instanceof DistanceBufferOperator);

        DistanceBufferOperator distOp = (DistanceBufferOperator) resultFilter;
       
        Assert.assertTrue(distOp.getExpression1() instanceof FilterFunction_buffer);
       
        Assert.assertTrue(distOp.getExpression2() instanceof Literal);

    }
View Full Code Here

        filter = CompilerUtil.parseFilter(this.language,
                "DWITHIN(buffer(the_geom,5), buffer(the_geom,2), 10, kilometers)");

        Assert.assertTrue(filter instanceof DistanceBufferOperator);

        DistanceBufferOperator distOp = (DistanceBufferOperator) filter;
       
        Assert.assertTrue(distOp.getExpression1() instanceof FilterFunction_buffer);
       
        Assert.assertTrue(distOp.getExpression2() instanceof FilterFunction_buffer);

    }
View Full Code Here

TOP

Related Classes of org.opengis.filter.spatial.DistanceBufferOperator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.