Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureSource


       
        AddFeatureCommand command=new AddFeatureCommand(feature, layer);
       
        command.setMap(map);
        command.run(new NullProgressMonitor());
        SimpleFeatureSource source = layer.getResource(SimpleFeatureSource.class, new NullProgressMonitor());
        assertEquals(3, source.getCount(Query.ALL));
       
        command.rollback(new NullProgressMonitor());
        FeatureCollection<SimpleFeatureType, SimpleFeature> collection = source.getFeatures();
        int i=0;
        for( FeatureIterator<SimpleFeature> iter = collection.features(); iter.hasNext(); ) {
            iter.next();
            i++;
        }
View Full Code Here


            return adaptee.cast(this);
        }
        if (adaptee.isAssignableFrom(SimpleFeatureStore.class)) {
            JDBCDataStore dataStore = getService().getDS(monitor);

            SimpleFeatureSource fs = dataStore.getFeatureSource(typename);

            if (fs instanceof SimpleFeatureStore){
                return adaptee.cast(fs);
            }
            if (adaptee.isAssignableFrom(SimpleFeatureSource.class)) {
View Full Code Here

        }
        if (adaptee.isAssignableFrom(IGeoResourceInfo.class)) {
            return adaptee.cast(createInfo(monitor));
        }
        if (adaptee.isAssignableFrom(SimpleFeatureStore.class)) {
            SimpleFeatureSource fs = featureSource(monitor);
            if (fs instanceof SimpleFeatureStore) {
                return adaptee.cast(fs);
            }
        }
        if (adaptee.isAssignableFrom(SimpleFeatureStore.class)) {
            SimpleFeatureSource fs = featureSource(monitor);
            if (fs instanceof SimpleFeatureStore) {
                return adaptee.cast(fs);
            }
        }
        if (adaptee.isAssignableFrom(SimpleFeatureSource.class)) {
View Full Code Here

        return parent.getDS(monitor).getFeatureSource();
    }

   
    public Style style( IProgressMonitor monitor ) throws IOException {
        SimpleFeatureSource source  = featureSource(null);

        SimpleFeatureType featureType = source.getSchema();
       
        ID fileID = parent.getID();
        if( !fileID.isFile() ){
            return null; // we are only checking for sidecar files
        }
View Full Code Here

        // Align bound to square size and expand by 150%
        bounds = align(bounds, size, 1.6);

        // Create grid for given bounds
        SimpleFeatureSource grid = Grids.createSquareGrid(bounds, size);

        // Finished
        return grid.getFeatures(filter).features();
    }
View Full Code Here

   
    public void op(final Display display, Object target, final IProgressMonitor monitor)
            throws Exception {
        final IGeoResource handle = (IGeoResource) target;
        final SimpleFeatureSource featureSource = handle.resolve( SimpleFeatureSource.class, null);
        SimpleFeature feature;
        final FeatureCollection<SimpleFeatureType, SimpleFeature> collection = featureSource
                .getFeatures();
        FeatureIterator<SimpleFeature> iterator = collection.features();
        try {
            if (!iterator.hasNext()) {
                return; // no contents ... ignore
View Full Code Here

        ILayer[] layers = (ILayer[]) target;

        for( ILayer iLayer : layers ) {
            final IGeoResource geoResource = iLayer.getGeoResource();
            if (geoResource.canResolve(FeatureSource.class)) {
                SimpleFeatureSource lineSource = (SimpleFeatureSource) geoResource.resolve(FeatureSource.class, monitor);
                SimpleFeatureCollection featureCollection = lineSource.getFeatures(iLayer.getFilter());
                GeometryDescriptor geometryDescriptor = featureCollection.getSchema().getGeometryDescriptor();
                if (!SLD.isLine(geometryDescriptor)) {
                    break;
                }
                SimpleFeatureIterator featureIterator = featureCollection.features();
View Full Code Here

            return adaptee.cast(this);
        if (adaptee.isAssignableFrom(IGeoResourceInfo.class))
            return adaptee.cast(createInfo(monitor));
        if (adaptee.isAssignableFrom(SimpleFeatureStore.class)) {
            DataStore dataStore = getDataStore(monitor);
            SimpleFeatureSource fs;
            fs = dataStore.getFeatureSource(typename);

            if (fs instanceof SimpleFeatureStore) {
                return adaptee.cast(fs);
            }
View Full Code Here

       * Write the features to the shapefile
       */
      Transaction transaction = new DefaultTransaction("create");

      String typeName = newDataStore.getTypeNames()[0];
      SimpleFeatureSource featureSource = newDataStore
          .getFeatureSource(typeName);

      if (featureSource instanceof SimpleFeatureStore) {
        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;

View Full Code Here

        FileDataStore srcStore = null;
        try {
            // read the shape file and put it into a SimpeFeatureCollection
            srcStore = createDatastore(srcShapeFile);
           
            SimpleFeatureSource featureSource = srcStore.getFeatureSource();
            SimpleFeatureCollection sfc = (SimpleFeatureCollection) featureSource.getFeatures();
            return enrichAndAddFeatures(sfc, dstPg, layer, year, month, day, true);
        } catch (IOException ex) {
            throw new PostGisException("Error copying features: " + ex.getMessage(), ex);
        } finally {
            quietDisposeStore(srcStore);
View Full Code Here

TOP

Related Classes of org.geotools.data.simple.SimpleFeatureSource

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.