/** * Generate snapshot info based on Link. * * Comments:<ul> * <li>One could argue that this method should not know about Links at all, * but it shortens code at several places, and since Link is a standard interface, I see no reason to not provide this * as a service. * </ul> */ public AgentSnapshotInfo createAgentSnapshotInfo(Id<Person> agentId, Link link, double distanceOnLink, int lane) { PositionInfo info = new PositionInfo() ; info.setId(agentId) ; double lanePosition = this.linkWidthCalculator.calculateLanePosition(lane); calculateAndSetPosition(info, link.getFromNode().getCoord(), link.getToNode().getCoord(), distanceOnLink, link.getLength(), lanePosition ); return info; }
/** * creator based on Coord * @param curveLength lengths are usually different (usually longer) than the euclidean distances between the startCoord and endCoord */ public AgentSnapshotInfo createAgentSnapshotInfo(Id<Person> agentId, Coord startCoord, Coord endCoord, double distanceOnLink, Integer lane, double curveLength) { PositionInfo info = new PositionInfo() ; info.setId(agentId) ; double lanePosition = this.linkWidthCalculator.calculateLanePosition(lane); Gbl.assertNotNull( startCoord ); Gbl.assertNotNull( endCoord ); calculateAndSetPosition(info, startCoord, endCoord, distanceOnLink, curveLength, lanePosition) ; return info; }
/** * @param elevation */ @SuppressWarnings("static-method") public AgentSnapshotInfo createAgentSnapshotInfo(Id<Person> agentId, double easting, double northing, double elevation, double azimuth) { PositionInfo info = new PositionInfo() ; info.setId( agentId ) ; info.setEasting( easting ) ; info.setNorthing( northing ) ; info.setAzimuth( azimuth ) ; return info ; }