Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.Node$TreeNode


        final Envelope bounds = (ReferencedEnvelope) feature.getBounds();
        final String nodeName = feature.getIdentifier().getID();

        indexDatabase.put(newFeature);

        Node newObject = Node.create(nodeName, objectId, metadataId, TYPE.FEATURE, bounds);
        return newObject;
    }
View Full Code Here


    public ObjectId insert(GeogigTransaction transaction, Feature f) throws Exception {
        final WorkingTree workTree = (transaction != null ? transaction.workingTree() : repo
                .workingTree());
        Name name = f.getType().getName();
        String parentPath = name.getLocalPart();
        Node ref = workTree.insert(parentPath, f);
        ObjectId objectId = ref.getObjectId();
        return objectId;
    }
View Full Code Here

        Set<ObjectId> metadataIds = new HashSet<ObjectId>();

        final ObjectId ret;
        if (objectRef != null) {
            Node ref = objectRef.get();
            ret = ref.getObjectId();
            deepMove(ref, from, to, metadataIds);
        } else if (objectId != null) {
            ObjectId id = objectId.get();
            moveObject(id, from, to);
            ret = id;
View Full Code Here

            Envelope treeBounds = null;
            if (!metadataId.isNull()) {// only include bounds for trees with a default feature type
                treeBounds = SpatialOps.boundsOf(childTree);
            }
            String childName = childPath;
            Node treeNode = Node.create(childName, treeId, metadataId, TYPE.TREE, treeBounds);
            ancestor.put(treeNode);
            RevTree newAncestor = ancestor.build();
            targetDatabase.put(newAncestor);
            return newAncestor.getId();
        }

        final String parentPath = NodeRef.parentPath(childPath);
        Optional<NodeRef> parentRef = getTreeChild(ancestor, parentPath);
        RevTreeBuilder parentBuilder;
        ObjectId parentMetadataId = ObjectId.NULL;
        if (parentRef.isPresent()) {
            ObjectId parentId = parentRef.get().objectId();
            parentMetadataId = parentRef.get().getMetadataId();
            parentBuilder = getTree(parentId, targetDatabase).builder(targetDatabase);
        } else {
            parentBuilder = RevTree.EMPTY.builder(targetDatabase);
        }

        String childName = NodeRef.nodeFromPath(childPath);
        Envelope treeBounds = null;
        if (!metadataId.isNull()) {// only include bounds for trees with a default feature type
            treeBounds = SpatialOps.boundsOf(childTree);
        }
        Node treeNode = Node.create(childName, treeId, metadataId, TYPE.TREE, treeBounds);
        parentBuilder.put(treeNode);
        RevTree parent = parentBuilder.build();

        return writeBack(ancestor, ancestorPath, parent, parentPath, targetDatabase,
                parentMetadataId);
View Full Code Here

        TreeDifference treeDifference = computeTreeDifference();

        if (treeDifference.areEqual()) {
            MutableTree leftTree = treeDifference.getLeftTree();
            Node leftNode = leftTree.getNode();
            ObjectId leftOid = leftNode.getObjectId();
            return leftOid;
        }

        final MutableTree oldLeftTree = treeDifference.getLeftTree().clone();
        Preconditions.checkState(oldLeftTree.equals(treeDifference.getLeftTree()));
View Full Code Here

            ignoreList.add(path);
            if (!filterMatchesOrIsParent(path)) {
                if (filterApplies(path, treeDifference.getRightTree())) {
                    // can't optimize
                    RevTree newTree = applyChanges(ref, null);
                    Node newNode = Node.tree(ref.name(), newTree.getId(), ref.getMetadataId());
                    MutableTree leftTree = treeDifference.getLeftTree();
                    leftTree.forceChild(ref.getParentPath(), newNode);
                }
            } else {
                MutableTree leftTree = treeDifference.getLeftTree();
View Full Code Here

            if (!filterMatchesOrIsParent(path)) {
                MutableTree rightTree = treeDifference.getRightTree();
                if (filterApplies(path, rightTree)) {
                    // can't optimize
                    RevTree newTree = applyChanges(null, ref);
                    Node newNode = Node.tree(ref.name(), newTree.getId(), ref.getMetadataId());
                    MutableTree leftTree = treeDifference.getLeftTree();
                    leftTree.forceChild(ref.getParentPath(), newNode);
                }
            } else {
                LOGGER.trace("Creating new tree {}", path);
                deepMove(ref.getNode());
                MutableTree leftTree = treeDifference.getLeftTree();
                String parentPath = ref.getParentPath();
                Node node = ref.getNode();
                leftTree.setChild(parentPath, node);
            }
        }
    }
View Full Code Here

            }
            ignoreList.add(newPath);
            RevTree tree = applyChanges(leftTreeRef, rightTreeRef);

            Envelope bounds = SpatialOps.boundsOf(tree);
            Node newTreeNode = Node.create(rightTreeRef.name(), tree.getId(),
                    rightTreeRef.getMetadataId(), TYPE.TREE, bounds);

            MutableTree leftRoot = treeDifference.getLeftTree();
            String parentPath = rightTreeRef.getParentPath();
            leftRoot.setChild(parentPath, newTreeNode);
View Full Code Here

            final DiffEntry diff = iterator.next();
            if (diff.isDelete()) {
                builder.remove(diff.oldName());
            } else {
                NodeRef newObject = diff.getNewObject();
                Node node = newObject.getNode();
                builder.put(node);
            }
        }

        final RevTree newTree = builder.build();
View Full Code Here

        @Override
        public void funnel(RevTree from, PrimitiveSink into) {
            RevObjectTypeFunnel.funnel(TYPE.TREE, into);
            if (from.trees().isPresent()) {
                ImmutableList<Node> trees = from.trees().get();
                Node ref;
                for (int i = 0; i < trees.size(); i++) {
                    ref = trees.get(i);
                    NodeFunnel.funnel(ref, into);
                }
            }
            if (from.features().isPresent()) {
                ImmutableList<Node> children = from.features().get();
                Node ref;
                for (int i = 0; i < children.size(); i++) {
                    ref = children.get(i);
                    NodeFunnel.funnel(ref, into);
                }
            }
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.Node$TreeNode

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.