Package org.opengis.filter

Examples of org.opengis.filter.FilterFactory.equal()


    @Test
    public void testCompoundPolygonWithHole() throws Exception {
        ContentFeatureSource fs = dataStore.getFeatureSource(tname("curves"));
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo filter = ff.equal(ff.property(aname("name")),
                ff.literal("Compound polygon with hole"), true);
        ContentFeatureCollection fc = fs.getFeatures(filter);
        assertEquals(1, fc.size());
        SimpleFeature feature = DataUtilities.first(fc);
        Geometry g = (Geometry) feature.getDefaultGeometry();
View Full Code Here


    @Test
    public void testMultipolygon() throws Exception {
        ContentFeatureSource fs = dataStore.getFeatureSource(tname("curves"));
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo filter = ff.equal(ff.property(aname("name")),
                ff.literal("Multipolygon with curves"), true);
        ContentFeatureCollection fc = fs.getFeatures(filter);
        assertEquals(1, fc.size());
        SimpleFeature feature = DataUtilities.first(fc);
        Geometry g = (Geometry) feature.getDefaultGeometry();
View Full Code Here

    }
   
    public void testEquality() throws IOException {
        SimpleFeatureSource fs = dataStore.getFeatureSource(tname("users"));
        FilterFactory ff = dataStore.getFilterFactory();
        Filter filter = ff.equal(ff.property(aname("nick")), ff.literal("LARRY"), true);
        int count = fs.getCount(new Query(tname("users"), filter));
        // we had a case insensitive comparison due to the type, regardless of what we asked in the filter
        assertEquals(1, count);
    }
   
View Full Code Here

        OGRDataStore s = new OGRDataStore(getAbsolutePath(STATE_POP), null, null);
        FeatureSource fs = s.getFeatureSource(s.getTypeNames()[0]);
       
        // equality filter
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        Filter f = ff.equal(ff.property("STATE_NAME"), ff.literal("New York"), true);
        assertEquals(1, fs.getFeatures(f).size());
       
        // greater than
        f = ff.greater(ff.property("PERSONS"), ff.literal(10000000));
        assertEquals(6, fs.getFeatures(f).size());
View Full Code Here

        }
    }
   
    public void testCaseInsensitiveFilter() throws Exception {
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo sensitive = ff.equal(ff.property(aname("stringProperty")), ff.literal("OnE"), true);
        PropertyIsEqualTo insensitive = ff.equal(ff.property(aname("stringProperty")), ff.literal("OnE"), false);
        assertEquals(0, featureSource.getCount(new Query(null, sensitive)));
        assertEquals(1, featureSource.getCount(new Query(null, insensitive)));
    }
View Full Code Here

    }
   
    public void testCaseInsensitiveFilter() throws Exception {
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo sensitive = ff.equal(ff.property(aname("stringProperty")), ff.literal("OnE"), true);
        PropertyIsEqualTo insensitive = ff.equal(ff.property(aname("stringProperty")), ff.literal("OnE"), false);
        assertEquals(0, featureSource.getCount(new Query(null, sensitive)));
        assertEquals(1, featureSource.getCount(new Query(null, insensitive)));
    }

    public void testGetFeaturesWithQuery() throws Exception {
View Full Code Here

        assertEquals(1, featureSource.getCount(new Query(null, f)));
    }
   
    public void testNotFilter() throws Exception {
        FilterFactory ff = dataStore.getFilterFactory();
        Filter f = ff.equal(ff.property(aname("stringProperty")), ff.literal("one"), true);
        f = ff.not(f);
       
        assertEquals(featureSource.getCount(Query.ALL)-1, featureSource.getCount(new Query(null, f)));
    }
   
View Full Code Here

    }
   
    public void testModifyExposedPk() throws IOException {
        SimpleFeatureType t = featureStore.getSchema();
         FilterFactory ff = CommonFactoryFinder.getFilterFactory();
        PropertyIsEqualTo filter = ff.equal(ff.property(aname("stringProperty")), ff.literal("zero"), false);
        featureStore.modifyFeatures(new AttributeDescriptor[] { t.getDescriptor(aname("stringProperty")),
                t.getDescriptor(aname("id"))},
            new Object[] { "foo", 123}, filter);

        PropertyIsEqualTo idFilter = ff.equal(ff.property(aname("id")), ff.literal(0), false);
View Full Code Here

        PropertyIsEqualTo filter = ff.equal(ff.property(aname("stringProperty")), ff.literal("zero"), false);
        featureStore.modifyFeatures(new AttributeDescriptor[] { t.getDescriptor(aname("stringProperty")),
                t.getDescriptor(aname("id"))},
            new Object[] { "foo", 123}, filter);

        PropertyIsEqualTo idFilter = ff.equal(ff.property(aname("id")), ff.literal(0), false);
        SimpleFeatureCollection features = featureStore.getFeatures(idFilter);
        SimpleFeatureIterator i = features.features();
        try {
            assertTrue(i.hasNext());
   
View Full Code Here

            dataStore.getFeatureSource(tname("ftjoin")).getFeatures().features();

        FilterFactory ff = dataStore.getFilterFactory();
        Query q = new Query(tname("ft1"));
        q.getJoins().add(new Join(tname("ftjoin"),
            ff.equal(ff.property(aname("stringProperty")), ff.property(aname("name")), true)));

        SimpleFeatureCollection features = dataStore.getFeatureSource(tname("ft1")).getFeatures(q);
        assertEquals(dataStore.getFeatureSource(tname("ft1")).getFeatures(q).size(), features.size());

        SimpleFeatureIterator it = features.features();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.