Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4 : // This program and the accompanying materials are made available under the
5 : // terms of the Eclipse Public License 2.0 which is available at
6 : // https://www.eclipse.org/legal/epl-2.0/
7 : // This Source Code may also be made available under the following Secondary
8 : // Licenses when the conditions for such availability set forth in the Eclipse
9 : // Public License 2.0 are satisfied: GNU General Public License, version 2
10 : // or later which is available at
11 : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 : /****************************************************************************/
14 : /// @file GUITrafficLightLogicWrapper.cpp
15 : /// @author Daniel Krajzewicz
16 : /// @author Jakob Erdmann
17 : /// @author Michael Behrisch
18 : /// @author Laura Bieker
19 : /// @date Oct/Nov 2003
20 : ///
21 : // A wrapper for tl-logics to allow their visualisation and interaction
22 : /****************************************************************************/
23 : #include <config.h>
24 :
25 : #include <cassert>
26 : #include <utils/common/MsgHandler.h>
27 : #include <utils/geom/GeomHelper.h>
28 : #include <utils/gui/globjects/GUIGlObject.h>
29 : #include <utils/gui/div/GLObjectValuePassConnector.h>
30 : #include <utils/gui/windows/GUIAppEnum.h>
31 : #include <utils/gui/images/GUIIconSubSys.h>
32 : #include <utils/gui/div/GLHelper.h>
33 : #include <utils/gui/div/GUIParameterTableWindow.h>
34 : #include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
35 : #include <utils/gui/div/GUIGlobalSelection.h>
36 : #include <microsim/MSLane.h>
37 : #include <microsim/traffic_lights/MSTrafficLightLogic.h>
38 : #include <microsim/traffic_lights/MSTLLogicControl.h>
39 : #include <microsim/traffic_lights/MSOffTrafficLightLogic.h>
40 : #include <microsim/traffic_lights/MSActuatedTrafficLightLogic.h>
41 : #include <microsim/traffic_lights/MSDelayBasedTrafficLightLogic.h>
42 : #include <microsim/traffic_lights/NEMAController.h>
43 : #include <microsim/traffic_lights/MSRailSignal.h>
44 : #include <microsim/logging/FunctionBinding.h>
45 : #include <microsim/logging/FuncBinding_StringParam.h>
46 : #include <gui/GUIApplicationWindow.h>
47 : #include <gui/GUITLLogicPhasesTrackerWindow.h>
48 : #include <gui/GUIGlobals.h>
49 : #include <utils/gui/globjects/GLIncludes.h>
50 : #include <utils/gui/div/GUIDesigns.h>
51 :
52 : #include "GUITrafficLightLogicWrapper.h"
53 : #include "GUINet.h"
54 :
55 : // ===========================================================================
56 : // FOX callback mapping
57 : // ===========================================================================
58 : FXDEFMAP(GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu)
59 : GUITrafficLightLogicWrapperPopupMenuMap[] = {
60 : FXMAPFUNC(SEL_COMMAND, MID_SHOWPHASES, GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdShowPhases),
61 : FXMAPFUNC(SEL_COMMAND, MID_TRACKPHASES, GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdBegin2TrackPhases),
62 : FXMAPFUNC(SEL_COMMAND, MID_SHOW_DETECTORS, GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdShowDetectors),
63 : FXMAPFUNC(SEL_COMMAND, MID_SWITCH_OFF, GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdSwitchTLS2Off),
64 : FXMAPFUNCS(SEL_COMMAND, MID_SWITCH, MID_SWITCH + 20, GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdSwitchTLSLogic),
65 : };
66 :
67 : // Object implementation
68 0 : FXIMPLEMENT(GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu, GUIGLObjectPopupMenu, GUITrafficLightLogicWrapperPopupMenuMap, ARRAYNUMBER(GUITrafficLightLogicWrapperPopupMenuMap))
69 :
70 :
71 : // ===========================================================================
72 : // method definitions
73 : // ===========================================================================
74 : /* -------------------------------------------------------------------------
75 : * GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu - methods
76 : * ----------------------------------------------------------------------- */
77 0 : GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::GUITrafficLightLogicWrapperPopupMenu(
78 0 : GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject* o) :
79 0 : GUIGLObjectPopupMenu(app, parent, o) {}
80 :
81 :
82 0 : GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::~GUITrafficLightLogicWrapperPopupMenu() {}
83 :
84 :
85 :
86 : long
87 0 : GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdBegin2TrackPhases(
88 : FXObject*, FXSelector, void*) {
89 : assert(myObject->getType() == GLO_TLLOGIC);
90 0 : static_cast<GUITrafficLightLogicWrapper*>(myObject)->begin2TrackPhases();
91 0 : return 1;
92 : }
93 :
94 :
95 : long
96 0 : GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdShowPhases(
97 : FXObject*, FXSelector, void*) {
98 : assert(myObject->getType() == GLO_TLLOGIC);
99 0 : static_cast<GUITrafficLightLogicWrapper*>(myObject)->showPhases();
100 0 : return 1;
101 : }
102 :
103 : long
104 0 : GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdShowDetectors(
105 : FXObject*, FXSelector, void*) {
106 : assert(myObject->getType() == GLO_TLLOGIC);
107 0 : GUITrafficLightLogicWrapper* w = static_cast<GUITrafficLightLogicWrapper*>(myObject);
108 0 : MSActuatedTrafficLightLogic* act = dynamic_cast<MSActuatedTrafficLightLogic*>(&w->getTLLogic());
109 0 : if (act != nullptr) {
110 0 : act->setShowDetectors(!act->showDetectors());
111 : } else {
112 0 : MSDelayBasedTrafficLightLogic* db = dynamic_cast<MSDelayBasedTrafficLightLogic*>(&w->getTLLogic());
113 0 : if (db != nullptr) {
114 0 : db->setShowDetectors(!db->showDetectors());
115 : } else {
116 0 : NEMALogic* nema = dynamic_cast<NEMALogic*>(&w->getTLLogic());
117 0 : if (nema != nullptr) {
118 0 : nema->setShowDetectors(!nema->showDetectors());
119 : }
120 : }
121 : }
122 0 : myParent->update();
123 0 : return 1;
124 : }
125 :
126 : long
127 0 : GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdSwitchTLS2Off(
128 : FXObject*, FXSelector /*sel*/, void*) {
129 : assert(myObject->getType() == GLO_TLLOGIC);
130 0 : static_cast<GUITrafficLightLogicWrapper*>(myObject)->switchTLSLogic(-1);
131 0 : myParent->update();
132 0 : return 1;
133 : }
134 :
135 :
136 : long
137 0 : GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdSwitchTLSLogic(
138 : FXObject*, FXSelector sel, void*) {
139 : assert(myObject->getType() == GLO_TLLOGIC);
140 0 : static_cast<GUITrafficLightLogicWrapper*>(myObject)->switchTLSLogic(FXSELID(sel) - MID_SWITCH);
141 0 : myParent->update();
142 0 : return 1;
143 : }
144 :
145 :
146 :
147 : /* -------------------------------------------------------------------------
148 : * GUITrafficLightLogicWrapper - methods
149 : * ----------------------------------------------------------------------- */
150 19464 : GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapper(MSTLLogicControl& control, MSTrafficLightLogic& tll) :
151 : GUIGlObject(GLO_TLLOGIC, tll.getID(), GUIIconSubSys::getIcon(GUIIcon::LOCATETLS)),
152 19464 : myTLLogicControl(control), myTLLogic(tll) {
153 19464 : }
154 :
155 :
156 38884 : GUITrafficLightLogicWrapper::~GUITrafficLightLogicWrapper() {}
157 :
158 :
159 : GUIGLObjectPopupMenu*
160 0 : GUITrafficLightLogicWrapper::getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) {
161 0 : myApp = &app;
162 0 : GUIGLObjectPopupMenu* ret = new GUITrafficLightLogicWrapperPopupMenu(app, parent, this);
163 0 : buildPopupHeader(ret, app);
164 0 : buildCenterPopupEntry(ret);
165 0 : const MSTLLogicControl::TLSLogicVariants& vars = myTLLogicControl.get(myTLLogic.getID());
166 0 : std::vector<MSTrafficLightLogic*> logics = vars.getAllLogics();
167 0 : if (logics.size() > 1) {
168 : std::vector<MSTrafficLightLogic*>::const_iterator i;
169 : int index = 0;
170 0 : for (i = logics.begin(); i != logics.end(); ++i, ++index) {
171 0 : if (!vars.isActive(*i) && dynamic_cast<MSOffTrafficLightLogic*>(*i) == nullptr) {
172 0 : GUIDesigns::buildFXMenuCommand(ret, TLF("Switch to '%'", (*i)->getProgramID()),
173 0 : GUIIconSubSys::getIcon(GUIIcon::FLAG_MINUS), ret, (FXSelector)(MID_SWITCH + index));
174 : }
175 : }
176 0 : new FXMenuSeparator(ret);
177 : }
178 0 : MSOffTrafficLightLogic* offLogic = dynamic_cast<MSOffTrafficLightLogic*>(vars.getActive());
179 0 : if (offLogic == nullptr) {
180 0 : GUIDesigns::buildFXMenuCommand(ret, TL("Switch off"), GUIIconSubSys::getIcon(GUIIcon::FLAG_MINUS), ret, MID_SWITCH_OFF);
181 : }
182 0 : GUIDesigns::buildFXMenuCommand(ret, TL("Track Phases"), nullptr, ret, MID_TRACKPHASES);
183 0 : GUIDesigns::buildFXMenuCommand(ret, TL("Show Phases"), nullptr, ret, MID_SHOWPHASES);
184 0 : MSActuatedTrafficLightLogic* act = dynamic_cast<MSActuatedTrafficLightLogic*>(&myTLLogic);
185 0 : if (act != nullptr) {
186 0 : GUIDesigns::buildFXMenuCommand(ret, act->showDetectors() ? TL("Hide Detectors") : TL("Show Detectors"), nullptr, ret, MID_SHOW_DETECTORS);
187 : }
188 0 : MSDelayBasedTrafficLightLogic* db = dynamic_cast<MSDelayBasedTrafficLightLogic*>(&myTLLogic);
189 0 : if (db != nullptr) {
190 0 : GUIDesigns::buildFXMenuCommand(ret, db->showDetectors() ? TL("Hide Detectors") : TL("Show Detectors"), nullptr, ret, MID_SHOW_DETECTORS);
191 : }
192 0 : NEMALogic* nema = dynamic_cast<NEMALogic*>(&myTLLogic);
193 0 : if (nema != nullptr) {
194 0 : GUIDesigns::buildFXMenuCommand(ret, nema->showDetectors() ? TL("Hide Detectors") : TL("Show Detectors"), nullptr, ret, MID_SHOW_DETECTORS);
195 : }
196 0 : new FXMenuSeparator(ret);
197 0 : MSTrafficLightLogic* tll = getActiveTLLogic();
198 0 : buildNameCopyPopupEntry(ret);
199 0 : buildSelectionPopupEntry(ret);
200 0 : GUIDesigns::buildFXMenuCommand(ret, TLF("Phase: %", toString(tll->getCurrentPhaseIndex())), nullptr, nullptr, 0);
201 0 : const std::string& name = tll->getCurrentPhaseDef().getName();
202 0 : if (name != "") {
203 0 : GUIDesigns::buildFXMenuCommand(ret, TLF("Phase name: %", name), nullptr, nullptr, 0);
204 : }
205 0 : new FXMenuSeparator(ret);
206 0 : buildShowParamsPopupEntry(ret, false);
207 0 : buildPositionCopyEntry(ret, app);
208 0 : return ret;
209 0 : }
210 :
211 :
212 : void
213 0 : GUITrafficLightLogicWrapper::begin2TrackPhases(GUIMainWindow* app) {
214 0 : if (app != nullptr) {
215 0 : myApp = app;
216 : }
217 : assert(myApp != nullptr);
218 : GUITLLogicPhasesTrackerWindow* window =
219 0 : new GUITLLogicPhasesTrackerWindow(*myApp, myTLLogic, *this,
220 : new FuncBinding_StringParam<MSTLLogicControl, std::pair<SUMOTime, MSPhaseDefinition> >
221 0 : (&MSNet::getInstance()->getTLSControl(), &MSTLLogicControl::getPhaseDef, myTLLogic.getID()));
222 0 : window->create();
223 0 : window->show();
224 0 : }
225 :
226 :
227 : void
228 0 : GUITrafficLightLogicWrapper::showPhases() {
229 : GUITLLogicPhasesTrackerWindow* window =
230 0 : new GUITLLogicPhasesTrackerWindow(*myApp, myTLLogic, *this,
231 0 : static_cast<MSSimpleTrafficLightLogic&>(myTLLogic).getPhases());
232 0 : window->setBeginTime(0);
233 0 : window->create();
234 0 : window->show();
235 0 : }
236 :
237 :
238 : GUIParameterTableWindow*
239 0 : GUITrafficLightLogicWrapper::getParameterWindow(GUIMainWindow& app,
240 : GUISUMOAbstractView&) {
241 0 : GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this);
242 0 : ret->mkItem(TL("tlLogic [id]"), false, myTLLogic.getID());
243 0 : ret->mkItem(TL("type"), false, toString(myTLLogic.getLogicType()));
244 0 : ret->mkItem(TL("program"), false, myTLLogic.getProgramID());
245 0 : ret->mkItem(TL("phase"), true, new FunctionBinding<GUITrafficLightLogicWrapper, int>(this, &GUITrafficLightLogicWrapper::getCurrentPhase));
246 0 : ret->mkItem(TL("phase name"), true, new FunctionBindingString<GUITrafficLightLogicWrapper>(this, &GUITrafficLightLogicWrapper::getCurrentPhaseName));
247 0 : ret->mkItem(TL("duration"), true, new FunctionBinding<GUITrafficLightLogicWrapper, int>(this, &GUITrafficLightLogicWrapper::getCurrentDurationSeconds));
248 0 : ret->mkItem(TL("minDur"), true, new FunctionBinding<GUITrafficLightLogicWrapper, int>(this, &GUITrafficLightLogicWrapper::getCurrentMinDurSeconds));
249 0 : ret->mkItem(TL("maxDur"), true, new FunctionBinding<GUITrafficLightLogicWrapper, int>(this, &GUITrafficLightLogicWrapper::getCurrentMaxDurSeconds));
250 0 : ret->mkItem(TL("running duration"), true, new FunctionBinding<GUITrafficLightLogicWrapper, int>(this, &GUITrafficLightLogicWrapper::getRunningDurationSeconds));
251 0 : ret->mkItem(TL("earliestEnd"), true, new FunctionBinding<GUITrafficLightLogicWrapper, int>(this, &GUITrafficLightLogicWrapper::getCurrentEarliestEndSeconds));
252 0 : ret->mkItem(TL("latestEnd"), true, new FunctionBinding<GUITrafficLightLogicWrapper, int>(this, &GUITrafficLightLogicWrapper::getCurrentLatestEndSeconds));
253 0 : ret->mkItem(TL("time in cycle"), true, new FunctionBinding<GUITrafficLightLogicWrapper, int>(this, &GUITrafficLightLogicWrapper::getCurrentTimeInCycleSeconds));
254 0 : ret->mkItem(TL("cycle time"), true, new FunctionBinding<GUITrafficLightLogicWrapper, int>(this, &GUITrafficLightLogicWrapper::getDefaultCycleTimeSeconds));
255 0 : MSRailSignal* rs = dynamic_cast<MSRailSignal*>(&myTLLogic);
256 0 : if (rs != nullptr) {
257 0 : ret->mkItem(TL("req driveway"), true, new FunctionBindingString<MSRailSignal>(rs, &MSRailSignal::getRequestedDriveWay));
258 0 : ret->mkItem(TL("blocking"), true, new FunctionBindingString<MSRailSignal>(rs, &MSRailSignal::getBlockingVehicleIDs));
259 0 : ret->mkItem(TL("blocking driveways"), true, new FunctionBindingString<MSRailSignal>(rs, &MSRailSignal::getBlockingDriveWayIDs));
260 0 : ret->mkItem(TL("rival"), true, new FunctionBindingString<MSRailSignal>(rs, &MSRailSignal::getRivalVehicleIDs));
261 0 : ret->mkItem(TL("priority"), true, new FunctionBindingString<MSRailSignal>(rs, &MSRailSignal::getPriorityVehicleIDs));
262 0 : ret->mkItem(TL("constraint"), true, new FunctionBindingString<MSRailSignal>(rs, &MSRailSignal::getConstraintInfo));
263 : }
264 : // close building
265 0 : ret->closeBuilding(&myTLLogic);
266 0 : return ret;
267 : }
268 :
269 :
270 : Boundary
271 19464 : GUITrafficLightLogicWrapper::getCenteringBoundary() const {
272 19464 : Boundary ret;
273 19464 : const MSTrafficLightLogic::LaneVectorVector& lanes = myTLLogic.getLaneVectors();
274 222859 : for (MSTrafficLightLogic::LaneVectorVector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
275 : const MSTrafficLightLogic::LaneVector& lanes2 = (*i);
276 406467 : for (MSTrafficLightLogic::LaneVector::const_iterator j = lanes2.begin(); j != lanes2.end(); ++j) {
277 203072 : ret.add((*j)->getShape()[-1]);
278 : }
279 : }
280 19464 : ret.grow(20);
281 19464 : return ret;
282 : }
283 :
284 : const std::string
285 0 : GUITrafficLightLogicWrapper::getOptionalName() const {
286 0 : return myTLLogic.getParameter("name", "");
287 : }
288 :
289 :
290 : void
291 0 : GUITrafficLightLogicWrapper::switchTLSLogic(int to) {
292 0 : if (to == -1) {
293 0 : myTLLogicControl.switchTo(myTLLogic.getID(), "off");
294 0 : GUINet::getGUIInstance()->createTLWrapper(getActiveTLLogic());
295 : } else {
296 0 : const MSTLLogicControl::TLSLogicVariants& vars = myTLLogicControl.get(myTLLogic.getID());
297 0 : std::vector<MSTrafficLightLogic*> logics = vars.getAllLogics();
298 0 : myTLLogicControl.switchTo(myTLLogic.getID(), logics[to]->getProgramID());
299 0 : }
300 0 : }
301 :
302 :
303 : int
304 0 : GUITrafficLightLogicWrapper::getLinkIndex(const MSLink* const link) const {
305 0 : return myTLLogic.getLinkIndex(link);
306 : }
307 :
308 :
309 : void
310 745127 : GUITrafficLightLogicWrapper::drawGL(const GUIVisualizationSettings& s) const {
311 745127 : if (s.gaming) {
312 0 : if (!MSNet::getInstance()->getTLSControl().isActive(&myTLLogic) || myTLLogic.getPhases().size() == 0) {
313 0 : return;
314 : }
315 0 : const std::string& curState = myTLLogic.getCurrentPhaseDef().getState();
316 0 : if (curState.find_first_of("gG") == std::string::npos) {
317 : // no link is 'green' at the moment. find those that turn green next
318 0 : const MSTrafficLightLogic::Phases& phases = myTLLogic.getPhases();
319 0 : int curPhaseIdx = myTLLogic.getCurrentPhaseIndex();
320 0 : int phaseIdx = (curPhaseIdx + 1) % phases.size();
321 : std::vector<int> nextGreen;
322 0 : while (phaseIdx != curPhaseIdx) {
323 0 : const std::string& state = phases[phaseIdx]->getState();
324 0 : for (int linkIdx = 0; linkIdx < (int)state.size(); linkIdx++) {
325 0 : if ((LinkState)state[linkIdx] == LINKSTATE_TL_GREEN_MINOR ||
326 : (LinkState)state[linkIdx] == LINKSTATE_TL_GREEN_MAJOR) {
327 0 : nextGreen.push_back(linkIdx);
328 : }
329 : }
330 0 : if (nextGreen.size() > 0) {
331 : break;
332 : }
333 0 : phaseIdx = (phaseIdx + 1) % phases.size();
334 : }
335 : // highlight nextGreen links
336 0 : for (const int idx : nextGreen) {
337 0 : for (const MSLane* const lane : myTLLogic.getLanesAt(idx)) {
338 0 : GLHelper::pushMatrix();
339 : // split circle in red and yellow
340 : const Position& pos = lane->getShape().back();
341 0 : glTranslated(pos.x(), pos.y(), GLO_MAX);
342 0 : double rot = RAD2DEG(lane->getShape().angleAt2D((int)lane->getShape().size() - 2)) - 90;
343 0 : glRotated(rot, 0, 0, 1);
344 0 : GLHelper::setColor(s.getLinkColor(LINKSTATE_TL_RED));
345 0 : GLHelper::drawFilledCircle(lane->getWidth() / 2., 8, -90, 90);
346 0 : if (!isRailway(lane->getPermissions())) {
347 : // no yellow half-cirlce in railway game
348 0 : GLHelper::setColor(s.getLinkColor(LINKSTATE_TL_YELLOW_MAJOR));
349 0 : GLHelper::drawFilledCircle(lane->getWidth() / 2., 8, 90, 270);
350 : }
351 0 : GLHelper::popMatrix();
352 : }
353 : }
354 0 : }
355 : }
356 : }
357 :
358 : MSTrafficLightLogic*
359 0 : GUITrafficLightLogicWrapper::getActiveTLLogic() const {
360 0 : return myTLLogicControl.getActive(myTLLogic.getID());
361 : }
362 :
363 : int
364 0 : GUITrafficLightLogicWrapper::getCurrentPhase() const {
365 0 : return getActiveTLLogic()->getCurrentPhaseIndex();
366 : }
367 :
368 : std::string
369 0 : GUITrafficLightLogicWrapper::getCurrentPhaseName() const {
370 0 : return getActiveTLLogic()->getCurrentPhaseDef().getName();
371 : }
372 :
373 : int
374 0 : GUITrafficLightLogicWrapper::getCurrentDurationSeconds() const {
375 0 : return (int)STEPS2TIME(getActiveTLLogic()->getCurrentPhaseDef().duration);
376 : }
377 :
378 : int
379 0 : GUITrafficLightLogicWrapper::getCurrentMinDurSeconds() const {
380 0 : return (int)STEPS2TIME(getActiveTLLogic()->getMinDur());
381 : }
382 :
383 : int
384 0 : GUITrafficLightLogicWrapper::getCurrentMaxDurSeconds() const {
385 0 : return (int)STEPS2TIME(getActiveTLLogic()->getMaxDur());
386 : }
387 :
388 : int
389 0 : GUITrafficLightLogicWrapper::getCurrentEarliestEndSeconds() const {
390 0 : const SUMOTime earliestEnd = getActiveTLLogic()->getEarliestEnd();
391 0 : return earliestEnd == MSPhaseDefinition::UNSPECIFIED_DURATION ? -1 : (int)STEPS2TIME(earliestEnd);
392 : }
393 :
394 : int
395 0 : GUITrafficLightLogicWrapper::getCurrentLatestEndSeconds() const {
396 0 : const SUMOTime latestEnd = getActiveTLLogic()->getLatestEnd();
397 0 : return latestEnd == MSPhaseDefinition::UNSPECIFIED_DURATION ? -1 : (int)STEPS2TIME(latestEnd);
398 : }
399 :
400 : int
401 0 : GUITrafficLightLogicWrapper::getDefaultCycleTimeSeconds() const {
402 0 : return (int)STEPS2TIME(getActiveTLLogic()->getDefaultCycleTime());
403 : }
404 :
405 : int
406 0 : GUITrafficLightLogicWrapper::getCurrentTimeInCycleSeconds() const {
407 0 : return (int)STEPS2TIME(getActiveTLLogic()->getTimeInCycle());
408 : }
409 :
410 : int
411 0 : GUITrafficLightLogicWrapper::getRunningDurationSeconds() const {
412 0 : return (int)STEPS2TIME(getActiveTLLogic()->getSpentDuration());
413 : }
414 :
415 :
416 : /****************************************************************************/
|