public final int positionAgentsInActivities(final Collection<AgentSnapshotInfo> positions, Link link, Collection<MobsimAgent> agentsInActivities, int cnt2) { for (MobsimAgent pa : agentsInActivities) { AgentSnapshotInfo agInfo = snapshotInfoFactory.createAgentSnapshotInfo(pa.getId(), link, 0.9*link.getLength(), cnt2) ; agInfo.setAgentState( AgentState.PERSON_AT_ACTIVITY ) ; positions.add(agInfo) ; cnt2++ ; } return cnt2; }
private void addHolePosition(final Collection<AgentSnapshotInfo> positions, double distanceFromFromNode, Hole veh, double curvedLength, Coord upstreamCoord, Coord downstreamCoord) { Integer lane = 20 ; double speedValue = 1. ; AgentSnapshotInfo pos = this.snapshotInfoFactory.createAgentSnapshotInfo(Id.create("hole", Person.class), upstreamCoord, downstreamCoord, distanceFromFromNode, lane, curvedLength); pos.setColorValueBetweenZeroAndOne(speedValue); pos.setAgentState(AgentState.PERSON_OTHER_MODE ); positions.add(pos); }
/** * Put the vehicles from the waiting list in positions. Their actual position doesn't matter, PositionInfo provides a * constructor for handling this situation. */ public final int positionVehiclesFromWaitingList(final Collection<AgentSnapshotInfo> positions, final Link link, int cnt2, final Queue<QVehicle> waitingList) { for (QVehicle veh : waitingList) { Collection<Identifiable<?>> peopleInVehicle = VisUtils.getPeopleInVehicle(veh); boolean first = true; for (Identifiable passenger : peopleInVehicle) { cnt2++ ; AgentSnapshotInfo passengerPosition = snapshotInfoFactory.createAgentSnapshotInfo(passenger.getId(), link, 0.9*link.getLength(), cnt2); // for the time being, same position as facilities if (passenger.getId().toString().startsWith("pt")) { passengerPosition.setAgentState(AgentState.TRANSIT_DRIVER); } else if (first) { passengerPosition.setAgentState(AgentState.PERSON_DRIVING_CAR); } else { passengerPosition.setAgentState(AgentState.PERSON_OTHER_MODE); } positions.add(passengerPosition); first = false; } } return cnt2 ; }
passengerPosition.setAgentState(AgentState.TRANSIT_DRIVER); } else if (last) { passengerPosition.setAgentState(AgentState.PERSON_DRIVING_CAR); } else { passengerPosition.setAgentState(AgentState.PERSON_OTHER_MODE);
private void readAgent(ByteBuffer in, SceneGraph graph) { String id = ByteBufferUtils.getString(in); float x = in.getFloat(); float y = in.getFloat(); int int1 = in.getInt() ; int int2 = in.getInt() ; float float1 = in.getFloat() ; AgentSnapshotInfo agInfo = snapshotFactory.createAgentSnapshotInfo(Id.create(id, Person.class), x, y, 0., 0.) ; agInfo.setAgentState( al[int1] ) ; agInfo.setUserDefined( int2 ) ; agInfo.setColorValueBetweenZeroAndOne(float1); graph.getAgentPointLayer().addAgent(agInfo); }
final void positionPassengers(Collection<AgentSnapshotInfo> positions, Collection<? extends PassengerAgent> passengers, double distanceOnLink, Coord startCoord, Coord endCoord, double lengthOfCurve, Integer lane, double speedValueBetweenZeroAndOne) { int cnt = passengers.size(); int laneInt = 2*(cnt+1); if (lane != null){ laneInt += lane; } for (PassengerAgent passenger : passengers) { int lanePos = laneInt - 2*cnt ; AgentSnapshotInfo passengerPosition = snapshotInfoFactory.createAgentSnapshotInfo(passenger.getId(), startCoord, endCoord, distanceOnLink, lanePos, lengthOfCurve); passengerPosition.setColorValueBetweenZeroAndOne(speedValueBetweenZeroAndOne); passengerPosition.setAgentState(AgentState.PERSON_OTHER_MODE); // in 2010, probably a passenger positions.add(passengerPosition); cnt-- ; } }
private void readAgent(ByteBuffer in, SceneGraph sceneGraph) { // yyyy there is a very similar method in OTFAgentsListHandler. with a more robust format, they should be united. kai, apr'10 String id = ByteBufferUtils.getString(in); float x = in.getFloat(); float y = in.getFloat(); int userdefined = in.getInt(); float colorValue = in.getFloat(); int state = in.getInt(); AgentSnapshotInfo agInfo = snapshotFactory.createAgentSnapshotInfo(Id.create(id, Person.class), x, y, 0., 0.); agInfo.setColorValueBetweenZeroAndOne(colorValue); agInfo.setUserDefined(userdefined); agInfo.setAgentState(AgentState.values()[state]); sceneGraph.getAgentPointLayer().addAgent(agInfo); }
public final void positionAgentGivenDistanceFromFNode(final Collection<AgentSnapshotInfo> positions, Coord startCoord, Coord endCoord, double lengthOfCurve, QVehicle veh, double distanceFromFromNode, Integer lane, double speedValueBetweenZeroAndOne){ // I think that the main reason why this exists as public method is that AssignmentEmulatingQLane wants to use it directly. // The reason for this, in return, is that positionVehiclesAlongLine(...) is a service method for queue models only. kai, apr'16 MobsimDriverAgent driverAgent = veh.getDriver(); AgentSnapshotInfo pos = snapshotInfoFactory.createAgentSnapshotInfo(driverAgent.getId(), startCoord, endCoord, distanceFromFromNode, lane, lengthOfCurve); pos.setColorValueBetweenZeroAndOne(speedValueBetweenZeroAndOne); if (driverAgent instanceof TransitDriverAgent){ pos.setAgentState(AgentState.TRANSIT_DRIVER); } else if ( driverAgent.getMode().equals(TransportMode.car)) { pos.setAgentState(AgentState.PERSON_DRIVING_CAR); } else { pos.setAgentState(AgentState.PERSON_OTHER_MODE ); } if ( scenario.getPopulation().getPersonAttributes().getAttribute( driverAgent.getId().toString(), "marker" ) != null ) { pos.setAgentState( AgentState.PERSON_OTHER_MODE ) ; } this.positionPassengers(positions, veh.getPassengers(), distanceFromFromNode, startCoord, endCoord, lengthOfCurve, lane+5, speedValueBetweenZeroAndOne); // (this is deliberately first memorizing "pos" but then filling in the passengers first) positions.add(pos); }
position.setAgentState(AgentSnapshotInfo.AgentState.PERSON_DRIVING_CAR); positions.add(position); distFromFromNode -= cellSize; position.setAgentState(AgentSnapshotInfo.AgentState.PERSON_DRIVING_CAR); positions.add(position); distFromFromNode -= cellSize; AgentSnapshotInfo position = snapshotInfoFactory.createAgentSnapshotInfo(agent.id, this.link, distFromFromNode, agent.lane); position.setColorValueBetweenZeroAndOne( agent.speed) ; position.setAgentState(AgentSnapshotInfo.AgentState.PERSON_AT_ACTIVITY); positions.add(position); distFromFromNode -= cellSize; AgentSnapshotInfo position = snapshotInfoFactory.createAgentSnapshotInfo(agent.id, this.link, distFromFromNode, agent.lane); position.setColorValueBetweenZeroAndOne( agent.speed) ; position.setAgentState(AgentSnapshotInfo.AgentState.PERSON_AT_ACTIVITY); positions.add(position); distFromFromNode -= cellSize;
position.setAgentState(AgentSnapshotInfo.AgentState.PERSON_DRIVING_CAR); positions.add(position); queueEnd -= vehLen; AgentSnapshotInfo position = snapshotInfoFactory.createAgentSnapshotInfo(agent.id, this.link, distanceOnLink/* + NetworkLayer.CELL_LENGTH*/, lane); position.setColorValueBetweenZeroAndOne( agent.speed) ; position.setAgentState(AgentSnapshotInfo.AgentState.PERSON_DRIVING_CAR); positions.add(position); lastDistance = distanceOnLink; AgentSnapshotInfo position = snapshotInfoFactory.createAgentSnapshotInfo(agent.id, this.link, this.effectiveCellSize, lane); position.setColorValueBetweenZeroAndOne( 0.0) ; position.setAgentState(AgentSnapshotInfo.AgentState.PERSON_AT_ACTIVITY); positions.add(position); AgentSnapshotInfo position = snapshotInfoFactory.createAgentSnapshotInfo(agent.id, this.link, this.effectiveCellSize, lane); position.setColorValueBetweenZeroAndOne(0.0) ; position.setAgentState(AgentSnapshotInfo.AgentState.PERSON_AT_ACTIVITY); positions.add(position);