21 #ifndef NBLoadedTLDef_h 22 #define NBLoadedTLDef_h 215 const std::vector<NBNode*>& junctions,
SUMOTime offset,
352 const std::string& state,
SignalGroup * findGroup(NBEdge *from, NBEdge *to) const
Returns the signal group which is responsible for the given connection.
bool mayDrive(SUMOTime time) const
Returns whether vehicles on controlled links may drive at the given time.
void setSignalYellowTimes(const std::string &groupid, SUMOTime tRedYellow, SUMOTime tYellow)
Sets the times the light is yellow or red/yellow.
void initNeedsContRelation() const
~SignalGroup()
Destructor.
A single signal group, may control several connections.
SignalGroup(const std::string &id)
Constructor.
void addSignalGroupPhaseBegin(const std::string &groupid, SUMOTime time, TLColor color)
Sets the information about the begin of a phase.
A SUMO-compliant built logic for a traffic light.
A loaded (complete) traffic light logic.
The representation of a single edge during network building.
void sortPhases()
Sorts the phases.
void collectNodes()
Collects the nodes participating in this traffic light.
bool containsOutgoing(NBEdge *to) const
Returns whether this signal controls a connection where the given edge is the destination.
The base class for traffic light logic definitions.
std::string buildPhaseState(int time) const
Builds the phase for a given time.
TLColor
An enumeration of possible tl-signal states.
SUMOTime myTime
The begin time of this phase.
std::map< std::string, SignalGroup * > SignalGroupCont
Definition of the container for signal groups.
Definition of a single, loaded phase.
void remapOutgoing(NBEdge *which, const EdgeVector &by)
Replaces the given outgoing edge by the others given.
int getLinkNo() const
Returns the number of links (connection) controlled by this signal.
void remapIncoming(NBEdge *which, const EdgeVector &by)
Replaces the given incoming edge by the others given.
bool addToSignalGroup(const std::string &groupid, const NBConnection &connection)
Adds a connection to a signal group.
SignalGroupCont mySignalGroups
Controlled signal groups.
PhaseDef(SUMOTime time, TLColor color)
Constructor.
void setCycleDuration(int cycleDur)
Sets the duration of a cycle.
std::vector< PhaseDef > myPhases
The phases of this signal.
Storage for edges, including some functionality operating on multiple edges.
bool containsConnection(NBEdge *from, NBEdge *to) const
Returns whether the given connection is controlled by this signal.
void remap(NBEdge *removed, int removedLane, NBEdge *by, int byLane)
Replaces a removed edge/lane.
void collectLinks()
Collects the links participating in this traffic light If a link could not be found.
void addConnection(const NBConnection &c)
Inserts a controlled connection.
std::vector< SUMOReal > getTimes(SUMOTime cycleDuration) const
Returns the times at which the signal switches.
Base class for objects which have an id.
void addPhaseBegin(SUMOTime time, TLColor color)
Sets the begin of a phase.
std::vector< NBConnection > NBConnectionVector
Definition of a connection vector.
bool hasYellow(SUMOTime time) const
Returns whether controlled links have yellow at the given time.
void setYellowTimes(SUMOTime tRedYellowe, SUMOTime tYellow)
Sets the times for redyellow and yellow.
NBLoadedTLDef(const NBEdgeCont &ec, const std::string &id, const std::vector< NBNode * > &junctions, SUMOTime offset, TrafficLightType type)
Constructor.
void patchTYellow(int tyellow, bool forced)
Sets the yellow time.
void setTLControllingInformation() const
Informs edges about being controlled by a tls.
SUMOTime myTRedYellow
The times of redyellow and yellow.
const NBConnection & getConnection(int pos) const
Returns the connection at the given index.
void addSignalGroup(const std::string &id)
Adds a signal group.
std::vector< NBEdge * > EdgeVector
Sorts phases by their begin time.
NBTrafficLightLogic * myCompute(int brakingTimeSeconds)
Computes the traffic light logic finally in dependence to the type.
int myCycleDuration
The duration of a single cycle.
Represents a single node (junction) during network building.
bool containsIncoming(NBEdge *from) const
Returns whether this signal controls the given edge.
void replaceRemoved(NBEdge *removed, int removedLane, NBEdge *by, int byLane)
Replaces a removed edge/lane.
NBConnectionVector myConnections
Connections controlled by this signal.
~NBLoadedTLDef()
Destructor.
TLColor myColor
A signal's color from this time.
void remapRemoved(NBEdge *removed, const EdgeVector &incoming, const EdgeVector &outgoing)
Replaces occurences of the removed edge in incoming/outgoing edges of all definitions.
phase_by_time_sorter()
Constructor.
const NBEdgeCont * myEdgeCont
bool mustBrake(const NBConnection &possProhibited, const std::string &state, int strmpos) const
Returns the information whether a connection must brake, given a phase.
int operator()(const PhaseDef &p1, const PhaseDef &p2)
Sorts phases by their begin time.