Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.Node


     */
    protected ObjectId insert(GeoGIG geogig, Feature f) throws Exception {
        final WorkingTree workTree = geogig.getRepository().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


        delete(lines1);
        // insert(lines2);
        WorkingTree workTree = repo.workingTree();
        Name name = lines1.getType().getName();
        String parentPath = name.getLocalPart();
        @SuppressWarnings("unused")
        Node ref = workTree.insert(parentPath, lines1B);
        geogig.command(AddOp.class).call();
        RevCommit commit2 = geogig.command(CommitOp.class).setAll(true).call();

        List<DiffEntry> diffs;
View Full Code Here

    private static Node createNode(int i) {
        byte[] rawID = FAKE_ID.getRawValue();
        String key = "Feature." + i;
        ObjectId id = new ObjectId(rawID);
        Envelope env = new Envelope(0, 0, i, i);
        Node ref = Node.create(key, id, FAKE_ID, TYPE.FEATURE, env);
        return ref;
    }
View Full Code Here

                if (progress.isCanceled()) {
                    return false;// abort traversal
                }
                ObjectId id;
                if (b instanceof Node) {
                    Node node = (Node) b;
                    if (RevObject.TYPE.TREE.equals(node.getType())) {
                        // check of existence of trees only. For features the diff filtering is good
                        // enough and checking for existence on each feature would be killer
                        // performance wise
                        id = node.getObjectId();
                    } else {
                        return true;
                    }
                } else {
                    id = ((Bucket) b).id();
                }
                boolean exists = ids.contains(id) || toDb.exists(id);
                return !exists;
            }
        };

        // receives notifications of feature/bucket/tree diffs. Only interested in the "new"/right
        // side of the comparisons
        Consumer consumer = new Consumer() {
            final int bulkSize = 10_000;

            @Override
            public void feature(@Nullable Node left, Node right) {
                add(left);
                add(right);
            }

            @Override
            public void tree(@Nullable Node left, Node right) {
                add(left);
                add(right);
            }

            private void add(@Nullable Node node) {
                if (node == null) {
                    return;
                }
                ids.add(node.getObjectId());
                Optional<ObjectId> metadataId = node.getMetadataId();
                if (metadataId.isPresent()) {
                    ids.add(metadataId.get());
                }
                checkLimitAndCopy();
            }
View Full Code Here

        }

        @Override
        protected Node computeNext() {
            try {
                Node node = FormatCommonV2.readNode(in);
                return node;
            } catch (EOFException eof) {
                Closeables.closeQuietly(in);
                return endOfData();
            } catch (Exception e) {
View Full Code Here

        String fid = feature.getIdentifier().getID();
        BoundingBox bounds = feature.getBounds();
        FeatureType type = feature.getType();

        final Node node = treeBuilder.putFeature(revFeatureId, fid, bounds, type);
        return node;
    }
View Full Code Here

                indexDatabase.put(revFeatureType);
            }
            metadataId = revFeatureType.getId();
        }
        Envelope bounds = SpatialOps.boundsOf(tree);
        Node node = Node.create(NodeRef.nodeFromPath(treePath), tree.getId(), metadataId,
                TYPE.TREE, bounds);

        String parentPath = NodeRef.parentPath(treePath);
        return new NodeRef(node, parentPath, ObjectId.NULL);
    }
View Full Code Here

            private long skippedTrees, skippedBuckets, skippedFeatures;

            private long acceptedTrees, acceptedBuckets, acceptedFeatures;

            void add(final Bounded b, final boolean skip) {
                Node n = b instanceof Node ? (Node) b : null;
                Bucket bucket = b instanceof Bucket ? (Bucket) b : null;
                if (skip) {
                    if (bucket == null) {
                        if (n.getType() == TYPE.FEATURE) {
                            skippedFeatures++;
                        } else {
                            skippedTrees++;
                        }
                    } else {
                        skippedBuckets++;
                    }
                } else {
                    if (bucket == null) {
                        if (n.getType() == TYPE.FEATURE) {
                            acceptedFeatures++;
                        } else {
                            acceptedTrees++;
                        }
                    } else {
View Full Code Here

        @Override
        public Void call() {
            RevTree tree = builder.build();

            Node treeNode;
            {
                ObjectId treeMetadataId = builder.getDefaultMetadataId();
                String name = NodeRef.nodeFromPath(treePath);
                ObjectId oid = tree.getId();
                Envelope bounds = SpatialOps.boundsOf(tree);
View Full Code Here

        RevTreeBuilder builder;
        try {
            builder = new RevTreeBuilder(db, original);
            Iterator<Node> nodes = nodeIndex.nodes();
            while (nodes.hasNext()) {
                Node node = nodes.next();
                if (node.getObjectId().isNull()) {
                    builder.remove(node.getName());
                } else {
                    builder.put(node);
                }
            }
        } catch (RuntimeException e) {
View Full Code Here

TOP

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

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.