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); }
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 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); }
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); }
position.setColorValueBetweenZeroAndOne( agent.speed) ; position.setAgentState(AgentSnapshotInfo.AgentState.PERSON_DRIVING_CAR); positions.add(position); position.setColorValueBetweenZeroAndOne( agent.speed) ; position.setAgentState(AgentSnapshotInfo.AgentState.PERSON_DRIVING_CAR); positions.add(position); agent.speed = 0.0; 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); agent.speed = 0.0; 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);
position.setColorValueBetweenZeroAndOne( agent.speed) ; position.setAgentState(AgentSnapshotInfo.AgentState.PERSON_DRIVING_CAR); positions.add(position); int lane = 1 + (agent.intId % NetworkUtils.getNumberOfLanesAsInt(org.matsim.core.utils.misc.Time.UNDEFINED_TIME, this.link)); 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); for (EventAgent agent : this.waitingQueue) { 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); for (EventAgent agent : this.parkingQueue) { 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);
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); }