Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.RevFeatureType


    }

    @Test
    public void testAddEmptyFeatureTypePatch() throws Exception {
        Patch patch = new Patch();
        RevFeatureType featureType = RevFeatureTypeImpl.build(pointsType);
        patch.addFeatureType(featureType);
        patch.addAlteredTree(new FeatureTypeDiff(pointsName, null, featureType.getId()));
        testPatch(patch);
    }
View Full Code Here


    }

    @Test
    public void testRemoveEmptyFeatureTypePatch() throws Exception {
        Patch patch = new Patch();
        RevFeatureType featureType = RevFeatureTypeImpl.build(pointsType);
        patch.addFeatureType(featureType);
        patch.addAlteredTree(new FeatureTypeDiff(pointsName, featureType.getId(), null));
        testPatch(patch);
    }
View Full Code Here

        RevTree fakenId = forceTreeId(b, treeId);
        if (!db.exists(fakenId.getId())) {
            db.put(fakenId);
        }
        if (!metadataId.isNull()) {
            RevFeatureType fakeType = new RevFeatureTypeImpl(metadataId, pointsType);
            if (!db.exists(fakeType.getId())) {
                db.put(fakeType);
            }
        }

        String name = NodeRef.nodeFromPath(path);
View Full Code Here

        Optional<NodeRef> nodeRef = geogig.command(FindTreeChild.class).setParent(revTree)
                .setChildPath(NodeRef.parentPath(path)).setIndex(true).call();
        Preconditions.checkArgument(nodeRef.isPresent(), "Invalid reference: %s",
                NodeRef.parentPath(path));

        RevFeatureType revFeatureType = geogig.command(RevObjectParse.class)
                .setObjectId(nodeRef.get().getMetadataId()).call(RevFeatureType.class).get();

        RevFeature revFeature = geogig.command(RevObjectParse.class).setObjectId(objectId)
                .call(RevFeature.class).get();

        CoordinateReferenceSystem crs = revFeatureType.type().getCoordinateReferenceSystem();
        Envelope bounds = ReferencedEnvelope.create(crs);

        Optional<Object> o;
        for (int i = 0; i < revFeature.getValues().size(); i++) {
            o = revFeature.getValues().get(i);
View Full Code Here

                    .setRefSpec(ref.get().getMetadataId().toString()).call();
        } else {
            throw new CommandSpecException("Couldn't resolve the given path.");
        }
        if (type.isPresent() && type.get() instanceof RevFeatureType) {
            RevFeatureType featureType = (RevFeatureType) type.get();
            Collection<PropertyDescriptor> attribs = featureType.type().getDescriptors();
            int attributeLength = attribs.size();
            for (PropertyDescriptor attrib : attribs) {
                response += "," + escapeCsv(attrib.getName().toString());
            }
            response += '\n';
View Full Code Here

        ObjectId newId = geogig.command(ResolveTreeish.class).setTreeish(newTreeish).call().get();

        ObjectId oldId = geogig.command(ResolveTreeish.class).setTreeish(oldTreeish).call().get();

        RevFeature newFeature = null;
        RevFeatureType newFeatureType = null;

        RevFeature oldFeature = null;
        RevFeatureType oldFeatureType = null;

        final Map<PropertyDescriptor, AttributeDiff> diffs;

        Optional<NodeRef> ref = parseID(newId, geogig);

        Optional<RevObject> object;

        // need these to determine if the feature was added or removed so I can build the diffs
        // myself until the FeatureDiff supports null values
        boolean removed = false;
        boolean added = false;

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

        if (!oldId.equals(ObjectId.NULL)) {
            ref = parseID(oldId, geogig);

            if (ref.isPresent()) {
                object = geogig.command(RevObjectParse.class)
                        .setObjectId(ref.get().getMetadataId()).call();
                if (object.isPresent() && object.get() instanceof RevFeatureType) {
                    oldFeatureType = (RevFeatureType) object.get();
                } else {
                    throw new CommandSpecException("Couldn't resolve oldCommit's featureType");
                }
                object = geogig.command(RevObjectParse.class).setObjectId(ref.get().objectId())
                        .call();
                if (object.isPresent() && object.get() instanceof RevFeature) {
                    oldFeature = (RevFeature) object.get();
                } else {
                    throw new CommandSpecException("Couldn't resolve oldCommit's feature");
                }
            } else {
                added = true;
            }
        } else {
            added = true;
        }

        if (removed) {
            Map<PropertyDescriptor, AttributeDiff> tempDiffs = new HashMap<PropertyDescriptor, AttributeDiff>();
            ImmutableList<PropertyDescriptor> attributes = oldFeatureType.sortedDescriptors();
            ImmutableList<Optional<Object>> values = oldFeature.getValues();
            for (int index = 0; index < attributes.size(); index++) {
                Optional<Object> value = values.get(index);
                if (Geometry.class.isAssignableFrom(attributes.get(index).getType().getBinding())) {
                    Optional<Geometry> temp = Optional.absent();
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.RevFeatureType

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.