public ConvertAndImportSink(QueueIterator<Feature> target, Context cmdLocator, WorkingTree workTree, Platform platform, ProgressListener progressListener) { super(); this.target = target; this.workTree = workTree; this.progressListener = progressListener; this.latestChangeset = 0; this.latestTimestamp = 0; this.pointCache = new MappedPointCache(platform);// new MapdbPointCache(platform); Optional<NodeRef> waysNodeRef = cmdLocator.command(FindTreeChild.class) .setChildPath(OSMUtils.WAY_TYPE_NAME).setParent(workTree.getTree()).call(); Optional<NodeRef> nodesNodeRef = cmdLocator.command(FindTreeChild.class) .setChildPath(OSMUtils.NODE_TYPE_NAME).setParent(workTree.getTree()).call(); checkArgument(waysNodeRef.isPresent() || nodesNodeRef.isPresent(), "There is no OSM data currently in the repository"); Envelope envelope = new Envelope(); if (waysNodeRef.isPresent()) { waysNodeRef.get().expand(envelope); } if (nodesNodeRef.isPresent()) { nodesNodeRef.get().expand(envelope); } bbox = GEOMF.toGeometry(envelope); }
@Test public void testExpand() { Node node = RevObjectFactory.defaultInstance().createNode("Points.1", ObjectId.valueOf("abc123000000000000001234567890abcdef0000"), ObjectId.NULL, TYPE.FEATURE, new Envelope(0, 1, 2, 3), null); NodeRef nodeRef = NodeRef.create("Points", node); Envelope env = new Envelope(1, 3, 1, 2); nodeRef.expand(env); assertEquals(new Envelope(0, 3, 1, 3), env); } }