Skip to content

Commit

Permalink
can now show NEMA detectors refs #36, #9520
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Nov 12, 2021
1 parent 9e61f10 commit 574ac6e
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/guisim/GUITrafficLightLogicWrapper.cpp
Expand Up @@ -37,6 +37,7 @@
#include <microsim/traffic_lights/MSTLLogicControl.h>
#include <microsim/traffic_lights/MSActuatedTrafficLightLogic.h>
#include <microsim/traffic_lights/MSDelayBasedTrafficLightLogic.h>
#include <microsim/traffic_lights/NEMAController.h>
#include <microsim/traffic_lights/MSRailSignal.h>
#include <microsim/logging/FunctionBinding.h>
#include <microsim/logging/FuncBinding_StringParam.h>
Expand Down Expand Up @@ -104,12 +105,18 @@ GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdShowDete
assert(myObject->getType() == GLO_TLLOGIC);
GUITrafficLightLogicWrapper* w = static_cast<GUITrafficLightLogicWrapper*>(myObject);
MSActuatedTrafficLightLogic* act = dynamic_cast<MSActuatedTrafficLightLogic*>(&w->getTLLogic());
if (act == nullptr) {
MSDelayBasedTrafficLightLogic* db = dynamic_cast<MSDelayBasedTrafficLightLogic*>(&w->getTLLogic());
assert(db != 0);
db->setShowDetectors(!db->showDetectors());
} else {
if (act != nullptr) {
act->setShowDetectors(!act->showDetectors());
} else {
MSDelayBasedTrafficLightLogic* db = dynamic_cast<MSDelayBasedTrafficLightLogic*>(&w->getTLLogic());
if (db != nullptr) {
db->setShowDetectors(!db->showDetectors());
} else {
NEMALogic* nema = dynamic_cast<NEMALogic*>(&w->getTLLogic());
if (nema != nullptr) {
nema->setShowDetectors(!nema->showDetectors());
}
}
}
return 1;
}
Expand Down Expand Up @@ -177,6 +184,10 @@ GUITrafficLightLogicWrapper::getPopUpMenu(GUIMainWindow& app,
if (db != nullptr) {
GUIDesigns::buildFXMenuCommand(ret, db->showDetectors() ? "Hide Detectors" : "Show Detectors", nullptr, ret, MID_SHOW_DETECTORS);
}
NEMALogic* nema = dynamic_cast<NEMALogic*>(&myTLLogic);
if (nema != nullptr) {
GUIDesigns::buildFXMenuCommand(ret, nema->showDetectors() ? "Hide Detectors" : "Show Detectors", nullptr, ret, MID_SHOW_DETECTORS);
}
new FXMenuSeparator(ret);
MSTrafficLightLogic* tll = getActiveTLLogic();
buildNameCopyPopupEntry(ret);
Expand Down

0 comments on commit 574ac6e

Please sign in to comment.