Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureStore.removeFeatures()


                    autoCommitReader.close();
                }
            }

            // now keep using the transaction, it should still work
            transFs.removeFeatures(filterNewFeature);

            // no features removed yet outside the transaction
            {
                FeatureReader<SimpleFeatureType, SimpleFeature> autoCommitReader;
                autoCommitReader = ds.getFeatureReader(newFeatureQuery, Transaction.AUTO_COMMIT);
View Full Code Here


        store.modifyFeatures(attribute, "modified", fidFilter);
        Filter modifiedFilter = ff.equals(ff.property("f"), ff.literal("modified"));
        assertEquals(2, count(ds, typeName, modifiedFilter));
       
        final int initialCount = store.getCount(Query.ALL);
        store.removeFeatures(fidFilter);
        final int afterCount = store.getCount(Query.ALL);
        assertEquals(initialCount - 2, afterCount);
        ds.dispose();
    }
   
View Full Code Here

        Id id = ff.id(Collections.singleton(ff.featureId(fid)));
       
        assertEquals(-1, store.getCount(new Query(typeName, id)));
        assertEquals(1, count(ds, typeName, id, t));
       
        store.removeFeatures(id);
       
        assertEquals(-1, store.getCount(new Query(store.getSchema().getTypeName(), id)));
        assertEquals(initialCount - 1, count(ds, typeName, Filter.INCLUDE, t));
        assertEquals(0, count(ds, typeName, id, t));
        ds.dispose();
View Full Code Here

        count(store, 2);
        FeatureId identifier = fid.iterator().next();
        String next = identifier.getID();
        FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(null);
        Filter f = filterFactory.id(Collections.singleton(filterFactory.featureId(next)));
        store.removeFeatures(f);
       
        count(store, 1);
//        assertEquals("Number of known feature as obtained from getCount",3, store.getCount(Query.ALL));
    }
View Full Code Here

        count1 ++; fr.next();
      }
        fr.close();

      System.out.println("Delete Remove "+ff);
      fs.removeFeatures(ff);

      System.out.println("Delete Read 2");
      fr = fs.getFeatures().features();
      int count2 = 0;
      while(fr.hasNext()){
View Full Code Here

        assertEquals(type, reader.getFeatureType());
        assertEquals(1, count(reader));

        SimpleFeatureStore store = (SimpleFeatureStore) data.getFeatureSource("ROAD");
        store.setTransaction(t);
        store.removeFeatures(rd1Filter);

        reader = data.getFeatureReader(new Query("ROAD", Filter.EXCLUDE), t);
        assertEquals(0, count(reader));

        reader = data.getFeatureReader(new Query("ROAD"), t);
View Full Code Here

    }

    public void testGetFeatureStoreRemoveFeatures() throws IOException {
        SimpleFeatureStore road = (SimpleFeatureStore) data.getFeatureSource("ROAD");

        road.removeFeatures(rd1Filter);
        assertEquals(0, road.getFeatures(rd1Filter).size());
        assertEquals(roadFeatures.length - 1, road.getFeatures().size());
    }

    public void testGetFeatureStoreAddFeatures() throws IOException {
View Full Code Here

     */
    @Test
    public void testRemove() throws FileNotFoundException, IOException {
        DataStore csv = this.getDataStore();
        SimpleFeatureStore rows = (SimpleFeatureStore) csv.getFeatureSource( TYPE_NAME );
        rows.removeFeatures(this.newTestFilter());

        // re-open
        csv = this.getDataStore();
        rows = (SimpleFeatureStore) csv.getFeatureSource( TYPE_NAME );
        SimpleFeatureCollection features = rows.getFeatures();
View Full Code Here

    @Test
    public void testRemoveAll() throws FileNotFoundException, IOException {
        DataStore csv = this.getDataStore();
        SimpleFeatureStore rows = (SimpleFeatureStore) csv.getFeatureSource( TYPE_NAME );
        rows.removeFeatures(Filter.INCLUDE);

        // re-open
        csv = this.getDataStore();
        rows = (SimpleFeatureStore) csv.getFeatureSource( TYPE_NAME );
        SimpleFeatureCollection features = rows.getFeatures();
View Full Code Here

        assertEquals(type, reader.getFeatureType());
        assertEquals(1, count(reader));

        SimpleFeatureStore store = (SimpleFeatureStore) data.getFeatureSource(getRoadTypeName());
        store.setTransaction(t);
        store.removeFeatures(rd1Filter);

        reader = data.getFeatureReader(new Query(getRoadTypeName(), Filter.EXCLUDE), t);
        assertEquals(0, count(reader));

        reader = data.getFeatureReader(new Query(getRoadTypeName()), t);
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.