From b33d3b750ace0aae79953f269e4a12bba032a083 Mon Sep 17 00:00:00 2001 From: Thibaud Date: Thu, 15 Nov 2018 13:51:46 +0100 Subject: [PATCH] Delete SUMOFactory class --- sumo_project/SUMOFactory.py | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/sumo_project/SUMOFactory.py b/sumo_project/SUMOFactory.py index 80c9444..2f80bfc 100644 --- a/sumo_project/SUMOFactory.py +++ b/sumo_project/SUMOFactory.py @@ -1,28 +1,28 @@ -''' -Created on 17 oct. 2018 - -@author: Axel Huynh-Phuc, Thibaud Gasser -''' - -import traci -from shapely.geometry.linestring import LineString - - -class SUMOFactory(object): - - def stop_vehicle(self, veh_id): - traci.vehicle.remove(veh_id, traci.constants.REMOVE_PARKING) - - def lanes_in_area(self, area): - for lane_id in traci.lane.getIDList(): - polygon_lane = LineString(traci.lane.getShape(lane_id)) - if area.rectangle.intersects(polygon_lane): - yield lane_id - - def lock_area(self, area): - for lane_id in self.lanes_in_area(area): - print(f'Setting max speed of {lane_id} to 9.') - traci.lane.setMaxSpeed(lane_id, 9) - - for veh_id in traci.vehicle.getIDList(): - traci.vehicle.rerouteTraveltime(veh_id, True) +''' +Created on 17 oct. 2018 + +@author: Axel Huynh-Phuc, Thibaud Gasser +''' + +import traci +from shapely.geometry.linestring import LineString + + +def stop_vehicle(veh_id): + traci.vehicle.remove(veh_id, traci.constants.REMOVE_PARKING) + + +def lanes_in_area(area): + for lane_id in traci.lane.getIDList(): + polygon_lane = LineString(traci.lane.getShape(lane_id)) + if area.rectangle.intersects(polygon_lane): + yield lane_id + + +def lock_area(area): + for lane_id in lanes_in_area(area): + print(f'Setting max speed of {lane_id} to 30.') + traci.lane.setMaxSpeed(lane_id, 30) + + for veh_id in traci.vehicle.getIDList(): + traci.vehicle.rerouteTraveltime(veh_id, True)