/** * @deprecated use {@link RevObjectFactory#createNode} */ public static Node tree(final String name, final ObjectId oid, final ObjectId metadataId) { return create(name, oid, metadataId, TYPE.TREE, null); }
/** * @deprecated use {@link RevObjectFactory#createNode} */ public static Node create(final String name, final ObjectId oid, final ObjectId metadataId, final TYPE type, @Nullable final Envelope bounds) { return create(name, oid, metadataId, type, bounds, null); }
private Node treeNode(String name, ObjectId treeId, @Nullable ObjectId metadataId) { if (metadataId == null) { metadataId = ObjectId.NULL; } Node node = Node.create(name, treeId, metadataId, TYPE.TREE, null); return node; }
public Node update(final ObjectId newId, final @Nullable Envelope newBounds) { ObjectId mdId = getMetadataId().or(ObjectId.NULL); return Node.create(getName(), newId, mdId, getType(), newBounds, getExtraData()); }
private Node feature(int i, ObjectId oid) { String name = String.valueOf(i); TYPE type = TYPE.FEATURE; Envelope bounds = new Envelope(i, i, i, i); return Node.create(name, oid, metadataId, type, bounds); } }
private Node featureRef(String parentPath, int i) { String path = NodeRef.appendChild(parentPath, String.valueOf(i)); Node ref = Node.create(path, FAKE_FEATURE_ID, ObjectId.NULL, TYPE.FEATURE, null); return ref; }
protected Node createNode(int i) { String key = "Feature." + i; // ObjectId oid = ObjectId.forString(key); // ObjectId metadataId = ObjectId.forString("FeatureType"); // Node ref = new Node(key, oid, metadataId, TYPE.FEATURE); Node ref = Node.create(key, FAKE_ID, FAKE_ID, TYPE.FEATURE, new Envelope(i, i + 1, i, i + 1)); return ref; }
private Node node(int i) { return Node.create("name", FAKE_ID, FAKE_ID, TYPE.FEATURE, new Envelope(i, i + 1, i, i + 1)); }
private Node createNodeWithMetadata(int n) { Map<String, Object> extraData = new HashMap<>(); extraData.put("some-root-key", "some-string-value-" + n); Map<String, Object> extraAtts = new HashMap<>(); extraData.put(IndexInfo.FEATURE_ATTRIBUTES_EXTRA_DATA, extraAtts); extraAtts.put("string-key", "String-value-" + n); extraAtts.put("integer-key", n); extraAtts.put("a-very-large-key-name-just-for-testing-result-size", "large-key-value-" + n); String name = "Node-" + n; ObjectId oid = RevObjectTestSupport.hashString(name); Envelope bounds = new Envelope(-1 * n, n, -1 * n, n); return Node.create(name, oid, ObjectId.NULL, TYPE.FEATURE, bounds, null); }
public static List<Node> createWorldPointsNodes(int degreeStep) { List<Node> nodes = new ArrayList<>(); for (int x = -180; x <= 180; x += degreeStep) { for (int y = -90; y <= 90; y += degreeStep) { String fid = getPointFid(x, y); Envelope env = new Envelope(new Coordinate(x, y)); ObjectId oid = RevObjectTestSupport.hashString(fid); Node node = Node.create(fid, oid, ObjectId.NULL, TYPE.FEATURE, env); nodes.add(node); } } return nodes; }
private Node createNode(int intId, final @Nullable Envelope bounds) { String nodeName = String.valueOf(intId); String sid = Strings.padStart(nodeName, 40, '0'); ObjectId oid = RevObjectTestSupport.hashString(sid); checkState(bounds == null || (!bounds.isNull() && maxBounds.contains(bounds))); Node node = Node.create(nodeName, oid, ObjectId.NULL, TYPE.FEATURE, bounds, null); Envelope nodeBounds = node.bounds().orNull(); if (bounds != null) { checkState(nodeBounds.contains(bounds)); checkState(maxBounds.contains(nodeBounds)); } return node; }
public Node createNode(String name, @Nullable Envelope bounds) { ObjectId id = RevObjectTestSupport.hashString(name); Node n = Node.create(name, id, ObjectId.NULL, RevObject.TYPE.FEATURE, bounds); if (bounds != null && !bounds.isNull()) { Envelope float32Bounds = n.bounds().get(); Assert.assertTrue(float32Bounds.contains(bounds)); } return n; }
/** * Creates a root node for the given tree as the one {@link PreOrderDiffWalk} should use to * start the traversal */ private NodeRef nodeFor(RevTree root) { Envelope bounds = SpatialOps.boundsOf(root); return NodeRef.createRoot( Node.create(NodeRef.ROOT, root.getId(), ObjectId.NULL, TYPE.TREE, bounds)); }
private RevTree createTree(int numChildren) { RevTreeBuilder rtb = CanonicalTreeBuilder.create(odb); for (int i = 0; i < numChildren; i++) { String key = FEATURE_PREFIX + i; Node ref = Node.create(key, FAKE_ID, FAKE_ID, TYPE.FEATURE, null); rtb.put(ref); } return rtb.build(); }
private void createFeatureTypesTree(RevTreeBuilder rootBuilder, String treePath, RevTree childTree) { odb.put(childTree); Node childRef = Node.create(treePath, childTree.getId(), ObjectId.NULL, TYPE.TREE, null); rootBuilder.put(childRef); }
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; }
/** * Creates a root node for the given tree as the one {@link PostOrderDiffWalk} should use to * start the traversal */ private static NodeRef nodeFor(RevTree root) { Envelope bounds = SpatialOps.boundsOf(root); return NodeRef.createRoot( Node.create(NodeRef.ROOT, root.getId(), ObjectId.NULL, TYPE.TREE, bounds)); }
private RevTree createRoot(ObjectDatabase db, final RevTree tree1, final RevTree tree2) { RevTreeBuilder rootBuilder = CanonicalTreeBuilder.create(db); rootBuilder.put(Node.create("tree1", tree1.getId(), metadataId, TYPE.TREE, SpatialOps.boundsOf(tree1))); rootBuilder.put(Node.create("tree2", tree2.getId(), metadataId, TYPE.TREE, SpatialOps.boundsOf(tree2))); RevTree root = rootBuilder.build(); db.put(root); return root; }
private Node feature(ObjectStore db, String idPrefix, int index) { final String id = idPrefix + "." + index; final Feature feature; feature = super.feature(pointsType, id, id, index, point(index)); RevFeature revFeature = RevFeatureBuilder.build(feature); db.put(revFeature); Envelope bounds = (Envelope) feature.getBounds(); return Node.create(id, revFeature.getId(), ObjectId.NULL, TYPE.FEATURE, bounds); }
public static RevTreeBuilder createTreesTreeBuilder(ObjectStore source, int numSubTrees, int featuresPerSubtre, ObjectId metadataId) { RevTreeBuilder builder = CanonicalTreeBuilder.create(source); for (int treeN = 0; treeN < numSubTrees; treeN++) { RevTree subtree = createFeaturesTreeBuilder(source, "subtree" + treeN, featuresPerSubtre).build(); source.put(subtree); builder.put( Node.create("subtree" + treeN, subtree.getId(), metadataId, TYPE.TREE, null)); } return builder; }