@Override public void startTag(final String name, final Attributes atts, final Stack<String> context) { switch( name ) { case NODE: startNode(atts); break; case LINK: startLink(atts); break; case NETWORK: startNetwork(atts); break; case LINKS: startLinks(atts); break; case ATTRIBUTES: case ATTRIBUTE: attributesDelegate.startTag( name , atts , context , currentAttributes ); break; } }
@Override protected void setDoctype(final String doctype) { super.setDoctype(doctype); switch ( doctype ) { case NETWORK_V1: this.delegate = new NetworkReaderMatsimV1( inputCRS != null ? TransformationFactory.getCoordinateTransformation(inputCRS, targetCRS) : new IdentityTransformation(), this.network); log.info("using network_v1-reader."); break; case NETWORK_V2: this.delegate = new NetworkReaderMatsimV2(inputCRS, targetCRS, this.network); ((NetworkReaderMatsimV2) delegate).putAttributeConverters( converters ); log.info("using network_v2-reader."); break; default: throw new IllegalArgumentException("Doctype \"" + doctype + "\" not known."); } }
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(); }