42 #ifdef CHECK_MEMORY_LEAKS
44 #endif // CHECK_MEMORY_LEAKS
52 myLanes(
MSLane::dictSize()),
53 myLastLaneChange(
MSEdge::dictSize()) {
55 for (std::vector< MSEdge* >::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
56 const std::vector<MSLane*>& lanes = (*i)->getLanes();
57 if (!(*i)->hasLaneChanger()) {
58 int pos = (*lanes.begin())->getNumericalID();
59 myLanes[pos].lane = *(lanes.begin());
60 myLanes[pos].firstNeigh = lanes.end();
61 myLanes[pos].lastNeigh = lanes.end();
63 myLanes[pos].haveNeighbors =
false;
65 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
66 int pos = (*j)->getNumericalID();
68 myLanes[pos].firstNeigh = (j + 1);
69 myLanes[pos].lastNeigh = lanes.end();
71 myLanes[pos].haveNeighbors =
true;
88 if (!lu.
amActive && (*i)->getVehicleNumber() > 0) {
104 if ((*i)->getVehicleNumber() == 0) {
105 myLanes[(*i)->getNumericalID()].amActive =
false;
108 (*i)->planMovements(t);
120 myLanes[(*i)->getNumericalID()].amActive =
false;
127 if ((*i)->integrateNewVehicle(t)) {
142 for (LaneUsageVector::iterator it =
myLanes.begin(); it !=
myLanes.end(); ++it) {
143 (*it).lane->sortPartialVehicles();
151 std::vector<MSLane*> toAdd;
155 MSEdge& edge = (*i)->getEdge();
159 const std::vector<MSLane*>& lanes = edge.
getLanes();
160 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
166 if ((*i)->getVehicleNumber() > 0 && !lu.
amActive) {
177 for (std::vector<MSLane*>::iterator i = toAdd.begin(); i != toAdd.end(); ++i) {
187 (*i)->detectCollisions(timestep, stage);
192 std::vector<std::string>
194 std::vector<std::string> ret;
195 for (MSEdgeVector::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
196 ret.push_back((*i)->getID());
std::list< MSLane * > myActiveLanes
The list of active (not empty) lanes.
~MSEdgeControl()
Destructor.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
std::vector< std::string > getEdgeNames() const
Returns the list of names of all known edges.
void patchActiveLanes()
Resets information whether a lane is active for all lanes.
std::set< MSLane *, Named::ComparatorIdLess > myChangedStateLanes
Lanes which changed the state without informing the control.
LaneUsageVector myLanes
Information about lanes' number of vehicles and neighbors.
void changeLanes(SUMOTime t)
Moves (precomputes) critical vehicles.
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.
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...
void executeMovements(SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
int getNumericalID() const
Returns the numerical id of the edge.
virtual void changeLanes(SUMOTime t)
Performs lane changing on this edge.
static SUMOReal gLateralResolution
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.