Package org.opengis.filter

Examples of org.opengis.filter.And


        if (filter == Filter.EXCLUDE) {
            // we are just starting out
            filter = change.getFilter();
        } else if (filter instanceof And) {
            And and = (And) filter;
            List<Filter> children = new ArrayList(and.getChildren());
            children.add(change.getFilter());
            filter = ff.and(children);
        } else {
            filter = ff.and(filter, change.getFilter());
        }
View Full Code Here


        init();
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo property = ff.equals(ff.property("standard_ss"),
                ff.literal("IEEE 802.11b"));
        BBOX bbox = ff.bbox("geo", -190, -190, 190, 190, "EPSG:" + SOURCE_SRID);
        And filter = ff.and(property, bbox);
        SimpleFeatureCollection features = featureSource.getFeatures(filter);
        assertEquals(7, features.size());
    }
View Full Code Here

   
    public void testLogicFilterDuplication() throws IllegalFilterException {
      //create a filter
      PropertyIsGreaterThan greater = fac.greater(fac.literal(2), fac.literal(1));
      PropertyIsLessThan less = fac.less(fac.literal(3), fac.literal(4));
      And and = fac.and(greater, less);
     
      //duplicate it
      DuplicatingFilterVisitor visitor = new DuplicatingFilterVisitor();
      Filter newFilter = (Filter) and.accept(visitor, fac);

      //compare it
      assertNotNull(newFilter);
      assertEquals( and, newFilter );
    }   
View Full Code Here

                return new Filter[] { Filter.EXCLUDE, bboxFilter(originalBounds) };
            else
                return new Filter[] { Filter.EXCLUDE, bboxFilter(envelope) };
        }

        And and = (And) filter;
        List residuals = new ArrayList();
        List bboxBacked = new ArrayList();
        for (Iterator it = and.getChildren().iterator(); it.hasNext();) {
            Filter child = (Filter) it.next();
            if (getEnvelope(child) != null) {
                bboxBacked.add(child);
            } else {
                residuals.add(child);
View Full Code Here

        Filter filter1 = fac.greater(fac.literal(2), fac.literal(1));
        filters.add(filter1);
        Filter filter2 = fac.greater(fac.literal(4), fac.literal(3));
        filters.add(filter2);

        And oldFilter = fac.and(filters);
        //duplicate it
      DuplicatingFilterVisitor visitor = new DuplicatingFilterVisitor((FilterFactory2) fac);
      Filter newFilter = (Filter) oldFilter.accept(visitor, null);

      //compare it
      assertNotNull(newFilter);
      //TODO: a decent comparison
    }
View Full Code Here

        init();
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo property = ff.equals(ff.property("standard_ss"),
                ff.literal("IEEE 802.11b"));
        BBOX bbox = ff.bbox("geo", -1, -1, 10, 10, "EPSG:" + SOURCE_SRID);
        And filter = ff.and(property, bbox);
        SimpleFeatureCollection features = featureSource.getFeatures(filter);
        assertEquals(3, features.size());
    }
View Full Code Here

   */
  public void testVisitLogicFilterNOT() {
        Set<FeatureId> fidSet1 = Collections.singleton(ff.featureId("new1"));
        Set<FeatureId> fidSet2 = Collections.singleton(ff.featureId("new2"));
       
        And before = ff.and( ff.id( fidSet1 ), ff.id( fidSet2 ) );
       
        And after = (And) before.accept( visitor, null );
        assertSame( after, after );
        assertTrue( ((Id)after.getChildren().get(0)).getIDs().contains("final1") );
        assertTrue( ((Id)after.getChildren().get(1)).getIDs().contains("final2") );
    }
View Full Code Here

        assertNull("Start with nothing should end with nothing", results);

        results = Filters.removeFilter(a, null);
        assertSame("Existing should be returned with null target", a, results);

        And base = ff.and(Arrays.asList(new Filter[]{a,b,c}));
        results = Filters.removeFilter(base, d);
        assertEquals("Should not change when target not a child", base, results);

        results = Filters.removeFilter(base, b);
        And expected = ff.and(a, c);
        assertEquals(expected, results);

        //now remove another.  it should be collapsed and only c returned
        results = Filters.removeFilter(results, a);
        assertEquals(results, c);
View Full Code Here

    }

    @Test
    public void testRemoveFilterCompound() {
        Or childOr = ff.or(Arrays.asList(new Filter[]{b, c, d}));
        And base = ff.and(a, childOr);

        Filter results = Filters.removeFilter(base, d, false);
        assertEquals("Filter should not be removed because it should not recurse", base, results);

        results = Filters.removeFilter(base, d);
        assertFalse("Results should be a new object with different children", base.equals(results));
        childOr = ff.or(b,c);
        And expected = ff.and(a, childOr);
        assertEquals(expected, results);

        //again
        results = Filters.removeFilter(results, c);
        expected = ff.and(a, b);
View Full Code Here

        // Set up false sub filter
        testLiteral = new LiteralExpressionImpl("incorrect test string data");
        PropertyIsEqualTo filterFalse = fac.equals(testAttribute, testLiteral);

        // Test AND for false positives
        And filter = fac.and(filterFalse, filterTrue);

        LOGGER.finer( filter.toString());           
        LOGGER.finer( "contains feature: " + filter.evaluate(testFeature));
        assertTrue(!filter.evaluate(testFeature));

        // Test AND for false positives
        filter = fac.and(filterTrue, filterFalse);

        LOGGER.finer( filter.toString());           
        LOGGER.finer( "contains feature: " + filter.evaluate(testFeature));
        assertTrue(!filter.evaluate(testFeature));

        // Test AND for false positives
        filter = fac.and(filterTrue, filterTrue);
        LOGGER.finer( filter.toString());           
        LOGGER.finer( "contains feature: " + filter.evaluate(testFeature));
        assertTrue(filter.evaluate(testFeature));
       
        // finally test nothing shortcut
        assertFalse(fac.not(filter).evaluate(testFeature));
    }
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.