use of org.locationtech.geogig.api.Node in project GeoGig by boundlessgeo.
the class RevTreeBuilder2 method removeFeature.
/**
* Marks the node named after {@code fid} to be deleted by adding a Node with
* {@link ObjectId#NULL NULL} ObjectId
*/
public void removeFeature(String fid) {
Node node = Node.create(fid, ObjectId.NULL, ObjectId.NULL, TYPE.FEATURE, null);
put(node);
}
use of org.locationtech.geogig.api.Node in project GeoGig by boundlessgeo.
the class RevTreeBuilder2 method putFeature.
public Node putFeature(final ObjectId id, final String name, @Nullable final BoundingBox bounds, final FeatureType type) {
Envelope bbox;
if (bounds == null) {
bbox = null;
} else if (bounds instanceof Envelope) {
bbox = (Envelope) bounds;
} else {
bbox = new Envelope(bounds.getMinimum(0), bounds.getMaximum(0), bounds.getMinimum(1), bounds.getMaximum(1));
}
RevFeatureType revFeatureType = revFeatureTypes.get(type.getName());
if (null == revFeatureType) {
revFeatureType = RevFeatureTypeImpl.build(type);
revFeatureTypes.put(type.getName(), revFeatureType);
}
ObjectId metadataId = revFeatureType.getId().equals(defaultMetadataId) ? ObjectId.NULL : revFeatureType.getId();
Node node = Node.create(name, id, metadataId, TYPE.FEATURE, bbox);
put(node);
return node;
}
use of org.locationtech.geogig.api.Node in project GeoGig by boundlessgeo.
the class FormatCommonV1 method readNodeRef.
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));
}
use of org.locationtech.geogig.api.Node in project GeoGig by boundlessgeo.
the class DiffCountConsumer method tree.
@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);
}
return false;
}
// the tree changed, or this method wouldn't have been called
count.changedTrees(1);
return true;
}
use of org.locationtech.geogig.api.Node in project GeoGig by boundlessgeo.
the class DiffPathTracker method endTree.
/**
* @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;
}
if (NodeRef.ROOT.equals(currentPath)) {
currentPath = null;
} else {
String fullPath = currentPath;
currentPath = NodeRef.parentPath(fullPath);
}
return currentPath;
}
Aggregations