Package org.opengis.filter

Examples of org.opengis.filter.And


                } else {
                    org.opengis.filter.FilterFactory fac = CommonFactoryFinder
                            .getFilterFactory(GeoTools.getDefaultHints());
                    if (!add) {
                        Not notFilter = fac.not(newFilter);
                        And logicFilter = fac.and(notFilter, oldFilter);

                        layer.setFilter(logicFilter);
                    } else {
                        Filter orFilter = fac.or(newFilter, oldFilter);
View Full Code Here


                DWithin dWithin = filterFactory.dwithin(geomAttb, pointExpr, request.getMaxRange(), request.getUnits());
                if (query.getFilter() == null) {
                    query.addFilter((Filter)dWithin);
                   
                } else {
                    And andFilter = filterFactory.and(Arrays.asList(new Filter[] { (Filter)dWithin, query.getFilter() }));
                    query.addFilter((Filter)andFilter);
                }
               
                LOGGER.fine("Query is " + query + "\n To gt2: " + query.toDataQuery(Integer.MAX_VALUE));
View Full Code Here

        for (Rule rule : rules) {
            Filter geomSelectFunction = null;
            if (!(rule.getSymbolizers()[0] instanceof TextSymbolizer)) {
                assertTrue(rule.getFilter() instanceof And);
                And andFilter = (And) rule.getFilter();
                assertEquals(2, andFilter.getChildren().size());

                PropertyIsEqualTo filter = (PropertyIsEqualTo) andFilter.getChildren().get(0);
                PropertyName propertyName = (PropertyName) filter.getExpression1();
                assertEquals("_gx_style", propertyName.getPropertyName());
                Literal valueExpression = (Literal) filter.getExpression2();
                assertEquals("1", valueExpression.getValue());

                geomSelectFunction = andFilter.getChildren().get(1);
            }

            final List<Symbolizer> symbolizers = rule.symbolizers();

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

                -20, schema.getCoordinateReferenceSystem().getName().getCode());
        Filter sqlFilter = CQL.toFilter("INT32_COL < 5");
        LOGGER.fine("Geometry filter: " + bboxFilter);
        LOGGER.fine("SQL filter: " + sqlFilter);

        And mixedFilter = ff.and(sqlFilter, bboxFilter);

        Not not = ff.not(ff.id(Collections.singleton(ff.featureId(testData.getTempTableName()
                + ".90000"))));

        mixedFilter = ff.and(mixedFilter, not);
View Full Code Here

   
    public void testGetFeaturesWithLogicFilter() throws Exception {
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo property = ff.equals(ff.property(aname("stringProperty")), ff.literal("one"));
        BBOX bbox = ff.bbox(aname("geometry"), -20, -20, 20, 20, "EPSG:4326");
        And filter = ff.and(property, bbox);

        SimpleFeatureCollection features = featureSource.getFeatures(filter);
        assertEquals(1, features.size());

        SimpleFeatureIterator iterator = features.features();
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();
        Filter simplified = (Filter) nhResult.accept(simplifier, null);
        assertTrue(simplified instanceof And);
        Filter expected = ff.and(Arrays.asList(between, equal, propertyNotNull("a"), propertyNotNull("b"), propertyNotNull("c")));
        assertEquals(expected, simplified);
View Full Code Here

            "      </fes:PropertyIsEqualTo> " +
            "   </fes:And> " +
            "</fes:Filter> ";
        buildDocument(xml);

        And f = (And) parse();
        assertNotNull(f);
        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:And> " +
            "</fes:Filter>";
       
        buildDocument(xml);

        And f = (And) parse();
        assertNotNull(f);
        assertEquals(2, f.getChildren().size());
       
        Within f1 = (Within) f.getChildren().get(0);
        assertEquals("WKB_GEOM", ((PropertyName)f1.getExpression1()).getPropertyName());
        assertTrue(f1.getExpression2().evaluate(null) instanceof Polygon);
       
        PropertyIsBetween f2 = (PropertyIsBetween) f.getChildren().get(1);
        assertEquals("DEPTH", ((PropertyName)f2.getExpression()).getPropertyName());
        assertEquals(400, f2.getLowerBoundary().evaluate(null, Integer.class).intValue());
        assertEquals(800, f2.getUpperBoundary().evaluate(null, Integer.class).intValue());
    }
View Full Code Here

            "  </fes:PropertyIsBetween> " +
            " </fes:And> " +
            "</fes:Filter>";
        buildDocument(xml);

        And a = (And) parse();
        List<Filter> ch = a.getChildren();
       
        assertEquals(2, ch.size());
       
        assertTrue(ch.get(0) instanceof PropertyIsEqualTo || ch.get(0) instanceof PropertyIsBetween);
        assertTrue(ch.get(1) instanceof PropertyIsEqualTo || ch.get(1) instanceof PropertyIsBetween);
View Full Code Here

    @Test
    public void and() {
        PropertyIsNull nn = ff.isNull(ff.property("bar"));
        Equals eq = ff.equal(ff.property("foo"), ff.literal("john"));
        And and = ff.and(nn, eq);
    }
View Full Code Here

TOP

Related Classes of org.opengis.filter.And

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.