Commit 17c5d7d6 authored by jimonreal's avatar jimonreal Committed by Jose Ignacio Monreal Bailey
Browse files

Adding VehicleType

parent 7328ee2b
......@@ -394,4 +394,8 @@ public class VehicleMovementModel implements MovementModel, EventHandler {
public static RoadNetwork getRoadNetwork() {
return MOVEMENT._extractor.getRoadNetwork();
}
public static String getVehicleType(String pVehicleID) {
return MOVEMENT._controller.getVehicleType(pVehicleID);
}
}
......@@ -38,12 +38,7 @@ import de.tudresden.sumo.cmd.Lane;
import de.tudresden.sumo.cmd.Simulation;
import de.tudresden.sumo.cmd.Vehicle;
import de.tudresden.sumo.util.SumoCommand;
import de.tudresden.ws.container.SumoBoundingBox;
import de.tudresden.ws.container.SumoGeometry;
import de.tudresden.ws.container.SumoLink;
import de.tudresden.ws.container.SumoLinkList;
import de.tudresden.ws.container.SumoPosition2D;
import de.tudresden.ws.container.SumoStringList;
import de.tudresden.ws.container.*;
import edu.emory.mathcs.backport.java.util.Collections;
import it.polito.appeal.traci.SumoTraciConnection;
......@@ -250,6 +245,20 @@ public class TraciSimulationController implements VehicleController, SimulationS
return false;
}
public String getVehicleType(String pVehicleID) {
String vehicleType = "private";
SumoCommand typeCommand = Vehicle.getTypeID(pVehicleID);
Object typeObject = requestObject(typeCommand);
if (typeObject != null) {
vehicleType = (String) typeObject;
}
return vehicleType;
}
private Location requestVehiclePosition(String pVehicleID) {
if (_vehiclesOutOfRange.containsKey(pVehicleID)) {
if (_vehiclesOutOfRange.get(pVehicleID) < _step) {
......
......@@ -205,9 +205,13 @@ public class XMLSimulationController implements VehicleController, SimulationSet
throw new UnsupportedOperationException("This method is not supported for " + getClass().getSimpleName());
}
@Override
public String getVehicleType(String pVehicleID) {
return null;
}
@Override
public double getVehicleSpeed(String pVehicleID) {
return _vehicleDataInformationHandler.getVehiclePositions().get(pVehicleID).getSpeed();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment