Package org.geotools.feature.simple

Examples of org.geotools.feature.simple.SimpleFeatureImpl


    List<AttributeDescriptor> attributeDescriptors = new ArrayList<AttributeDescriptor>();
    attributeDescriptors.add( geometryDescriptor );
    SimpleFeatureType featureType = new SimpleFeatureTypeImpl( new NameImpl( "test" ), attributeDescriptors, geometryDescriptor, false, null, null, null );
    List<Object> attributeValues = new ArrayList<Object>();
    attributeValues.add( null );
    this.feature = new SimpleFeatureImpl( attributeValues, featureType, new FeatureIdImpl( "test" ) );
  }
View Full Code Here


  public void setUp() throws Exception
  {
    this.geometryFactory = new GeometryFactory( new PrecisionModel( PrecisionModel.FLOATING ), 27700 );
   
    SimpleFeatureType featureType = new SimpleFeatureTypeImpl( new NameImpl( "test" ), null, null, false, null, null, null );
    Feature feature = new SimpleFeatureImpl( new ArrayList<Object>(), featureType, new FeatureIdImpl( "test" ) );
   
    this.limb = new Limb();
    this.limb.setEdges( new HashSet<Edge>() );
    this.limb.setFeature( feature );
    this.limb.setIntersection( this.geometryFactory.createPoint( new Coordinate( 0, 0 ) ) );
View Full Code Here

   
    SimpleFeatureType featureType = new SimpleFeatureTypeImpl( new NameImpl( "test" ),
                                                               Arrays.asList( attribute1, attribute2 ),
                                                               null, false, null, null, null );
   
    this.feature = new SimpleFeatureImpl( Arrays.asList( null, null ), featureType, new FeatureIdImpl( FEATURE_ID ) );
  }
View Full Code Here

    SimpleFeatureType featureType = new SimpleFeatureTypeImpl( new NameImpl( "test" ),
                                                               new ArrayList<AttributeDescriptor>( Arrays.asList( simpleTextAttribute, this.polygonGeomDescriptor ) ),
                                                               this.polygonGeomDescriptor,
                                                               false, null, null, null );
   
    this.feature1 = new SimpleFeatureImpl( new ArrayList<Object>( Arrays.asList( NO_VALUE, NO_GEOMETRY ) ),
                                           featureType,
                                           new FeatureIdImpl( "one" ) );
   
    this.polygons = new DefaultFeatureCollection( "poly", featureType );
    this.polygons.add( feature1 );
View Full Code Here

    List<AttributeDescriptor> attributeDescriptors = new ArrayList<AttributeDescriptor>();
    attributeDescriptors.add( geometryDescriptor );
    SimpleFeatureType featureType = new SimpleFeatureTypeImpl( new NameImpl( "test" ), attributeDescriptors, geometryDescriptor, false, null, null, null );
    List<Object> attributeValues = new ArrayList<Object>();
    attributeValues.add( null );
    this.feature = new SimpleFeatureImpl( attributeValues, featureType, new FeatureIdImpl( "test" ) );
  }
View Full Code Here

    public SimpleFeature createSimpleFeature(Object[] array,
            SimpleFeatureType type, String id) {
        if( type.isAbstract() ){
            throw new IllegalArgumentException("Cannot create an feature of an abstract FeatureType "+type.getTypeName());
        }
        return new SimpleFeatureImpl(array, type, ff.featureId(id), validating);
    }
