Examples of MemoryFeatureCollection


Examples of org.geoserver.csw.feature.MemoryFeatureCollection

    }

    @Override
    public FeatureCollection<FeatureType, Feature> sort(SortBy order) {
        List<Feature> features = new ArrayList<Feature>();
        MemoryFeatureCollection memory = new MemoryFeatureCollection(getSchema(), features);
        return memory.sort(order);
    }
View Full Code Here

Examples of org.geoserver.csw.feature.MemoryFeatureCollection

    }

    @Override
    public FeatureCollection<FeatureType, Feature> sort(SortBy order) {
        List<Feature> features = new ArrayList<Feature>();
        MemoryFeatureCollection memory = new MemoryFeatureCollection(getSchema(), features);
        return memory.sort(order);
    }
View Full Code Here

Examples of org.geoserver.csw.feature.MemoryFeatureCollection

        if (q.getSortBy() != null && q.getSortBy().length > 0) {
            Feature[] features = (Feature[]) records.toArray(new Feature[records.size()]);
            Comparator<Feature> comparator = ComplexComparatorFactory.buildComparator(q.getSortBy());
            Arrays.sort(features, comparator);
           
            records = new MemoryFeatureCollection(records.getSchema(), Arrays.asList(features));
        }

        // max features
        if (q.getMaxFeatures() < Query.DEFAULT_MAX) {
            records = new MaxFeaturesFeatureCollection<FeatureType, Feature>(records,
View Full Code Here

Examples of org.geoserver.csw.feature.MemoryFeatureCollection

           
            @Override
            public FeatureCollection getRecordsInternal(RecordDescriptor rd, RecordDescriptor rdOutput,
                    Query q, Transaction t) throws IOException {
                if(rd == GSRecordDescriptor.getInstance()) {
                    return new MemoryFeatureCollection(GSRecordDescriptor.getInstance().getFeatureType());
                } else {
                    throw new RuntimeException("Was expecting the geoserver record descriptor");
                }
            }
        };
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

    List<String> attrs = (List<String>) model.get(RestController.ATTRIBUTES);
    SimpleFeatureType sft = convertorService.toSimpleFeatureType(info, attrs);
    response.setContentType(getContentType());
    if (Collection.class.isAssignableFrom(ff.getClass())) {
      Collection<InternalFeature> features = (Collection<InternalFeature>) ff;
      FeatureCollection<SimpleFeatureType, SimpleFeature> coll = new MemoryFeatureCollection(sft);
      for (InternalFeature feature : features) {
        coll.add(convertorService.toSimpleFeature(feature, sft));
      }
      parser.write(coll, response.getOutputStream());
    } else {
      InternalFeature feature = (InternalFeature) ff;
      parser.write(convertorService.toSimpleFeature(feature, sft), response.getOutputStream());
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

            errorMessage = new HashMap<String, String>();
            Geometry geometry = extractGeometriesFrom(
                    schemaDir, metadata, _parser, errorMessage);

            if (geometry != null && !geometry.getEnvelopeInternal().isNull()) {
                MemoryFeatureCollection features = new MemoryFeatureCollection(_featureStore.getSchema());
                SimpleFeatureType schema = _featureStore.getSchema();
               
                SimpleFeature template = SimpleFeatureBuilder.template(schema,
                        SimpleFeatureBuilder.createDefaultFeatureId());
                template.setAttribute(schema.getGeometryDescriptor().getName(), geometry);
                template.setAttribute(_idColumn == null? _IDS_ATTRIBUTE_NAME : _idColumn.toString(), id);
                features.add(template);

                _featureStore.addFeatures(features);

                _writes++;
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

            }
           
            //get the data from the source
            try{
                //cache these features in a local feature collection while we deal with them
                SimpleFeatureCollection localSource = new MemoryFeatureCollection(getSchema());
                fromSource = this.fs.getFeatures(filter);
                localSource.addAll(fromSource);
                fromSource = localSource;
            }catch (Exception ex){
                //something happened getting data from source
                //return what we have from the cache
                logger.log(Level.INFO, "Error getting data for cache from source feature store.", ex);
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

    ftb.add(LABEL_COLUMN, String.class);
    ftb.setName(MY_FEATURE);
        final SimpleFeatureType schema = ftb.buildFeatureType();

        // create a feature collection ----------------------------------------
        final MemoryFeatureCollection fc = new MemoryFeatureCollection(schema);

        // populate the collection --------------------------------------------
        final PrecisionModel pm = new PrecisionModel(PrecisionModel.FLOATING);
        final GeometryFactory jtsFactory = new GeometryFactory(pm, SRID);

        // create 1st point
        final Point g1 = jtsFactory.createPoint(new Coordinate(X_1, Y_1));
        fc.add(SimpleFeatureBuilder.build(schema, new Object[] { new Integer(1), g1, LABEL_1 }, ID_1));

        // create 2nd point
        final Point g2 = jtsFactory.createPoint(new Coordinate(X_2, Y_2));
        fc.add(SimpleFeatureBuilder.build(schema, new Object[] { new Integer(2), g2, LABEL_2 }, ID_2));

        final DataStore ds = new MemoryDataStore(fc);

        // create and populate the layer --------------------------------------
        final StyleFactory sf = CommonFactoryFinder.getStyleFactory(GeoTools.getDefaultHints());
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

        assertNotNull(source);
        assertTrue(source instanceof WFSFeatureStore);

        WFSFeatureStore store = (WFSFeatureStore) source;
                
        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());
       
View Full Code Here

Examples of org.geotools.data.memory.MemoryFeatureCollection

        assertNotNull(source);
        assertTrue(source instanceof WFSFeatureStore);

        WFSFeatureStore store = (WFSFeatureStore) source;
                
        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);       
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.