Examples of FeatureId


Examples of org.opengis.filter.identity.FeatureId

     */
    public Feature build(final String id, final RevFeature revFeature) {
        Preconditions.checkNotNull(id);
        Preconditions.checkNotNull(revFeature);

        final FeatureId fid = new LazyVersionedFeatureId(id, revFeature.getId());

        ImmutableList<Optional<Object>> values = revFeature.getValues();
        GeogigSimpleFeature feature = new GeogigSimpleFeature(values,
                (SimpleFeatureType) featureType, fid, attNameToRevTypeIndex);
        return feature;
View Full Code Here

Examples of org.opengis.filter.identity.FeatureId

        Supplier<? extends List<Optional<Object>>> valueSupplier = new LazyFeatureLoader(
                node.getObjectId(), parser);

        valueSupplier = Suppliers.memoize(valueSupplier);

        final FeatureId fid = new LazyVersionedFeatureId(id, node.getObjectId());

        GeogigSimpleFeature feature = new GeogigSimpleFeature(valueSupplier,
                (SimpleFeatureType) featureType, fid, attNameToRevTypeIndex, node);

        return feature;
View Full Code Here

Examples of org.opengis.filter.identity.FeatureId

        Set<FeatureId> ids = Sets.newHashSet();
        try {
            while (features.hasNext()) {
                SimpleFeature next = features.next();
                FeatureId identifier = next.getIdentifier();
                ids.add(identifier);
            }
        } finally {
            features.close();
        }
View Full Code Here

Examples of org.opengis.filter.identity.FeatureId

        try {
            List<FeatureId> newFids = points.addFeatures(collection);
            assertNotNull(newFids);
            assertEquals(3, newFids.size());

            FeatureId fid1 = newFids.get(0);
            FeatureId fid2 = newFids.get(1);
            FeatureId fid3 = newFids.get(2);

            // new ids should have been generated...
            assertFalse(idP1.equals(fid1.getID()));
            assertFalse(idP1.equals(fid1.getID()));
            assertFalse(idP1.equals(fid1.getID()));

            // now force the use of provided feature ids
            points1.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
            points2.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
            points3.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);

            List<FeatureId> providedFids = points.addFeatures(collection);
            assertNotNull(providedFids);
            assertEquals(3, providedFids.size());

            FeatureId fid11 = providedFids.get(0);
            FeatureId fid21 = providedFids.get(1);
            FeatureId fid31 = providedFids.get(2);

            // ids should match provided
            assertEquals(idP1, fid11.getID());
            assertEquals(idP2, fid21.getID());
            assertEquals(idP3, fid31.getID());

            tx.commit();

            assertEquals(1, points.getFeatures(ff.id(Collections.singleton(fid1))).size());
            assertEquals(1, points.getFeatures(ff.id(Collections.singleton(fid2))).size());
View Full Code Here

Examples of org.opengis.filter.identity.FeatureId

        FeatureEvent e = listener1.list.get(0);
        Id id = (Id) e.getFilter();
        assertTrue(id.getIdentifiers().containsAll(newFids));
        // remember the FeatureId with a strong reference
        FeatureId tempFeatureId = (FeatureId) id.getIdentifiers().iterator().next();
        assertTrue(newFids.contains(tempFeatureId));

        t1.commit();
        assertEquals(1, listener.list.size());
        assertEquals(2, listener1.list.size());

        BatchFeatureEvent batch = (BatchFeatureEvent) listener1.list.get(2);
        assertFalse("confirm tempFid is not in the commit",
                id.getIdentifiers().contains(tempFeatureId));
        assertNotNull(batch.getFilter());

        FeatureId featureId = (FeatureId) batch.getCreatedFeatureIds().iterator().next();
        assertSame("confirm temp feature Id was updated", tempFeatureId, featureId);
    }
View Full Code Here

Examples of org.opengis.filter.identity.FeatureId

    // FidFilter
    public Object visit(Id filter, Object extraData) {
        Data data = new Data();
        for( Identifier identifier : filter.getIdentifiers() ){
            FeatureId featureIdentifier = (FeatureId) identifier;
            data.fids.add( featureIdentifier.getID() );
        }
        current.push(data);
        return extraData;
    }
View Full Code Here

Examples of org.opengis.filter.identity.FeatureId

        ShapefileDataStore ds = (ShapefileDataStore) fac.createDataStore(params);

        FilterFactory2 ff = (FilterFactory2) CommonFactoryFinder.getFilterFactory(GeoTools
                .getDefaultHints());

        FeatureId featureId = ff.featureId("streams.84");
        Id filter = ff.id(Collections.singleton(featureId));
        SimpleFeatureCollection features = ds.getFeatureSource().getFeatures(filter);

        SimpleFeatureIterator iter = features.features();
        ReferencedEnvelope bounds;
        try {
            bounds = new ReferencedEnvelope(iter.next().getBounds());
        } finally {
            iter.close();
        }

        FeatureId id = featureId;
        filter = ff.id(Collections.singleton(id));

        Query query = new Query(ds.getTypeNames()[0], filter);

        Envelope result = ds.getFeatureSource().getBounds(query);
View Full Code Here

Examples of org.opengis.filter.identity.FeatureId

    public Object getProperty(Object object, QName name) throws Exception {
        if (object == null) {
            return null;
        }

        final FeatureId fid = (FeatureId) object;
        final String localName = name.getLocalPart();
        if ("id".equals(localName)) {
            return fid.getID();
        }
        if ("rid".equals(localName)) {
            return fid.getRid();
        }
        if ("previousRid".equals(localName)) {
            return fid.getPreviousRid();
        }
        if ("version".equals(localName) && fid instanceof ResourceId) {
            return ((ResourceId) fid).getVersion();
        }
        if ("startDate".equals(localName) && fid instanceof ResourceId) {
View Full Code Here

Examples of org.opengis.filter.identity.FeatureId

        // creates both indexed and regular shapefile data store
        ShapefileDataStore indexedstore = new ShapefileDataStore(shpFile.toURI().toURL());

        // get a random feature id from one of the stores
        SimpleFeatureIterator it = indexedstore.getFeatureSource().getFeatures().features();
        FeatureId fid = it.next().getIdentifier();
        it.close();

        // query the datastore
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        Filter idFilter = ff.id(Collections.singleton(fid));
View Full Code Here

Examples of org.opengis.filter.identity.FeatureId

     *
     * @throws Exception
     */
    public void testMultiLine() throws Exception {
        SimpleFeatureSource road = store.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;
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.