mirror of
https://github.com/Ahp06/SUMO_Emissions.git
synced 2024-11-22 11:36:29 +00:00
Delete SUMOFactory class
This commit is contained in:
parent
9600dee7e5
commit
b33d3b750a
@ -8,21 +8,21 @@ import traci
|
|||||||
from shapely.geometry.linestring import LineString
|
from shapely.geometry.linestring import LineString
|
||||||
|
|
||||||
|
|
||||||
class SUMOFactory(object):
|
def stop_vehicle(veh_id):
|
||||||
|
|
||||||
def stop_vehicle(self, veh_id):
|
|
||||||
traci.vehicle.remove(veh_id, traci.constants.REMOVE_PARKING)
|
traci.vehicle.remove(veh_id, traci.constants.REMOVE_PARKING)
|
||||||
|
|
||||||
def lanes_in_area(self, area):
|
|
||||||
|
def lanes_in_area(area):
|
||||||
for lane_id in traci.lane.getIDList():
|
for lane_id in traci.lane.getIDList():
|
||||||
polygon_lane = LineString(traci.lane.getShape(lane_id))
|
polygon_lane = LineString(traci.lane.getShape(lane_id))
|
||||||
if area.rectangle.intersects(polygon_lane):
|
if area.rectangle.intersects(polygon_lane):
|
||||||
yield lane_id
|
yield lane_id
|
||||||
|
|
||||||
def lock_area(self, area):
|
|
||||||
for lane_id in self.lanes_in_area(area):
|
def lock_area(area):
|
||||||
print(f'Setting max speed of {lane_id} to 9.')
|
for lane_id in lanes_in_area(area):
|
||||||
traci.lane.setMaxSpeed(lane_id, 9)
|
print(f'Setting max speed of {lane_id} to 30.')
|
||||||
|
traci.lane.setMaxSpeed(lane_id, 30)
|
||||||
|
|
||||||
for veh_id in traci.vehicle.getIDList():
|
for veh_id in traci.vehicle.getIDList():
|
||||||
traci.vehicle.rerouteTraveltime(veh_id, True)
|
traci.vehicle.rerouteTraveltime(veh_id, True)
|
||||||
|
Loading…
Reference in New Issue
Block a user