public NetworkExpandNode(final Network network, final double expRadius, final double offset) { if (network == null) { throw new IllegalArgumentException("network must not be null."); } this.network = network; this.setExpRadius(expRadius); this.setOffset(offset); }
private void run2(final Network network) throws Exception { log.info("running " + this.getClass().getName() + " module..."); NetworkExpandNode neModule = new NetworkExpandNode(network, expansionRadius, this.linkSeparation); Tuple<List<Node>, List<Link>> t = neModule.expandNode(nodeId, turns); virtualNodesCnt += t.getFirst().size(); virtualLinksCnt += t.getSecond().size();
walkCar.add(TransportMode.car); NetworkExpandNode exp = new NetworkExpandNode(f.scenario.getNetwork(), 25, 5); Assert.assertFalse(exp.turnsAreSameAsSingleNode(nodeId, turns, true)); turns.add(new TurnInfo(Id.create("5", Link.class), Id.create("6", Link.class), emptySet)); // u-turn Assert.assertTrue(exp.turnsAreSameAsSingleNode(nodeId, turns, true));
walkOnly.add(TransportMode.walk); NetworkExpandNode exp = new NetworkExpandNode(f.scenario.getNetwork(), 25, 5); ArrayList<TurnInfo> turns = new ArrayList<TurnInfo>(); turns.add(new TurnInfo(Id.create("1", Link.class), Id.create("6", Link.class))); turns.add(new TurnInfo(Id.create("5", Link.class), Id.create("4", Link.class), carOnly)); exp.expandNode(Id.create("3", Node.class), turns); Network n = f.scenario.getNetwork(); Assert.assertEquals(12, n.getLinks().size());
walkCar.add(TransportMode.car); NetworkExpandNode exp = new NetworkExpandNode(f.scenario.getNetwork(), 25, 5); Assert.assertFalse(exp.turnsAreSameAsSingleNode(nodeId, turns, false)); turns.add(new TurnInfo(Id.create("5", Link.class), Id.create("6", Link.class))); Assert.assertTrue(exp.turnsAreSameAsSingleNode(nodeId, turns, false));
f.createNetwork_ThreeWayIntersection(); NetworkExpandNode exp = new NetworkExpandNode(f.scenario.getNetwork(), 25, 5); ArrayList<TurnInfo> turns = new ArrayList<TurnInfo>(); turns.add(new TurnInfo(Id.create("1", Link.class), Id.create("6", Link.class))); turns.add(new TurnInfo(Id.create("5", Link.class), Id.create("4", Link.class))); exp.expandNode(Id.create("3", Node.class), turns); Network n = f.scenario.getNetwork(); Assert.assertEquals(12, n.getLinks().size());
NetworkExpandNode exp = new NetworkExpandNode(f.scenario.getNetwork(), 25, 5); ArrayList<TurnInfo> turns = new ArrayList<TurnInfo>(); turns.add(new TurnInfo(Id.create("1", Link.class), Id.create("6", Link.class))); turns.add(new TurnInfo(Id.create("5", Link.class), Id.create("4", Link.class))); exp.expandNode(Id.create("3", Node.class), turns); Network n = f.scenario.getNetwork(); Assert.assertEquals(12, n.getLinks().size());