Package org.opengis.filter.expression

Examples of org.opengis.filter.expression.Literal


    static Object[] distanceBufferOpProperty(Expression e) {
        if (e instanceof PropertyName) {
            return new Object[]{FES.ValueReference, e};
        }
        else if (e instanceof Literal) {
            Literal l = (Literal) e;
            if (l.getValue() instanceof Geometry) {
                Geometry g = (Geometry) l.getValue();
                return new Object[]{new QName(GML.NAMESPACE, g.getGeometryType()), g};
            }
            return new Object[]{FES.Literal, e};
        }
        else if (e instanceof Function) {
View Full Code Here


                .getValue());
    }

    @Test
    public void testMathExpression() throws Exception {
        Literal literal = ff.literal(new Integer(2));
        Multiply mathExp = ff.multiply(ff.property("measurement/result"), literal);

        List unrolledExpressions = (List) mathExp.accept(visitor, null);

        assertEquals(1, unrolledExpressions.size());
View Full Code Here

    @Test
    public void testGetFeatureReaderQuery() throws Exception {
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);

        PropertyName property = ff.property("sample/measurement[1]/parameter");
        Literal literal = ff.literal("ph");
        Filter filterParameter = ff.equals(property, literal);

        property = ff.property("sample/measurement[1]/value");
        literal = ff.literal(new Integer(3));
        Filter filterValue = ff.equals(property, literal);
View Full Code Here

        assertTrue(equal.getExpression2() instanceof Literal);

        PropertyName name = (PropertyName) equal.getExpression1();
        assertEquals("testString", name.getPropertyName());

        Literal literal = (Literal) equal.getExpression2();
        assertEquals("2", literal.toString());
    }
View Full Code Here

        String name = propName.getPropertyName();
        assertEquals("the_geom", name);
       
        //Asserting the Geometry
        assertNotNull(filter.getExpression2());
        Literal geom = (Literal) filter.getExpression2();
        assertEquals("POINT (-74.817265 40.5296504)", geom.toString());
       
        //Asserting the Distance
        assertTrue(filter.getDistance() > 0 );
        Double dist = filter.getDistance();
        assertEquals(200.0, dist);
View Full Code Here

            }
        }

        if (new QName(GML.NAMESPACE, "_Geometry").equals(name)) {
            if (e1 instanceof Literal) {
                Literal literal = (Literal) e1;

                if (literal.getValue() instanceof Geometry) {
                    return literal.getValue();
                }
            } else if (e2 instanceof Literal) {
                Literal literal = (Literal) e2;

                if (literal.getValue() instanceof Geometry) {
                    return literal.getValue();
                }
            }
        }

        if (new QName(GML.NAMESPACE, "Box").equals(name) /*filter 1.0*/
                || new QName(GML.NAMESPACE, "Envelope").equals(name) /*filter 1.1*/) {
            if (e1 instanceof Literal) {
                Literal literal = (Literal) e1;

                if (literal.getValue() instanceof Envelope) {
                    return literal.getValue();
                }
            } else if (e2 instanceof Literal) {
                Literal literal = (Literal) e2;

                if (literal.getValue() instanceof Envelope) {
                    return literal.getValue();
                }
            }
        }

        return null;
View Full Code Here

     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        PropertyName name = (PropertyName) node.getChildValue(PropertyName.class);
        Literal literal = (Literal) node.getChildValue(Literal.class);

        String wildcard = (String) node.getAttributeValue("wildCard");
        String single = (String) node.getAttributeValue("singleChar");
        String escape = (String) node.getAttributeValue("escape");
        boolean matchCase = true;

        if (node.getAttributeValue("matchCase") != null){
            matchCase = (Boolean) node.getAttributeValue("matchCase");
        }

        if (escape == null) {
            //1.1 uses "escapeChar", suppot that too
            escape = (String) node.getAttributeValue("escapeChar");
        }

        return factory.like(name, literal.toString(), wildcard, single, escape, matchCase);
    }
View Full Code Here

        return null;
    }

    protected void traverse(BinarySpatialOperator f) {
        if (f.getExpression1() instanceof Literal) {
            Literal l = (Literal) f.getExpression1();
            Geometry g = (Geometry) l.getValue();
            envelopes.push(g.getEnvelopeInternal());
        } else if (f.getExpression2() instanceof Literal) {
            Literal l = (Literal) f.getExpression2();
            Geometry g = (Geometry) l.getValue();
            envelopes.push(g.getEnvelopeInternal());
        }
       
        if (f.getExpression1() instanceof PropertyName){
            geom = ((PropertyName)f.getExpression1()).getPropertyName();
View Full Code Here

          MultiLineString ml = gf.createMultiLineString(geometries);
         
          FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
         
          PropertyName p = ff.property(aname("geom"));       
          Literal collect = ff.literal(ml);
       
          DWithin dwithinGeomCo  = ((FilterFactory2) ff).dwithin(p, collect, 5, "meter");
          Query dq = new Query(tname("road"), dwithinGeomCo);
          SimpleFeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(dq);
          assertEquals(0, features.size());
View Full Code Here

        GeometryCollection geometry = new GeometryCollection(geometries, factory );

        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);

        PropertyName geomName = ff.property(aname("geom"));
        Literal lit = ff.literal(geometry);
       
        DWithin dwithinGeomFilter  = ((FilterFactory2) ff).dwithin(geomName, lit, distance, unit);
        Query query = new Query(tname("road"), dwithinGeomFilter);
        SimpleFeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(query);
        assertEquals(1, features.size());
View Full Code Here

TOP

Related Classes of org.opengis.filter.expression.Literal

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.