@Override public void startTag(final String name, final Attributes atts, final Stack<String> context) { if (PLANS.equals(name)) { startPlans(atts); } else if (PERSON.equals(name)) { startPerson(atts); } else if (PLAN.equals(name)) { startPlan(atts); } else if (ACT.equals(name)) { startAct(atts); } else if (LEG.equals(name)) { startLeg(atts); } else if (ROUTE.equals(name)) { startRoute(atts); } else { throw new RuntimeException(this + "[tag=" + name + " not known or not supported]"); } }
private void startAct(final Attributes atts) { Activity act = null; if (atts.getValue("link") != null) { final Id<Link> linkId = Id.create(atts.getValue("link"), Link.class); act = PopulationUtils.createAndAddActivityFromLinkId(this.currplan, atts.getValue("type"), linkId); if (atts.getValue(ATTR_X100) != null && atts.getValue(ATTR_Y100) != null) { final Coord coord = parseCoord( atts ); act.setCoord(coord); } } else if (atts.getValue(ATTR_X100) != null && atts.getValue(ATTR_Y100) != null) { final Coord coord = parseCoord( atts ); act = PopulationUtils.createAndAddActivityFromCoord(this.currplan, atts.getValue("type"), coord); } else { throw new IllegalArgumentException("Either the coords or the link must be specified for an Act."); } act.setStartTime(Time.parseTime(atts.getValue("start_time"))); act.setMaximumDuration(Time.parseTime(atts.getValue("dur"))); act.setEndTime(Time.parseTime(atts.getValue("end_time"))); if (this.routeNodes != null) { this.currroute.setLinkIds(this.prevAct.getLinkId(), NetworkUtils.getLinkIds(RouteUtils.getLinksFromNodes(NetworkUtils.getNodes(this.network, this.routeNodes))), act.getLinkId()); this.routeNodes = null; this.currroute = null; } this.prevAct = act; }
case PLANS_V1: this.delegate = new PopulationReaderMatsimV1( transformation, this.scenario);