Package org.locationtech.geogig.api

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


        in.readFully(objectId);
        final byte[] metadataId = new byte[20];
        in.readFully(metadataId);
        final RevObject.TYPE contentType = RevObject.TYPE.valueOf(in.readByte());
        final Envelope bbox = readBBox(in);
        final Node node;
        node = Node.create(name, ObjectId.createNoClone(objectId),
                ObjectId.createNoClone(metadataId), contentType, bbox);
        return node;
    }
View Full Code Here


        return new DiffEntry(oldNodeRef, newNodeRef);
    }

    public static NodeRef readNodeRef(DataInput in) throws IOException {
        Node node = readNode(in);
        final byte[] metadataId = new byte[20];
        in.readFully(metadataId);
        String parentPath = in.readUTF();
        return new NodeRef(node, parentPath, ObjectId.createNoClone(metadataId));
    }
View Full Code Here

    /**
     * @return the resulting parent path after removing left and right from the stack, or
     *         {@code null} if left and/or right are a root tree.
     */
    public String endTree(@Nullable Node left, @Nullable Node right) {
        final Node popLeft = this.leftTrees.pop();
        final Node popRight = this.rightTrees.pop();
        try {
            Preconditions.checkState(Objects.equal(popLeft, left));
            Preconditions.checkState(Objects.equal(popRight, right));
        } catch (IllegalStateException e) {
            throw e;
View Full Code Here

            return;
        }
        // start by asking the consumer if go on with the walk at all with the
        // root nodes
        Envelope lbounds = SpatialOps.boundsOf(left);
        Node lnode = Node.create(NodeRef.ROOT, left.getId(), ObjectId.NULL, TYPE.TREE, lbounds);

        Envelope rbounds = SpatialOps.boundsOf(right);
        Node rnode = Node.create(NodeRef.ROOT, right.getId(), ObjectId.NULL, TYPE.TREE, rbounds);

        if (consumer.tree(lnode, rnode)) {
            traverseTree(consumer, left, right, 0);
        }
        consumer.endTree(lnode, rnode);
View Full Code Here

    private void traverseLeafLeaf(Consumer consumer, Iterator<Node> leftc, Iterator<Node> rightc) {
        PeekingIterator<Node> li = Iterators.peekingIterator(leftc);
        PeekingIterator<Node> ri = Iterators.peekingIterator(rightc);

        while (li.hasNext() && ri.hasNext()) {
            Node lpeek = li.peek();
            Node rpeek = ri.peek();
            int order = ORDER.compare(lpeek, rpeek);
            if (order < 0) {
                node(consumer, li.next(), null);// removal
            } else if (order == 0) {// change
                // same feature at both sides of the traversal, consume them and check if its
                // changed it or not
                Node l = li.next();
                Node r = ri.next();
                if (!l.equals(r)) {
                    node(consumer, l, r);
                }
            } else {
                node(consumer, null, ri.next());// addition
View Full Code Here

        toString(this, sb, 0);
        return sb.toString();
    }

    private void toString(MutableTree tree, StringBuilder sb, int indent) {
        Node node = tree.getNode();
        append(sb, node, indent);

        for (MutableTree c : tree.childTrees.values()) {
            toString(c, sb, indent + 1);
        }
View Full Code Here

            final Map<String, NodeRef> entries) {

        List<NodeRef> refsByDepth = Lists.newArrayList(entries.values());
        Collections.sort(refsByDepth, DEEPEST_LAST_COMPARATOR);

        Node rootNode = Node.create(ROOT, rootId, ObjectId.NULL, TYPE.TREE, null);
        MutableTree root = new MutableTree(rootNode);

        Envelope bounds = new Envelope();

        for (NodeRef entry : refsByDepth) {
            Node node = entry.getNode();
            node.expand(bounds);
            String parentPath = entry.getParentPath();
            root.setChild(parentPath, node);
        }
        // recreate root node with the appropriate bounds
        rootNode = Node.create(ROOT, rootId, ObjectId.NULL, TYPE.TREE, bounds);
View Full Code Here

            ObjectId metadataId;
            Envelope bounds;
            {
                RevTree newChild = childTree.build(origin, target);
                target.put(newChild);
                Node oldNode = childTree.getNode();
                name = oldNode.getName();
                newObjectId = newChild.getId();
                metadataId = oldNode.getMetadataId().or(ObjectId.NULL);
                bounds = SpatialOps.boundsOf(newChild);
            }
            Node newNode = Node.create(name, newObjectId, metadataId, TYPE.TREE, bounds);
            builder.put(newNode);
        }
        RevTree newTree = builder.build();
        if (!this.node.getObjectId().equals(newTree.getId())) {
            target.put(newTree);
View Full Code Here

        }
    }

    @Override
    public boolean tree(Node left, Node right) {
        final Node node = left == null ? right : left;
        if (NodeRef.ROOT.equals(node.getName())) {
            // ignore the call on the root tree and follow the traversal
            return true;
        }
        if (left == null || right == null) {
            addTreeFeatures(node.getObjectId(), left != null, right != null);
            if (left == null) {
                count.addedTrees(1);
            } else {
                count.removedTrees(1);
            }
View Full Code Here

        SortedMap<NodeRef, NodeRef> matches = newTreeMap();

        for (Map.Entry<String, MutableTree> right : entriesOnlyOnRight.entrySet()) {
            for (Map.Entry<String, MutableTree> left : entriesOnlyOnLeft.entrySet()) {

                Node leftNode = left.getValue().getNode();
                Node rightNode = right.getValue().getNode();

                if (rightNode.getObjectId().equals(leftNode.getObjectId())) {
                    String leftParent = NodeRef.parentPath(left.getKey());
                    String rightParent = NodeRef.parentPath(right.getKey());

                    NodeRef leftRef = new NodeRef(leftNode, leftParent, ObjectId.NULL);
                    NodeRef rightRef = new NodeRef(rightNode, rightParent, ObjectId.NULL);
View Full Code Here

TOP

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

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.