47 myLanes(
MSLane::dictSize()),
48 myLastLaneChange(
MSEdge::dictSize()) {
50 for (std::vector< MSEdge* >::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
51 const std::vector<MSLane*>& lanes = (*i)->getLanes();
52 if (!(*i)->hasLaneChanger()) {
53 int pos = (*lanes.begin())->getNumericalID();
54 myLanes[pos].lane = *(lanes.begin());
55 myLanes[pos].firstNeigh = lanes.end();
56 myLanes[pos].lastNeigh = lanes.end();
58 myLanes[pos].haveNeighbors =
false;
60 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
61 int pos = (*j)->getNumericalID();
63 myLanes[pos].firstNeigh = (j + 1);
64 myLanes[pos].lastNeigh = lanes.end();
66 myLanes[pos].haveNeighbors =
true;
83 if (!lu.
amActive && (*i)->getVehicleNumber() > 0) {
99 if ((*i)->getVehicleNumber() == 0) {
100 myLanes[(*i)->getNumericalID()].amActive =
false;
103 (*i)->planMovements(t);
115 myLanes[(*i)->getNumericalID()].amActive =
false;
122 if ((*i)->integrateNewVehicle(t)) {
137 for (LaneUsageVector::iterator it =
myLanes.begin(); it !=
myLanes.end(); ++it) {
138 (*it).lane->sortPartialVehicles();
139 (*it).lane->sortManeuverReservations();
147 std::vector<MSLane*> toAdd;
151 MSEdge& edge = (*i)->getEdge();
155 const std::vector<MSLane*>& lanes = edge.
getLanes();
156 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
162 if ((*i)->getVehicleNumber() > 0 && !lu.
amActive) {
173 for (std::vector<MSLane*>::iterator i = toAdd.begin(); i != toAdd.end(); ++i) {
183 (*i)->detectCollisions(timestep, stage);
188 std::vector<std::string>
190 std::vector<std::string> ret;
191 for (MSEdgeVector::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
192 ret.push_back((*i)->getID());
205 for (MSEdgeVector::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
206 const std::vector<MSLane*>& lanes = (*i)->getLanes();
207 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
208 (*j)->initRestrictions();
std::list< MSLane * > myActiveLanes
The list of active (not empty) lanes.
static double gLateralResolution
~MSEdgeControl()
Destructor.
void patchActiveLanes()
Resets information whether a lane is active for all lanes.
LaneUsageVector myLanes
Information about lanes' number of vehicles and neighbors.
void changeLanes(SUMOTime t)
Moves (precomputes) critical vehicles.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
bool amActive
Information whether this lane is active.
A structure holding some basic information about a simulated lane.
void gotActive(MSLane *l)
Informs the control that the given lane got active.
void detectCollisions(SUMOTime timestep, const std::string &stage)
Detect collisions.
int getNumericalID() const
Returns the numerical id of the edge.
void setAdditionalRestrictions()
apply additional restrictions
std::vector< std::string > getEdgeNames() const
Returns the list of names of all known edges.
A road/street connecting two junctions.
std::vector< SUMOTime > myLastLaneChange
The list of active (not empty) lanes.
MSEdgeVector myEdges
Loaded edges.
void planMovements(SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step...
std::set< MSLane *, ComparatorIdLess > myChangedStateLanes
Lanes which changed the state without informing the control.
void executeMovements(SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
virtual void changeLanes(SUMOTime t)
Performs lane changing on this edge.
bool haveNeighbors
Information whether this lane belongs to a multi-lane edge.
std::vector< MSLane * > myWithVehicles2Integrate
A storage for lanes which shall be integrated because vehicles have moved onto them.
MSEdgeControl(const std::vector< MSEdge * > &edges)
Constructor.
Representation of a lane in the micro simulation.