Examples of RevFeatureType


Examples of org.locationtech.geogig.api.RevFeatureType

                                    .setChildPath(input.getPath()).call();
                        } else {
                            throw new CommandSpecException("Couldn't resolve commit's treeId");
                        }

                        RevFeatureType type = null;
                        RevFeature feature = null;

                        if (node.isPresent()) {
                            object = geogig.command(RevObjectParse.class)
                                    .setObjectId(node.get().getMetadataId()).call();
                            if (object.isPresent() && object.get() instanceof RevFeatureType) {
                                type = (RevFeatureType) object.get();
                            } else {
                                throw new CommandSpecException(
                                        "Couldn't resolve newCommit's featureType");
                            }
                            object = geogig.command(RevObjectParse.class)
                                    .setObjectId(node.get().objectId()).call();
                            if (object.isPresent() && object.get() instanceof RevFeature) {
                                feature = (RevFeature) object.get();
                            } else {
                                throw new CommandSpecException(
                                        "Couldn't resolve newCommit's feature");
                            }
                        }

                        GeometryConflict conflict = null;

                        if (feature != null && type != null) {
                            String crsCode = null;
                            Collection<PropertyDescriptor> attribs = type.type().getDescriptors();

                            for (PropertyDescriptor attrib : attribs) {
                                PropertyType attrType = attrib.getType();
                                if (attrType instanceof GeometryType) {
                                    GeometryType gt = (GeometryType) attrType;
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeatureType

                new Function<FeatureInfo, GeometryChange>() {
                    @Override
                    public GeometryChange apply(FeatureInfo input) {
                        GeometryChange change = null;
                        RevFeature revFeature = RevFeatureBuilder.build(input.getFeature());
                        RevFeatureType featureType = input.getFeatureType();
                        Collection<PropertyDescriptor> attribs = featureType.type()
                                .getDescriptors();
                        String crsCode = null;

                        for (PropertyDescriptor attrib : attribs) {
                            PropertyType attrType = attrib.getType();
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeatureType

    private static Iterator<SimpleFeature> getFeatures(Iterator<DiffEntry> diffs,
            final boolean old, final ObjectDatabase database, final ObjectId metadataId,
            final ProgressListener progressListener) {

        final SimpleFeatureType featureType = addFidAttribute(database.getFeatureType(metadataId));
        final RevFeatureType revFeatureType = RevFeatureTypeImpl.build(featureType);
        final SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType);

        Function<DiffEntry, SimpleFeature> asFeature = new Function<DiffEntry, SimpleFeature>() {

            @Override
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeatureType

        final RevTree workHead = getTree();
        Optional<NodeRef> typeTreeRef = context.command(FindTreeChild.class).setIndex(true)
                .setParent(workHead).setChildPath(treePath).call();

        final RevFeatureType revType = RevFeatureTypeImpl.build(featureType);
        if (typeTreeRef.isPresent()) {
            throw new IllegalArgumentException("Tree already exists at " + treePath);
        }
        indexDatabase.put(revType);

        final ObjectId metadataId = revType.getId();
        final RevTree newTree = new RevTreeBuilder(indexDatabase).build();

        ObjectId newWorkHeadId = context.command(WriteBack.class).setToIndex(true)
                .setAncestor(workHead.builder(indexDatabase)).setChildPath(treePath)
                .setTree(newTree).setMetadataId(metadataId).call();
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeatureType

        Optional<NodeRef> typeTreeRef = context.command(FindTreeChild.class).setIndex(true)
                .setParent(getTree()).setChildPath(parentTreePath).call();
        ObjectId metadataId;
        if (typeTreeRef.isPresent()) {
            treeRef = typeTreeRef.get();
            RevFeatureType newFeatureType = RevFeatureTypeImpl.build(featureType);
            metadataId = newFeatureType.getId().equals(treeRef.getMetadataId()) ? ObjectId.NULL
                    : newFeatureType.getId();
            if (!newFeatureType.getId().equals(treeRef.getMetadataId())) {
                indexDatabase.put(newFeatureType);
            }
        } else {
            treeRef = createTypeTree(parentTreePath, featureType);
            metadataId = ObjectId.NULL;// treeRef.getMetadataId();
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeatureType

        Preconditions.checkArgument(typeTreeRef.isPresent(), "Tree does not exist: %s", treePath);

        Iterator<NodeRef> iter = context.command(LsTreeOp.class).setReference(treePath)
                .setStrategy(Strategy.DEPTHFIRST_ONLY_FEATURES).call();

        final RevFeatureType revType = RevFeatureTypeImpl.build(featureType);
        indexDatabase.put(revType);

        final ObjectId metadataId = revType.getId();
        RevTreeBuilder treeBuilder = new RevTreeBuilder(indexDatabase);

        final RevTree newTree = treeBuilder.build();
        ObjectId newWorkHeadId = context.command(WriteBack.class).setToIndex(true)
                .setAncestor(workHead.builder(indexDatabase)).setChildPath(treePath)
                .setTree(newTree).setMetadataId(metadataId).call();
        updateWorkHead(newWorkHeadId);

        Map<ObjectId, FeatureBuilder> featureBuilders = Maps.newHashMap();
        while (iter.hasNext()) {
            NodeRef noderef = iter.next();
            RevFeature feature = context.command(RevObjectParse.class)
                    .setObjectId(noderef.objectId()).call(RevFeature.class).get();
            if (!featureBuilders.containsKey(noderef.getMetadataId())) {
                RevFeatureType ft = context.command(RevObjectParse.class)
                        .setObjectId(noderef.getMetadataId()).call(RevFeatureType.class).get();
                featureBuilders.put(noderef.getMetadataId(), new FeatureBuilder(ft));
            }
            FeatureBuilder fb = featureBuilders.get(noderef.getMetadataId());
            String parentPath = NodeRef.parentPath(NodeRef.appendChild(treePath, noderef.path()));
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeatureType

        importOp.setDestinationPath("table");
        importOp.call();
        Optional<RevFeature> feature = geogig.command(RevObjectParse.class)
                .setRefSpec("WORK_HEAD:table/feature1").call(RevFeature.class);
        assertTrue(feature.isPresent());
        RevFeatureType originalFeatureType = geogig.command(ResolveFeatureType.class)
                .setRefSpec("WORK_HEAD:table/feature1").call().get();
        importOp.setTable("shpLikeTable2");
        importOp.call();
        feature = geogig.command(RevObjectParse.class).setRefSpec("WORK_HEAD:table/feature1")
                .call(RevFeature.class);
        assertTrue(feature.isPresent());
        RevFeatureType featureType = geogig.command(ResolveFeatureType.class)
                .setRefSpec("WORK_HEAD:table/feature1").call().get();
        assertEquals(originalFeatureType.getId(), featureType.getId());
        GeometryFactory gf = new GeometryFactory();
        ImmutableList<Optional<Object>> values = feature.get().getValues();
        assertEquals(values.get(0).get(), gf.createPoint(new Coordinate(0, 7)));
        assertEquals(values.get(1).get(), 3.2);
        assertEquals(values.get(2).get(), 1100.0);
        importOp.setTable("GeoJsonLikeTable");
        importOp.call();
        feature = geogig.command(RevObjectParse.class).setRefSpec("WORK_HEAD:table/feature1")
                .call(RevFeature.class);
        assertTrue(feature.isPresent());
        featureType = geogig.command(ResolveFeatureType.class)
                .setRefSpec("WORK_HEAD:table/feature1").call().get();
        assertEquals(originalFeatureType.getId(), featureType.getId());
        values = feature.get().getValues();
        assertEquals(values.get(0).get(), gf.createPoint(new Coordinate(0, 8)));
        assertEquals(values.get(1).get(), 4.2);
        assertEquals(values.get(2).get(), 1200.0);
    }
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeatureType

        insertAndAdd(points1);
        ObjectId id = RevFeatureTypeImpl.build(pointsType).getId();
        geogig.command(AddOp.class).addPattern(".").call();
        RevCommit commit = geogig.command(CommitOp.class).call();
        assertNotNull(commit);
        RevFeatureType type = geogig.getRepository().objectDatabase().getFeatureType(id);
        assertEquals(id, type.getId());
    }
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeatureType

                            .setOldVersion(Suppliers.ofInstance(diffEntry.getOldObject())).call();
                    Map<PropertyDescriptor, AttributeDiff> diffs = featureDiff.getDiffs();
                    HashSet<PropertyDescriptor> diffDescriptors = Sets.newHashSet(diffs.keySet());
                    NodeRef noderef = diffEntry.changeType() != ChangeType.REMOVED ? diffEntry
                            .getNewObject() : diffEntry.getOldObject();
                    RevFeatureType featureType = geogig.command(RevObjectParse.class)
                            .setObjectId(noderef.getMetadataId()).call(RevFeatureType.class).get();
                    Optional<RevObject> obj = geogig.command(RevObjectParse.class)
                            .setObjectId(noderef.objectId()).call();
                    RevFeature feature = (RevFeature) obj.get();
                    ImmutableList<Optional<Object>> values = feature.getValues();
                    ImmutableList<PropertyDescriptor> descriptors = featureType.sortedDescriptors();
                    int idx = 0;
                    for (PropertyDescriptor descriptor : descriptors) {
                        if (diffs.containsKey(descriptor)) {
                            AttributeDiff ad = diffs.get(descriptor);
                            sb.append(ad.getType().toString().charAt(0) + " "
                                    + descriptor.getName().toString() + LINE_BREAK);
                            if (!ad.getType().equals(TYPE.ADDED)) {
                                Object value = ad.getOldValue().orNull();
                                sb.append(TextValueSerializer.asString(Optional.fromNullable(value)));
                                sb.append(LINE_BREAK);
                            }
                            if (!ad.getType().equals(TYPE.REMOVED)) {
                                Object value = ad.getNewValue().orNull();
                                sb.append(TextValueSerializer.asString(Optional.fromNullable(value)));
                                sb.append(LINE_BREAK);
                            }
                            diffDescriptors.remove(descriptor);
                        } else {
                            sb.append("U ").append(descriptor.getName().toString())
                                    .append(LINE_BREAK);
                            sb.append(TextValueSerializer.asString(values.get(idx))).append(
                                    LINE_BREAK);
                        }
                        idx++;
                    }
                    for (PropertyDescriptor descriptor : diffDescriptors) {
                        AttributeDiff ad = diffs.get(descriptor);
                        sb.append(ad.getType().toString().charAt(0) + " "
                                + descriptor.getName().toString() + LINE_BREAK);
                        if (!ad.getType().equals(TYPE.ADDED)) {
                            Object value = ad.getOldValue().orNull();
                            sb.append(TextValueSerializer.asString(Optional.fromNullable(value)));
                            sb.append(LINE_BREAK);
                        }
                        if (!ad.getType().equals(TYPE.REMOVED)) {
                            Object value = ad.getNewValue().orNull();
                            sb.append(TextValueSerializer.asString(Optional.fromNullable(value)));
                            sb.append(LINE_BREAK);
                        }
                    }
                } else {
                    NodeRef noderef = diffEntry.changeType() == ChangeType.ADDED ? diffEntry
                            .getNewObject() : diffEntry.getOldObject();
                    RevFeatureType featureType = geogig.command(RevObjectParse.class)
                            .setObjectId(noderef.getMetadataId()).call(RevFeatureType.class).get();
                    Optional<RevObject> obj = geogig.command(RevObjectParse.class)
                            .setObjectId(noderef.objectId()).call();
                    RevFeature feature = (RevFeature) obj.get();
                    ImmutableList<Optional<Object>> values = feature.getValues();
                    int i = 0;
                    for (Optional<Object> value : values) {
                        sb.append(diffEntry.changeType().toString().charAt(0));
                        sb.append(' ');
                        sb.append(featureType.sortedDescriptors().get(i).getName().toString());
                        sb.append(LINE_BREAK);
                        sb.append(TextValueSerializer.asString(value));
                        sb.append(LINE_BREAK);
                        i++;
                    }
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeatureType

                }
            }
            console.println(ansi.toString());
        } else if (diffEntry.changeType() == ChangeType.ADDED) {
            NodeRef noderef = diffEntry.getNewObject();
            RevFeatureType featureType = geogig.command(RevObjectParse.class)
                    .setObjectId(noderef.getMetadataId()).call(RevFeatureType.class).get();
            Optional<RevObject> obj = geogig.command(RevObjectParse.class)
                    .setObjectId(noderef.objectId()).call();
            RevFeature feature = (RevFeature) obj.get();
            ImmutableList<Optional<Object>> values = feature.getValues();
            int i = 0;
            for (Optional<Object> value : values) {
                console.println(featureType.sortedDescriptors().get(i).getName() + "\t"
                        + TextValueSerializer.asString(value));

                i++;
            }
            console.println();
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.