Package org.opengis.filter

Examples of org.opengis.filter.PropertyIsEqualTo


     */
    public void testGetFeatureStoreModifyFeatures3() throws IOException {
        SimpleFeatureStore road = (SimpleFeatureStore) dataStore.getFeatureSource(tname("road"));

        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        PropertyIsEqualTo filter = ff.equals(ff.property(aname("name")), ff.literal("r1"));

        AttributeDescriptor name = td.roadType.getDescriptor(aname("name"));
        road.modifyFeatures(new AttributeDescriptor[] { name, }, new Object[] { "changed", }, filter);
    }
View Full Code Here


        assertEquals(like, result);
    }
   
    @Test
    public void testBinaryComparison() {
        PropertyIsEqualTo equal = ff.equal(ff.property("a"), ff.property("b"), false);
        NullHandlingVisitor visitor = new NullHandlingVisitor();
        Filter result = (Filter) equal.accept(visitor, null);
        assertTrue(result instanceof And);
        Filter expected = ff.and(Arrays.asList(equal, propertyNotNull("a"), propertyNotNull("b")));
        assertEquals(expected, result);
       
        equal = ff.equal(ff.property("a"), ff.literal(10), false);
        result = (Filter) equal.accept(visitor, null);
        assertTrue(result instanceof And);
        expected = ff.and(Arrays.asList(equal, propertyNotNull("a")));
        assertEquals(expected, result);
       
        equal = ff.equal(ff.literal(10), ff.property("b"), false);
        result = (Filter) equal.accept(visitor, null);
        assertTrue(result instanceof And);
        expected = ff.and(Arrays.asList(equal, propertyNotNull("b")));
        assertEquals(expected, result);
       
        equal = ff.equal(ff.literal(10), ff.literal(20), false);
        result = (Filter) equal.accept(visitor, null);
        assertEquals(equal, result);
    }
View Full Code Here

    }
   
    @Test
    public void testSimplifyRedundant() {
        PropertyIsBetween between = ff.between(ff.property("a"), ff.property("b"), ff.property("c"));
        PropertyIsEqualTo equal = ff.equal(ff.property("a"), ff.property("b"), false);
        And and = ff.and(between, equal);
       
        NullHandlingVisitor nh = new NullHandlingVisitor();
        Filter nhResult = (Filter) and.accept(nh, null);
        SimplifyingFilterVisitor simplifier = new SimplifyingFilterVisitor();
View Full Code Here

        String expr = styleExpression.replaceAll(",\\s+", ","); //$NON-NLS-1$//$NON-NLS-2$
        String[] attribValue = expr.split(","); //$NON-NLS-1$

        // create the first filter
        PropertyName attribExpr = ff.property(attributeTypeName);
        PropertyIsEqualTo cFilter = ff.equals(attribExpr, ff.literal(attribValue[0]));

        if (attribValue.length == 1) {
            return cFilter;
        }
View Full Code Here

        // eliminate spaces after commas
        String expr = styleExpression.replaceAll(",\\s+", ","); //$NON-NLS-1$//$NON-NLS-2$
        String[] attribValue = expr.split(","); //$NON-NLS-1$

        // create the first filter
        PropertyIsEqualTo cFilter = ff.equals(attribExpr, ff.literal(attribValue[0]));

        if (attribValue.length == 1) {
            return cFilter;
        }
View Full Code Here

        String styleExpression = "";

        if (filter instanceof PropertyIsEqualTo) {
            // figure out which side is the attributeExpression, and which side
            // is the LiteralExpression
            PropertyIsEqualTo compareFilter = (PropertyIsEqualTo) filter;
            Expression leftExpression = compareFilter.getExpression1();
            Expression rightExpression = compareFilter.getExpression2();

            if ((leftExpression instanceof PropertyName)
                    && (rightExpression instanceof Literal)) {
                styleExpression = rightExpression.toString();
            } else if ((leftExpression instanceof Literal)
View Full Code Here

        assertEquals(2, f.getChildren().size());
       
        Or f1 = (Or) f.getChildren().get(0);
        assertEquals(2, f1.getChildren().size());
       
        PropertyIsEqualTo f11 = (PropertyIsEqualTo) f1.getChildren().get(0);
        assertEquals("FIELD1", ((PropertyName)f11.getExpression1()).getPropertyName());
        assertEquals("10", ((Literal)f11.getExpression2()).evaluate(null, String.class));
       
        PropertyIsEqualTo f12 = (PropertyIsEqualTo) f1.getChildren().get(1);
        assertEquals("FIELD1", ((PropertyName)f12.getExpression1()).getPropertyName());
        assertEquals("20", ((Literal)f12.getExpression2()).evaluate(null, String.class));
       
        PropertyIsEqualTo f2 = (PropertyIsEqualTo) f.getChildren().get(1);
        assertEquals("STATUS", ((PropertyName)f2.getExpression1()).getPropertyName());
        assertEquals("VALID", ((Literal)f2.getExpression2()).evaluate(null, String.class));
    }
View Full Code Here

            "   <fes:Literal>baz</fes:Literal> " +
            "  </myops:strMatches> " +
            "</fes:Filter>";
        buildDocument(xml);

        PropertyIsEqualTo f = (PropertyIsEqualTo) parse();
        assertTrue(f.getExpression1() instanceof Function);
        assertTrue(f.getExpression2() instanceof Literal);
       
        xml =
            "<fes:Filter " +
              "xmlns:fes='http://www.opengis.net/fes/2.0' xmlns:myops='http://www.someserver.com/myops/1.0'> " +
            " <fes:And> " +
View Full Code Here

   
    public void testPropertyFucntion() {
        PointSymbolizer ps = sb.createPointSymbolizer();
        ps.setGeometry(ff.function("offset", ff.property("the_geom"), ff.property("offx"), ff.property("offy")));
        Function func = ff.function("property", ff.function("env", ff.literal("pname")));
        PropertyIsEqualTo filter = ff.equals(func, ff.literal("test"));
        Rule r = sb.createRule(ps);
        r.setFilter(filter);
       
        try  {
            EnvFunction.setLocalValue("pname", "name");
View Full Code Here

                params.add(ff.literal(batch));
            }
        }

        Function sdo_nn = ff.function("sdo_nn", params.toArray(new Expression[params.size()]));
        PropertyIsEqualTo equalsFilter = ff.equal(sdo_nn, ff.literal(true), false);
        Query query = new Query(tname("NEIGHBORS"), equalsFilter);
       
        SimpleFeatureCollection features = source.getFeatures(query);
        return features.features();
    }
View Full Code Here

TOP

Related Classes of org.opengis.filter.PropertyIsEqualTo

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.