Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureCollection.accepts()


    FilterFactory ff = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
    Filter filter = ff.id(Collections.singleton(ff.featureId("fred")));
    try {
        final Set<FeatureId> removed = new HashSet<FeatureId>();
        SimpleFeatureCollection collection = store.getFeatures( new Query( typeName, filter, Query.NO_NAMES ));
        collection.accepts( new FeatureVisitor(){
            public void visit(Feature feature) {
                removed.add( feature.getIdentifier() );
            }
        }, null );
        store.removeFeatures(filter);
View Full Code Here


    }
   
    public void testVisitor() throws IOException {
        Filter filter = ff.equal(ff.property("someAtt"), ff.literal("1"), false);
        SimpleFeatureCollection collection = new FilteringSimpleFeatureCollection(delegate, filter);
        collection.accepts(new FeatureVisitor() {
           
            public void visit(Feature feature) {
                assertEquals(1, feature.getProperty("someAtt").getValue());
               
            }
View Full Code Here

        stb.add("bar", Integer.class);

        UniqueVisitor vis = new UniqueVisitor("bar");

        SimpleFeatureCollection delegate = createMock(SimpleFeatureCollection.class);
        delegate.accepts(vis, null);
        expectLastCall().once();
        replay(delegate);

        ReTypingFeatureCollection rtc =
            new ReTypingFeatureCollection(delegate, stb.buildFeatureType());
View Full Code Here

        UniqueVisitor vis = new UniqueVisitor("bar");

        SimpleFeatureCollection delegate = createMock(SimpleFeatureCollection.class);
        expect(delegate.getSchema()).andReturn(ft).anyTimes();
        delegate.accepts(vis, null);
        expectLastCall().once();
        replay(delegate);

        ReprojectingFeatureCollection rfc = new ReprojectingFeatureCollection(delegate, target);
        rfc.accepts(vis, null);
View Full Code Here

    public void testMultiLine() throws Exception {
        SimpleFeatureSource road = storeMultiline.getFeatureSource( "multiline" );
        FeatureId fid1 = ff.featureId("fid1");
        Filter select = ff.id( Collections.singleton(fid1));
        SimpleFeatureCollection featureCollection = road.getFeatures( select );
        featureCollection.accepts(new FeatureVisitor() {
            public void visit(Feature f) {
                SimpleFeature feature = (SimpleFeature) f;
                String name = (String) feature.getAttribute("name");
                assertEquals( "jody \ngarnett", name );
            }
View Full Code Here

        SimpleFeatureSource table = storeTable.getFeatureSource( "table" );
        //GenericEntity.f004=description-f004|name-f004
        FeatureId fid1 = ff.featureId("GenericEntity.f004");
        Filter select = ff.id( Collections.singleton(fid1));
        SimpleFeatureCollection featureCollection = table.getFeatures( select );
        featureCollection.accepts(new FeatureVisitor() {
            public void visit(Feature f) {
                SimpleFeature feature = (SimpleFeature) f;
                String name = (String) feature.getAttribute("name");
                assertEquals( "name-f004", name );
            }
View Full Code Here

        },null);
        //GenericEntity.f003=description-f003|<null>
        fid1 = ff.featureId("GenericEntity.f003");
        select = ff.id( Collections.singleton(fid1));
        featureCollection = table.getFeatures( select );
        featureCollection.accepts(new FeatureVisitor() {
            public void visit(Feature f) {
                SimpleFeature feature = (SimpleFeature) f;
                String name = (String) feature.getAttribute("name");
                System.out.println( name );
                assertNull( "represent null", name );
View Full Code Here

        },null);
        //GenericEntity.f007=description-f007|
        fid1 = ff.featureId("GenericEntity.f007");
        select = ff.id( Collections.singleton(fid1));
        featureCollection = table.getFeatures( select );
        featureCollection.accepts(new FeatureVisitor() {
            public void visit(Feature f) {
                SimpleFeature feature = (SimpleFeature) f;
                String name = (String) feature.getAttribute("name");
                assertEquals( "represent empty string", "", name );
            }
View Full Code Here

        },null);
        //"  GenericEntity.f009=description-f009| "
        fid1 = ff.featureId("GenericEntity.f009");
        select = ff.id( Collections.singleton(fid1));
        featureCollection = table.getFeatures( select );
        featureCollection.accepts(new FeatureVisitor() {
            public void visit(Feature f) {
                SimpleFeature feature = (SimpleFeature) f;
                String name = (String) feature.getAttribute("name");
                assertEquals( "represent empty string", " ", name );
            }
View Full Code Here

            if (fs instanceof ContentFeatureSource)
                ((ContentFeatureSource) fs).accepts(query, function, null);
            else {
                final SimpleFeatureCollection collection = fs.getFeatures(query);
                collection.accepts(function, null);

            }
        } finally {
            lock.unlock();
        }
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.