54 #ifdef CHECK_MEMORY_LEAKS
56 #endif // CHECK_MEMORY_LEAKS
148 std::vector<MSTrafficLightLogic*> logics = vars.
getAllLogics();
149 if (logics.size() > 1) {
150 std::vector<MSTrafficLightLogic*>::const_iterator i;
152 for (i = logics.begin(); i != logics.end(); ++i, ++index) {
154 new FXMenuCommand(ret, (
"Switch to '" + (*i)->getProgramID() +
"'").c_str(),
158 new FXMenuSeparator(ret);
163 new FXMenuSeparator(ret);
187 static_cast<MSSimpleTrafficLightLogic&>(
myTLLogic).getPhases());
205 for (MSTrafficLightLogic::LaneVectorVector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
207 for (MSTrafficLightLogic::LaneVector::const_iterator j = lanes2.begin(); j != lanes2.end(); ++j) {
208 ret.
add((*j)->getShape()[-1]);
224 std::vector<MSTrafficLightLogic*> logics = vars.
getAllLogics();
243 if (curState.find_first_of(
"gG") == std::string::npos) {
247 unsigned int phaseIdx = (curPhaseIdx + 1) % phases.size();
248 std::vector<unsigned int> nextGreen;
249 while (phaseIdx != curPhaseIdx) {
250 const std::string& state = phases[phaseIdx]->getState();
251 for (
unsigned int linkIdx = 0; linkIdx < state.size(); linkIdx++) {
254 nextGreen.push_back(linkIdx);
257 if (nextGreen.size() > 0) {
260 phaseIdx = (phaseIdx + 1) % phases.size();
263 for (std::vector<unsigned int>::iterator it_idx = nextGreen.begin(); it_idx != nextGreen.end(); it_idx++) {
265 for (MSTrafficLightLogic::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
268 Position pos = (*it_lane)->getShape().back();
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
The link has green light, may pass.
virtual const MSPhaseDefinition & getCurrentPhaseDef() const =0
Returns the definition of the current phase.
const std::string & getState() const
Returns the state within this phase.
virtual unsigned int getCurrentPhaseIndex() const =0
Returns the current index within the program.
Show TLS phases - popup entry.
Storage for all programs of a single tls.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
int getLinkIndex(const MSLink *const link) const
Returns the index of the given link.
void switchTo(const std::string &id, const std::string &programID)
Switches the named (id) tls to the named (programID) program.
bool gaming
whether the application is in gaming mode or not
The link has green light, has to brake.
Stores the information about how to visualize structures.
void create()
Creates the window (FOX-Toolkit)
int getLinkIndex(const MSLink *const link) const
Returns the index of the given link within the according tls.
void begin2TrackPhases()
Builds a GUITLLogicPhasesTrackerWindow which will receive new phases.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
MSTrafficLightLogic * getActive(const std::string &id) const
Returns the active program of a named tls.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSTLLogicControl & myTLLogicControl
Reference to the according tls.
GUIMainWindow * myApp
The main application.
SUMOReal x() const
Returns the x-position.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
A class that stores a 2D geometrical boundary.
FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[]
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void showPhases()
Builds a GUITLLogicPhasesTrackerWindow which displays the phase diagram.
A class that stores and controls tls and switching of their programs.
std::vector< MSTrafficLightLogic * > getAllLogics() const
static void drawFilledCircle(SUMOReal width, int steps=8)
Draws a filled circle around (0,0)
const std::string & getID() const
Returns the id.
GUIGlID createTLWrapper(MSTrafficLightLogic *tll)
creates a wrapper for the given logic and returns the GlID
bool isActive(const MSTrafficLightLogic *tl) const
std::pair< SUMOTime, MSPhaseDefinition > getPhaseDef(const std::string &tlid) const
return the complete phase definition for a named traffic lights logic
GUITrafficLightLogicWrapperPopupMenuMap[]
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
A point in 2D or 3D with translation and scaling methods.
const LaneVector & getLanesAt(unsigned int i) const
Returns the list of lanes that are controlled by the signals at the given position.
~GUITrafficLightLogicWrapper()
Destructor.
void switchTLSLogic(int to)
Builds a GUITLLogicPhasesTrackerWindow which displays the phase diagram.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
MSTrafficLightLogic & myTLLogic
The wrapped tl-logic.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
const LaneVectorVector & getLaneVectors() const
Returns the list of lists of all lanes controlled by this tls.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
virtual const Phases & getPhases() const =0
Returns the phases of this tls program.
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
std::vector< MSLane * > LaneVector
Definition of the list of links that participate in this tl-light.
std::vector< LaneVector > LaneVectorVector
Definition of a list that holds lists of links that do have the same attribute.
Begin to track phases - menu entry.
SUMOReal y() const
Returns the y-position.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
This window displays a phase diagram for a chosen tl-logic.
GUITrafficLightLogicWrapper(MSTLLogicControl &control, MSTrafficLightLogic &tll)
Constructor.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
The parent class for traffic light logics.
void setBeginTime(SUMOTime time)
Sets the time the display shall be shown as beginning at.
GUITLLogicPhasesTrackerWindow()
protected constructor for FOX
A window containing a gl-object's parameter.
static FXIcon * getIcon(GUIIcon which)
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.