@Override
public boolean handleDeparture(double now, MobsimAgent agent, Id<Link> linkId) {
if ( agent.getExpectedTravelTime()==null || agent.getExpectedTravelTime()==Time.UNDEFINED_TIME ) {
Logger.getLogger( this.getClass() ).info( "mode: " + agent.getMode() );
throw new RuntimeException("teleportation does not work when travel time is undefined. There is also really no magic fix for this,"
+ " since we cannot guess travel times for arbitrary modes and arbitrary landscapes. kai/mz, apr'15 & feb'16") ;
}
Double travelTime = agent.getExpectedTravelTime() ;
if ( withTravelTimeCheck ) {
Double speed = scenario.getConfig().plansCalcRoute().getTeleportedModeSpeeds().get( agent.getMode() ) ;
Facility dpfac = agent.getCurrentFacility() ;
Facility arfac = agent.getDestinationFacility() ;
travelTime = DefaultTeleportationEngine.travelTimeCheck(travelTime, speed, dpfac, arfac);
}
double arrivalTime = now + travelTime ;
this.teleportationList.add(new Tuple<>(arrivalTime, agent));
Id<Person> agentId = agent.getId();
Link currLink = this.scenario .getNetwork().getLinks().get(linkId);
Link destLink = this.scenario .getNetwork().getLinks().get(agent.getDestinationLinkId());
Coord fromCoord = currLink.getToNode().getCoord();
Coord toCoord = destLink.getToNode().getCoord();
TeleportationVisData agentInfo = new TeleportationVisData(now, agentId, fromCoord, toCoord, travelTime);
this.teleportationData.put(agentId, agentInfo);
return true;
}