Examples of RevFeature


Examples of org.locationtech.geogig.api.RevFeature

                    }
                }
                if (ref.isPresent()) {
                    org.locationtech.geogig.api.Node nodeRef = ref.get();

                    RevFeature revFeature = index.getDatabase().getFeature(nodeRef.getObjectId());
                    String id = NodeRef.nodeFromPath(nodeRef.getName());
                    Feature feature = featureBuilder.build(id, revFeature);

                    Point p = (Point) ((SimpleFeature) feature).getAttribute("location");
                    if (p != null) {
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

                             */"WORK_HEAD" + ":" + path).call(RevFeature.class);
        assertTrue(feature.isPresent());

        Feature mergedFeature = feature(pointsType, idP1, "StringProp1_2", new Integer(2000),
                "POINT(1 1)");
        RevFeature expected = RevFeatureBuilder.build(mergedFeature);
        assertEquals(expected, feature.get());

    }
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

        }
    }

    @Test
    public void testBuildFull() throws Exception {
        RevFeature feature = RevFeatureBuilder.build(points1);

        ImmutableList<Optional<Object>> values = feature.getValues();

        assertEquals(values.size(), points1.getProperties().size());

        for (Property prop : points1.getProperties()) {
            assertTrue(values.contains(Optional.fromNullable(prop.getValue())));
        }

        RevFeature feature2 = RevFeatureBuilder.build(lines1);

        values = feature2.getValues();

        assertEquals(values.size(), lines1.getProperties().size());

        for (Property prop : lines1.getProperties()) {
            assertTrue(values.contains(Optional.fromNullable(prop.getValue())));
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

                .setStrategy(Strategy.FEATURES_ONLY).call();

        FeatureMapFlusher flusher = new FeatureMapFlusher(workingTree());
        while (iter.hasNext()) {
            NodeRef node = iter.next();
            RevFeature revFeature = command(RevObjectParse.class).setObjectId(node.objectId())
                    .call(RevFeature.class).get();
            RevFeatureType revFeatureType = command(RevObjectParse.class)
                    .setObjectId(node.getMetadataId()).call(RevFeatureType.class).get();
            List<PropertyDescriptor> descriptors = revFeatureType.sortedDescriptors();
            ImmutableList<Optional<Object>> values = revFeature.getValues();
            SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(
                    (SimpleFeatureType) revFeatureType.type());
            String id = null;
            for (int i = 0; i < descriptors.size(); i++) {
                PropertyDescriptor descriptor = descriptors.get(i);
                if (descriptor.getName().getLocalPart().equals("id")) {
                    id = values.get(i).get().toString();
                }
                Optional<Object> value = values.get(i);
                featureBuilder.set(descriptor.getName(), value.orNull());
            }
            Preconditions.checkNotNull(id, "No 'id' attribute found");
            SimpleFeature feature = featureBuilder.buildFeature(id);
            unmapFeature(feature, flusher);

        }

        flusher.flushAll();

        // The above code will unmap all added or modified elements, but not deleted ones.
        // We now process the deletions, by comparing the current state of the mapped tree
        // with its state just after the mapping was created.

        if (entry.isPresent()) {
            Iterator<DiffEntry> diffs = command(DiffTree.class).setPathFilter(path)
                    .setNewTree(workingTree().getTree().getId())
                    .setOldTree(entry.get().getPostMappingId()).call();

            while (diffs.hasNext()) {
                DiffEntry diff = diffs.next();
                if (diff.changeType().equals(DiffEntry.ChangeType.REMOVED)) {

                    ObjectId featureId = diff.getOldObject().getNode().getObjectId();
                    RevFeature revFeature = command(RevObjectParse.class).setObjectId(featureId)
                            .call(RevFeature.class).get();
                    RevFeatureType revFeatureType = command(RevObjectParse.class)
                            .setObjectId(diff.getOldObject().getMetadataId())
                            .call(RevFeatureType.class).get();
                    List<PropertyDescriptor> descriptors = revFeatureType.sortedDescriptors();
                    ImmutableList<Optional<Object>> values = revFeature.getValues();
                    SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(
                            (SimpleFeatureType) revFeatureType.type());
                    String id = null;
                    for (int i = 0; i < descriptors.size(); i++) {
                        PropertyDescriptor descriptor = descriptors.get(i);
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

                Optional<RevFeatureType> opt = geogig.command(ResolveFeatureType.class)
                        .setRefSpec(ref).call();
                if (opt.isPresent()) {
                    RevFeatureType ft = opt.get();
                    ImmutableList<PropertyDescriptor> attribs = ft.sortedDescriptors();
                    RevFeature feature = (RevFeature) revObject;
                    Ansi ansi = super.newAnsi(console.getTerminal());
                    ansi.a(ref).newline();
                    ansi.a(feature.getId().toString()).newline();
                    ImmutableList<Optional<Object>> values = feature.getValues();
                    int i = 0;
                    for (Optional<Object> value : values) {
                        PropertyDescriptor attrib = attribs.get(i);
                        ansi.a(attrib.getName()).newline();
                        PropertyType attrType = attrib.getType();
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

                Optional<RevFeatureType> opt = geogig.command(ResolveFeatureType.class)
                        .setRefSpec(ref).call();
                if (opt.isPresent()) {
                    RevFeatureType ft = opt.get();
                    ImmutableList<PropertyDescriptor> attribs = ft.sortedDescriptors();
                    RevFeature feature = (RevFeature) revObject;
                    Ansi ansi = super.newAnsi(console.getTerminal());
                    ansi.newline().fg(Color.YELLOW).a("ID:  ").reset()
                            .a(feature.getId().toString()).newline();
                    ansi.fg(Color.YELLOW).a("FEATURE TYPE ID:  ").reset().a(ft.getId().toString())
                            .newline().newline();
                    ansi.a("ATTRIBUTES  ").newline();
                    ansi.a("----------  ").newline();
                    ImmutableList<Optional<Object>> values = feature.getValues();
                    int i = 0;
                    for (Optional<Object> value : values) {
                        ansi.fg(Color.YELLOW).a(attribs.get(i).getName() + ": ").reset();
                        ansi.a(value.or("[NULL]").toString()).newline();
                        i++;
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

        Optional<RevFeature> feature = getFeatureFromRefSpec();

        if (feature.isPresent()) {
            RevFeatureType featureType = getFeatureTypeFromRefSpec();
            RevFeature feat = feature.get();
            Envelope bounds = SpatialOps.boundsOf(feat);
            Node node = Node.create(NodeRef.nodeFromPath(ref), feat.getId(), featureType.getId(),
                    TYPE.FEATURE, bounds);
            return Optional.of(new NodeRef(node, NodeRef.parentPath(ref), featureType.getId()));

        } else {
            return Optional.absent();
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

        Function<NodeRef, EntityContainer> function = new Function<NodeRef, EntityContainer>() {

            @Override
            @Nullable
            public EntityContainer apply(@Nullable NodeRef ref) {
                RevFeature revFeature = geogig.command(RevObjectParse.class)
                        .setObjectId(ref.objectId()).call(RevFeature.class).get();
                SimpleFeatureType featureType;
                if (ref.path().startsWith(OSMUtils.NODE_TYPE_NAME)) {
                    featureType = OSMUtils.nodeType();
                } else {
                    featureType = OSMUtils.wayType();
                }
                SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType);
                RevFeatureType revFeatureType = RevFeatureTypeImpl.build(featureType);
                List<PropertyDescriptor> descriptors = revFeatureType.sortedDescriptors();
                ImmutableList<Optional<Object>> values = revFeature.getValues();
                for (int i = 0; i < descriptors.size(); i++) {
                    PropertyDescriptor descriptor = descriptors.get(i);
                    Optional<Object> value = values.get(i);
                    featureBuilder.set(descriptor.getName(), value.orNull());
                }
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

        try {
            feature = super.feature(pointsType, id, id, index, point(index));
        } catch (ParseException e) {
            throw Throwables.propagate(e);
        }
        RevFeature revFeature = RevFeatureBuilder.build(feature);
        db.put(revFeature);
        Envelope bounds = (Envelope) feature.getBounds();
        return Node.create(id, revFeature.getId(), ObjectId.NULL, TYPE.FEATURE, bounds);
    }
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

        return rtb.build();
    }

    @Test
    public void TestCatFeatureObject() {
        RevFeature feature = RevFeatureBuilder.build(points1);
        CharSequence desc = geogig.command(CatObject.class)
                .setObject(Suppliers.ofInstance(feature)).call();
        String[] lines = desc.toString().split("\n");

        assertEquals(points1.getProperties().size() + 2, lines.length);
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.