/* package */NodeImpl(final Id<Node> id, final Coord coord, final String type) { this(id); this.coord = coord; NetworkUtils.setType(this,type); }
private void startNode(final Attributes atts) { boolean hasZ = atts.getValue("z") == null ? false : true; Coord c; if(hasZ){ c = transformation.transform(new Coord( Double.parseDouble(atts.getValue("x")), Double.parseDouble(atts.getValue("y")), Double.parseDouble(atts.getValue("z")))); hasElevation = true; } else{ c = transformation.transform(new Coord( Double.parseDouble(atts.getValue("x")), Double.parseDouble(atts.getValue("y")))); hasNoElevation = true; } final Node node = this.network.getFactory().createNode( Id.create(atts.getValue("id"), Node.class), c); this.network.addNode(node); NetworkUtils.setType(node,atts.getValue("type")); // (did not have a null check when I found it. kai, jul'16) if (atts.getValue("origid") != null) { NetworkUtils.setOrigId( node, atts.getValue("origid") ) ; } }
private void startNode(final Attributes atts) { final Node node = this.network.getFactory().createNode( Id.create(atts.getValue("id"), Node.class), parseCoord(atts)); this.network.addNode(node); NetworkUtils.setType(node,atts.getValue("type")); // (did not have a null check when I found it. kai, jul'16) if (atts.getValue(NetworkUtils.ORIGID) != null) { NetworkUtils.setOrigId( node, atts.getValue(NetworkUtils.ORIGID) ) ; } currentAttributes = node.getAttributes(); }
this.network.addLink(l); NetworkUtils.setOrigId(l, atts.getValue("origid") ) ; NetworkUtils.setType(l, atts.getValue("type")); if (atts.getValue("modes") != null) { String[] strModes = StringUtils.explode(atts.getValue("modes"), ',');
NetworkUtils.setType( (l), value); // will now put it into the attributes. kai, dec'16
public static Link createAndAddLink(Network network, final Id<Link> id, final Node fromNode, final Node toNode, final double length, final double freespeed, final double capacity, final double numLanes, final String origId, final String type) { if (network.getNodes().get(fromNode.getId()) == null) { throw new IllegalArgumentException(network+"[from="+fromNode+" does not exist]"); } if (network.getNodes().get(toNode.getId()) == null) { throw new IllegalArgumentException(network+"[to="+toNode+" does not exist]"); } Link link = network.getFactory().createLink(id, fromNode, toNode) ; link.setLength(length); link.setFreespeed(freespeed); link.setCapacity(capacity); link.setNumberOfLanes(numLanes); setType( link, type); setOrigId( link, origId ) ; network.addLink( link ) ; return link; }
l.setNumberOfLanes(nofLanesForward); NetworkUtils.setOrigId(l, origId); NetworkUtils.setType(l, highway); setOrModifyLinkAttributes(l, way, true); network.addLink(l); l.setNumberOfLanes(nofLanesBackward); NetworkUtils.setOrigId(l, origId); NetworkUtils.setType(l, highway); setOrModifyLinkAttributes(l, way, false); network.addLink(l);
l.setNumberOfLanes(lanes); NetworkUtils.setOrigId(l, id.toString() ) ; NetworkUtils.setType(l, linksType + "-" + featTyp + "-" + ferryType); l = network.getFactory().createLink(Id.create(id.toString() + "TF", Link.class), tNode, fNode); l.setLength(length); l.setNumberOfLanes(lanes); NetworkUtils.setOrigId(l, id.toString() ) ; NetworkUtils.setType(l, linksType + "-" + featTyp + "-" + ferryType); } else if (oneway.equals("FT")) { Link l = network.getFactory().createLink(Id.create(id.toString() + oneway, Link.class), fNode, tNode); l.setNumberOfLanes(lanes); NetworkUtils.setOrigId(l, id.toString() ) ; NetworkUtils.setType(l, linksType + "-" + featTyp + "-" + ferryType); } else if (oneway.equals("TF")) { Link l = network.getFactory().createLink(Id.create(id.toString() + oneway, Link.class), tNode, fNode); l.setNumberOfLanes(lanes); NetworkUtils.setOrigId(l, id.toString() ) ; NetworkUtils.setType(l, linksType + "-" + featTyp + "-" + ferryType); } else { throw new IllegalArgumentException("linkId=" + id.toString() + ": " + LINK_ONEWAY_NAME + "=" + oneway + " not known!");
private int createInvertedLink(Link inLink, Link outLink, int numberOfLinksGenerated, Set<String> modes){ Link link = NetworkUtils.createAndAddLink(this.invertedNetwork,Id.create(numberOfLinksGenerated + 1, Link.class), this.invertedNetwork.getNodes().get(Id.create(inLink.getId(), Node.class)), this.invertedNetwork.getNodes().get(Id.create(outLink.getId(), Node.class)), outLink.getLength(), outLink.getFreespeed(), outLink.getCapacity(), outLink.getNumberOfLanes() ); link.setAllowedModes(modes); // log.error("created inverted link " + link.getId() + " from " + inLink.getId() + " to " + outLink.getId() + " with modes " + modes); NetworkUtils.setType( ((Link) link), NetworkUtils.getType(((Link) outLink))); return numberOfLinksGenerated + 1; }
final String type1 = type; Node r = n; NetworkUtils.setType(r,type1); network.addNode(n);
link2.setLength(link.getLength()); link2.setNumberOfLanes(link.getNumberOfLanes()); NetworkUtils.setType(link2, NetworkUtils.getType(link)); AttributesUtils.copyAttributesFromTo(link, link2); subNetwork.addLink(link2);
l.setAllowedModes(inlink.getAllowedModes()); NetworkUtils.setOrigId(l, NetworkUtils.getOrigId(inlink) ) ; NetworkUtils.setType(l, NetworkUtils.getType(inlink)); network.addLink(l); l.setAllowedModes(outlink.getAllowedModes()); NetworkUtils.setOrigId(l, NetworkUtils.getOrigId(outlink) ) ; NetworkUtils.setType(l, NetworkUtils.getType(outlink)); network.addLink(l); NetworkUtils.setType(l, NetworkUtils.getType(fromLink)); network.addLink(l); newLinks.add(l);