View Full Code Here

    public void testAdd() throws FileNotFoundException, IOException {
        DataStore csv = this.getDataStore();
        SimpleFeatureStore rows = (SimpleFeatureStore) csv.getFeatureSource(TYPE_NAME);
        SimpleFeatureType featureType = csv.getSchema(TYPE_NAME);
        DefaultFeatureCollection toAdd = new DefaultFeatureCollection("test", featureType);
        SimpleFeature newFeature = new SimpleFeatureImpl(new Object[] {this.newPoint(new Coordinate(12, 34)), "Manhattan Beach", 444}, featureType, new FeatureIdImpl("test"), false);
        toAdd.add(newFeature);
        rows.addFeatures(toAdd);

        // re-open
        csv = this.getDataStore();
View Full Code Here

    public void testAddSeveral() throws FileNotFoundException, IOException {
        DataStore csv = this.getDataStore();
        SimpleFeatureStore rows = (SimpleFeatureStore) csv.getFeatureSource(TYPE_NAME);
        SimpleFeatureType featureType = csv.getSchema(TYPE_NAME);
        DefaultFeatureCollection toAdd = new DefaultFeatureCollection("test", featureType);
        SimpleFeature newFeature = new SimpleFeatureImpl(new Object[] {this.newPoint(new Coordinate(12, 34)), "Manhattan Beach", 444}, featureType, new FeatureIdImpl("test1"), false);
        toAdd.add(newFeature);
        newFeature = new SimpleFeatureImpl(new Object[] {this.newPoint(new Coordinate(56, 78)), "Hermosa Beach", 555}, featureType, new FeatureIdImpl("test2"), false);
        toAdd.add(newFeature);
        newFeature = new SimpleFeatureImpl(new Object[] {this.newPoint(new Coordinate(90, 12)), "Redondo Beach", 666}, featureType, new FeatureIdImpl("test3"), false);
        toAdd.add(newFeature);
        rows.addFeatures(toAdd);

        // re-open
        csv = this.getDataStore();
View Full Code Here

        MemoryFeatureCollection collection = new MemoryFeatureCollection(featureType1);
       
        Coordinate insideCoord = new Coordinate(5.2, 7.5);
        Point myPoint = geomfac.createPoint(insideCoord);
       
        SimpleFeature feat = new SimpleFeatureImpl(Arrays.asList(new Object[]{myPoint, "mypoint""pics/x.jpg", "pics/y.jpg"}), featureType1, new FeatureIdImpl("myid") );
       
        collection.add(feat);
       
        List<FeatureId> fids = store.addFeatures((SimpleFeatureCollection) collection);
       
        assertEquals(1, fids.size());
       
        ContentFeatureCollection coll = store.getFeatures();
        assertEquals(4, coll.size());
              
        coll = store.getFeatures( new Query(simpleTypeName1.getLocalPart(), filterfac.equals(filterfac.property("NAME"), filterfac.literal("mypoint"))) );
        assertEquals(1, coll.size());
       
        SimpleFeature feature = coll.features().next();
        assertEquals(feat.getAttributes(), feature.getAttributes());       
    }
View Full Code Here

        MemoryFeatureCollection collection = new MemoryFeatureCollection(featureType1);
       
        Coordinate insideCoord = new Coordinate(5.2, 7.5);
        Point myPoint = geomfac.createPoint(insideCoord);
       
        SimpleFeature feat = new SimpleFeatureImpl(Arrays.asList(new Object[]{myPoint, "mypoint""pics/x.jpg", "pics/y.jpg"}), featureType1, new FeatureIdImpl("myid") );
       
        collection.add(feat);
       
        Transaction transaction = new DefaultTransaction();
        store.setTransaction(transaction);
       
        List<FeatureId> fids = store.addFeatures((SimpleFeatureCollection) collection);       
        assertEquals(1, fids.size());
       
        Filter filterRemove = filterfac.id(filterfac.featureId("poi.2"));       
        store.removeFeatures(filterRemove);
       
        Filter filterUpdate = filterfac.id(filterfac.featureId("poi.3"));       
        store.modifyFeatures("NAME", "blah", filterUpdate);
               
        transaction.commit();
       
        ContentFeatureCollection coll = store.getFeatures();
        FeatureIterator it= coll.features();
        while (it.hasNext()) {
            System.err.println(it.next());
        }
        assertEquals(3, coll.size());
              
        coll = store.getFeatures( new Query(simpleTypeName1.getLocalPart(), filterfac.equals(filterfac.property("NAME"), filterfac.literal("mypoint"))) );
        it= coll.features();
        while (it.hasNext()) {
            System.err.println(it.next());
        }
        assertEquals(1, coll.size());       
       
        SimpleFeature feature = coll.features().next();
        assertEquals(feat.getAttributes(), feature.getAttributes());
       
        coll = store.getFeatures( new Query(simpleTypeName1.getLocalPart(), filterRemove) );
        assertEquals(0, coll.size());
       
        coll = store.getFeatures( new Query(simpleTypeName1.getLocalPart(), filterUpdate) );
View Full Code Here

TOP

Related Classes of org.geotools.feature.simple.SimpleFeatureImpl

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.