100 GNEFrame(viewParent, viewNet,
TL("Edit Traffic Light")),
101 myEditedDef(
nullptr) {
176 for (
const auto& junction : viewObjects.
getJunctions()) {
195 FXuint answer = FXMessageBox::question(
this, MBOX_YES_NO_CANCEL,
196 TL(
"Save TLS Changes"),
"%s",
197 TL(
"There are unsaved changes in the currently edited traffic light.\nDo you want to save it before changing mode?"));
198 if (answer == MBOX_CLICKED_YES) {
202 }
else if (answer == MBOX_CLICKED_NO) {
222 std::set<NBTrafficLightDefinition*> origDefs;
226 if (logic !=
nullptr) {
228 std::vector<NBNode*> nodes = def->getNodes();
229 for (
auto it_node : nodes) {
234 tmpTLLCont.
insert(duplicate);
235 origDefs.insert(duplicate);
237 WRITE_WARNINGF(
TL(
"tlLogic '%', program '%' could not be built"), def->getID(), def->getProgramID());
243 std::vector<NBLoadedSUMOTLDef*> loadedTLS;
246 if (sdef !=
nullptr) {
247 loadedTLS.push_back(sdef);
251 for (
auto def : loadedTLS) {
252 if (origDefs.count(def) != 0) {
257 std::vector<NBNode*> nodes = def->getNodes();
259 for (
auto it_node : nodes) {
267 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
338 for (
const auto& internalLane : internalLanes.second) {
348 if (tlDef !=
nullptr) {
349 const int NUM_POINTS = 10;
352 const std::string innerID =
":" + nbnCurrentJunction->
getID();
355 for (
const auto& link : links) {
356 int tlIndex = link.getTLIndex();
359 const NBEdge::Connection& con = link.getFrom()->getConnection(link.getFromLane(), link.getTo(), link.getToLane());
363 shape = link.getFrom()->getToNode()->computeInternalLaneShape(link.getFrom(),
NBEdge::Connection(link.getFromLane(),
364 link.getTo(), link.getToLane()), NUM_POINTS);
369 const PositionVector laneShapeFrom = link.getFrom()->getLaneShape(link.getFromLane());
370 const PositionVector laneShapeTo = link.getTo()->getLaneShape(link.getToLane());
380 for (
const auto& nbn : tlDef->
getNodes()) {
381 for (
const auto& crossing : nbn->getCrossings()) {
382 if (crossing->tlLinkIndex2 > 0 && crossing->tlLinkIndex2 != crossing->tlLinkIndex) {
395 myInternalLanes[crossing->tlLinkIndex2].push_back(internalLaneReverse);
451 std::set<std::string> fromIDs;
456 fromIDs.insert(it_lane->getMicrosimID());
462 for (
const auto& edge : selectedEdge) {
463 for (
auto it_lane : edge->getChildLanes()) {
464 fromIDs.insert(it_lane->getMicrosimID());
471 for (
auto it_lane : selectedLanes) {
472 fromIDs.insert(it_lane->getMicrosimID());
478 for (
auto it : links) {
479 if (fromIDs.count(it.getFrom()->getLaneID(it.getFromLane())) > 0) {
480 std::vector<GNEInternalLane*> lanes =
myInternalLanes[it.getTLIndex()];
481 for (
auto it_lane : lanes) {
482 it_lane->onDefault(obj, sel, eventData);
494 for (
auto it : links) {
538 return TIME2STEPS(GNEAttributeCarrier::parse<double>(
string));
552 myTLSEditorParent(TLSEditorParent) {
567 TL(
"Assign E1 detectors") + std::string(
"\t") +
TL(
"Enable assign E1 mode") + std::string(
"\t") +
TL(
"Assign E1 detectors to the current TLS"),
568 TL(
"Assign E1 detectors") + std::string(
"\t") +
TL(
"Disable assign E1 mode") + std::string(
"\t") +
TL(
"Assign E1 detectors to the current TLS"),
580 if (myTLSEditorParent->myTLSPrograms->getNumberOfPrograms() == 0) {
582 myOffsetTextField->disable();
583 myButtonEditParameters->disable();
584 myParametersTextField->disable();
586 disableE1DetectorMode();
587 mySetDetectorsToggleButton->disable();
589 if (myE1Detectors.size() > 0) {
590 myE1Detectors.clear();
591 myTLSEditorParent->getViewNet()->update();
593 }
else if (myTLSEditorParent->myTLSJunction->isJoiningJunctions()) {
595 myOffsetTextField->disable();
596 myButtonEditParameters->disable();
597 myParametersTextField->disable();
599 disableE1DetectorMode();
600 mySetDetectorsToggleButton->disable();
602 if (myE1Detectors.size() > 0) {
603 myE1Detectors.clear();
604 myTLSEditorParent->getViewNet()->update();
606 }
else if (isSetDetectorsToggleButtonEnabled()) {
608 myOffsetTextField->disable();
609 myButtonEditParameters->disable();
610 myParametersTextField->disable();
612 myOffsetTextField->enable();
613 myButtonEditParameters->enable();
614 myParametersTextField->enable();
618 disableE1DetectorMode();
619 mySetDetectorsToggleButton->disable();
621 if (myE1Detectors.size() > 0) {
622 myE1Detectors.clear();
623 myTLSEditorParent->getViewNet()->update();
626 mySetDetectorsToggleButton->enable();
647 const auto junction = myTLSEditorParent->myTLSJunction->getCurrentJunction();
648 if (junction ==
nullptr) {
652 myOffsetTextField->enable();
655 myButtonEditParameters->enable();
656 myParametersTextField->enable();
659 disableE1DetectorMode();
667 myOffsetTextField->setText(
"");
668 myOffsetTextField->disable();
671 myButtonEditParameters->disable();
672 myParametersTextField->setText(
"");
673 myParametersTextField->disable();
680 return getSUMOTime(myOffsetTextField->getText().text());
693 if (GNEAttributeCarrier::canParse<SUMOTime>(myOffsetTextField->getText().text())) {
705 return myParametersTextField->getText().text();
711 myParametersTextField->setText(parameters.c_str());
734 return (mySetDetectorsToggleButton->getState() == TRUE);
741 const auto laneID =
E1->getParentLanes().front()->getID();
743 for (
auto it = myE1Detectors.begin(); it != myE1Detectors.end(); it++) {
744 if (
E1->getID() == it->second) {
746 myE1Detectors.erase(it);
748 myTLSEditorParent->myEditedDef->unsetParameter(laneID);
749 myParametersTextField->setText(myTLSEditorParent->myEditedDef->getParametersStr().c_str());
751 myTLSEditorParent->myTLSPrograms->markAsModified();
753 }
else if (laneID == it->first) {
755 myE1Detectors.erase(it);
756 myE1Detectors[laneID] =
E1->getID();
758 myTLSEditorParent->myEditedDef->setParameter(laneID,
E1->getID());
759 myParametersTextField->setText(myTLSEditorParent->myEditedDef->getParametersStr().c_str());
761 myTLSEditorParent->myTLSPrograms->markAsModified();
766 myE1Detectors[laneID] =
E1->getID();
767 myTLSEditorParent->myEditedDef->setParameter(laneID,
E1->getID());
768 myParametersTextField->setText(myTLSEditorParent->myEditedDef->getParametersStr().c_str());
770 myTLSEditorParent->myTLSPrograms->markAsModified();
775const std::map<std::string, std::string>&
777 return myE1Detectors;
783 mySetDetectorsToggleButton->setState(FALSE, TRUE);
789 if (isValidOffset()) {
790 myTLSEditorParent->myTLSPrograms->markAsModified();
791 myTLSEditorParent->myEditedDef->setOffset(getOffset());
792 myOffsetTextField->killFocus();
793 myTLSEditorParent->updateModules();
801 if (isValidParameters()) {
802 myTLSEditorParent->myTLSPrograms->markAsModified();
803 myTLSEditorParent->myEditedDef->setParametersStr(getParameters());
804 myParametersTextField->killFocus();
805 myTLSEditorParent->updateModules();
814 if (myTLSEditorParent->myEditedDef) {
816 const auto previousParameters = getParameters();
817 const auto internalTests = myTLSEditorParent->getViewNet()->getViewParent()->getGNEAppWindows()->getInternalTest();
820 setParameters(myTLSEditorParent->myEditedDef->getParametersStr());
822 if (getParameters() != previousParameters) {
823 myTLSEditorParent->myTLSPrograms->markAsModified();
826 myTLSEditorParent->updateModules();
834 if (mySetDetectorsToggleButton->getState()) {
836 mySetDetectorsToggleButton->setBackColor(FXRGBA(253, 255, 206, 255));
839 mySetDetectorsToggleButton->setBackColor(4293980400);
841 myTLSEditorParent->updateModules();
843 myTLSEditorParent->getViewNet()->update();
851 myE1Detectors.clear();
853 for (
const auto& parameter : myTLSEditorParent->myEditedDef->getParametersMap()) {
855 if (myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveLane(parameter.first,
false) &&
856 myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveAdditional(
SUMO_TAG_INDUCTION_LOOP, parameter.second,
false)) {
858 myE1Detectors[parameter.first] = parameter.second;
861 myTLSEditorParent->updateModules();
863 myTLSEditorParent->getViewNet()->update();
872 myTLSEditorParent(TLSEditorParent),
873 myCurrentJunction(nullptr) {
903 TL(
"Join") + std::string(
"\t") +
TL(
"Enable join mode") + std::string(
"\t") +
TL(
"Join TLS and junctions in the current junction."),
904 TL(
"Join") + std::string(
"\t") +
TL(
"Disable join mode") + std::string(
"\t") +
TL(
"Join TLS and junctions in the current junction."),
909 TL(
"Disjoin") + std::string(
"\t") +
TL(
"Disjoin current TLS") + std::string(
"\t") +
TL(
"Disjoin current TLS."),
930 if ((myCurrentJunction ==
nullptr) ||
931 (myCurrentJunction->getNBNode()->getControllingTLS().size() == 0)) {
933 myTLSIDTextField->setText(
"");
934 myTLSIDTextField->disable();
935 myTLSTypeComboBox->disable();
936 myJoinTLSToggleButton->disable();
937 myDisjoinTLSButton->disable();
938 myJoinControlButtons->hide();
941 const auto TLS = (*myCurrentJunction->getNBNode()->getControllingTLS().begin());
943 myTLSIDTextField->setText(
TLS->getID().c_str());
945 if (myTLSEditorParent->myTLSAttributes->isSetDetectorsToggleButtonEnabled() ||
946 myTLSEditorParent->myTLSPrograms->checkHaveModifications()) {
948 myTLSIDTextField->setText(
"");
949 myTLSIDTextField->disable();
950 myTLSTypeComboBox->disable();
951 myJoinTLSToggleButton->disable();
952 myDisjoinTLSButton->disable();
953 myJoinControlButtons->hide();
954 }
else if (myTLSEditorParent->myTLSJunction->isJoiningJunctions()) {
956 myTLSIDTextField->setText(
"");
957 myTLSIDTextField->disable();
958 myTLSTypeComboBox->disable();
959 myDisjoinTLSButton->disable();
961 myJoinTLSToggleButton->enable();
962 myJoinControlButtons->show();
965 myTLSIDTextField->enable();
966 myTLSTypeComboBox->enable();
967 myJoinTLSToggleButton->enable();
969 if (
TLS->getNodes().size() == 1) {
970 myDisjoinTLSButton->disable();
972 myDisjoinTLSButton->enable();
981 return myCurrentJunction;
987 myCurrentJunction = junction;
989 refreshTLSJunction();
995 return (myJoinTLSToggleButton->getState() == TRUE);
1001 return (std::find(mySelectedJunctionIDs.begin(), mySelectedJunctionIDs.end(), junction->
getID()) != mySelectedJunctionIDs.end());
1008 if (junction != myCurrentJunction) {
1010 auto it = std::find(mySelectedJunctionIDs.begin(), mySelectedJunctionIDs.end(), junction->
getID());
1012 if (it == mySelectedJunctionIDs.end()) {
1013 mySelectedJunctionIDs.push_back(junction->
getID());
1015 mySelectedJunctionIDs.erase(it);
1021const std::vector<std::string>&
1023 return mySelectedJunctionIDs;
1030 const std::string currentTLID = (*myCurrentJunction->getNBNode()->getControllingTLS().begin())->getID();
1031 const std::string newTLID = myTLSIDTextField->getText().text();
1033 if (newTLID.empty() || (newTLID == currentTLID)) {
1035 myTLSIDTextField->setTextColor(FXRGB(0, 0, 0));
1036 myTLSIDTextField->setText(currentTLID.c_str());
1037 myTLSIDTextField->killFocus();
1038 myTLSEditorParent->update();
1040 myTLSEditorParent->myTLSPrograms->showTLSPrograms();
1041 myTLSEditorParent->myTLSAttributes->showTLSAttributes();
1042 myTLSEditorParent->myTLSPhases->showTLSPhases();
1043 myTLSEditorParent->myTLSFile->showTLSFile();
1046 myTLSIDTextField->setTextColor(FXRGB(255, 0, 0));
1048 myTLSEditorParent->myTLSPrograms->hideTLSPrograms();
1049 myTLSEditorParent->myTLSAttributes->hideTLSAttributes();
1050 myTLSEditorParent->myTLSPhases->hideTLSPhases();
1051 myTLSEditorParent->myTLSFile->hideTLSFile();
1054 auto junction = myCurrentJunction;
1055 const auto tlDef = myTLSEditorParent->myTLSPrograms->getCurrentTLSPrograms();
1057 myTLSIDTextField->setTextColor(FXRGB(0, 0, 0));
1058 myTLSIDTextField->killFocus();
1059 myTLSEditorParent->update();
1061 myTLSEditorParent->myTLSPrograms->discardChanges(
false);
1063 myTLSEditorParent->getViewNet()->getUndoList()->begin(
GUIIcon::MODETLS,
TL(
"rename TLS"));
1064 myTLSEditorParent->getViewNet()->getUndoList()->add(
new GNEChange_TLS(junction, tlDef, newTLID),
true);
1065 myTLSEditorParent->getViewNet()->getUndoList()->end();
1067 myTLSEditorParent->myTLSPrograms->showTLSPrograms();
1068 myTLSEditorParent->myTLSAttributes->showTLSAttributes();
1069 myTLSEditorParent->myTLSPhases->showTLSPhases();
1070 myTLSEditorParent->myTLSFile->showTLSFile();
1072 myTLSEditorParent->editJunction(junction);
1074 myTLSEditorParent->updateModules();
1082 const std::string currentTLType =
toString((*myCurrentJunction->getNBNode()->getControllingTLS().begin())->getType());
1083 const std::string newTLType = myTLSTypeComboBox->getText().text();
1085 if (newTLType.empty() || (newTLType == currentTLType)) {
1087 myTLSTypeComboBox->setTextColor(FXRGB(0, 0, 0));
1089 const int index = myTLSTypeComboBox->findItem(currentTLType.c_str());
1091 myTLSTypeComboBox->disable();
1093 myTLSTypeComboBox->setCurrentItem(index);
1094 myTLSTypeComboBox->enable();
1096 myTLSTypeComboBox->killFocus();
1097 myTLSEditorParent->update();
1099 myTLSEditorParent->myTLSPrograms->showTLSPrograms();
1100 myTLSEditorParent->myTLSAttributes->showTLSAttributes();
1101 myTLSEditorParent->myTLSPhases->showTLSPhases();
1102 myTLSEditorParent->myTLSFile->showTLSFile();
1105 myTLSTypeComboBox->setTextColor(FXRGB(255, 0, 0));
1107 myTLSEditorParent->myTLSPrograms->hideTLSPrograms();
1108 myTLSEditorParent->myTLSAttributes->hideTLSAttributes();
1109 myTLSEditorParent->myTLSPhases->hideTLSPhases();
1110 myTLSEditorParent->myTLSFile->hideTLSFile();
1113 myTLSTypeComboBox->setTextColor(FXRGB(0, 0, 0));
1114 myTLSTypeComboBox->killFocus();
1115 myTLSEditorParent->update();
1117 auto junction = myCurrentJunction;
1119 myTLSEditorParent->myTLSPrograms->discardChanges(
false);
1121 myTLSEditorParent->getViewNet()->getUndoList()->begin(
GUIIcon::MODETLS,
TL(
"change TLS type"));
1122 junction->setAttribute(
SUMO_ATTR_TLTYPE, newTLType, myTLSEditorParent->getViewNet()->getUndoList());
1123 myTLSEditorParent->getViewNet()->getUndoList()->end();
1125 myTLSEditorParent->myTLSPrograms->showTLSPrograms();
1126 myTLSEditorParent->myTLSAttributes->showTLSAttributes();
1127 myTLSEditorParent->myTLSPhases->showTLSPhases();
1128 myTLSEditorParent->myTLSFile->showTLSFile();
1130 myTLSEditorParent->editJunction(junction);
1132 myTLSEditorParent->updateModules();
1140 if (myJoinTLSToggleButton->getState()) {
1142 myJoinTLSToggleButton->setBackColor(FXRGBA(253, 255, 206, 255));
1144 mySelectedJunctionIDs.clear();
1146 const auto TLNodes = (*myCurrentJunction->getNBNode()->getControllingTLS().begin())->getNodes();
1148 mySelectedJunctionIDs.clear();
1149 for (
const auto& TLNode : TLNodes) {
1150 mySelectedJunctionIDs.push_back(TLNode->getID());
1153 myOriginalSelectedJunctionIDs = mySelectedJunctionIDs;
1155 myJoinControlButtons->show();
1156 getCollapsableFrame()->recalc();
1159 myJoinControlButtons->hide();
1160 getCollapsableFrame()->recalc();
1162 const auto currentJunction = myCurrentJunction;
1164 std::vector<GNEJunction*> selectedJunctions, resetTLJunctions;
1166 for (
const auto& selectedJunctionID : mySelectedJunctionIDs) {
1167 if (selectedJunctionID != currentJunction->getID()) {
1168 selectedJunctions.push_back(myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(selectedJunctionID));
1172 for (
const auto& TLNBNode : (*currentJunction->getNBNode()->getControllingTLS().begin())->getNodes()) {
1173 if (TLNBNode != currentJunction->getNBNode()) {
1174 resetTLJunctions.push_back(myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(TLNBNode->getID()));
1178 myTLSEditorParent->myTLSPrograms->discardChanges(
false);
1180 myTLSEditorParent->getViewNet()->getUndoList()->begin(
GUIIcon::MODETLS,
TL(
"join TLS"));
1182 for (
const auto& resetTLJunction : resetTLJunctions) {
1183 resetTLJunction->setAttribute(
SUMO_ATTR_TYPE,
"priority", myTLSEditorParent->getViewNet()->getUndoList());
1186 for (
const auto& selectedJunction : selectedJunctions) {
1187 selectedJunction->setAttribute(
SUMO_ATTR_TYPE, currentJunction->getAttribute(
SUMO_ATTR_TYPE), myTLSEditorParent->getViewNet()->getUndoList());
1188 selectedJunction->setAttribute(
SUMO_ATTR_TLID, currentJunction->getAttribute(
SUMO_ATTR_TLID), myTLSEditorParent->getViewNet()->getUndoList());
1191 myTLSEditorParent->getViewNet()->getUndoList()->end();
1193 myJoinTLSToggleButton->setBackColor(4293980400);
1195 mySelectedJunctionIDs.clear();
1197 myTLSEditorParent->editJunction(currentJunction);
1199 myTLSEditorParent->updateModules();
1201 myTLSEditorParent->getViewNet()->update();
1209 const auto currentJunction = myCurrentJunction;
1211 std::vector<GNEJunction*> resetTLJunctions;
1213 for (
const auto& TLNBNode : (*currentJunction->getNBNode()->getControllingTLS().begin())->getNodes()) {
1214 resetTLJunctions.push_back(myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(TLNBNode->getID()));
1217 const auto type = resetTLJunctions.front()->getAttribute(
SUMO_ATTR_TYPE);
1218 const auto tlType = resetTLJunctions.front()->getAttribute(
SUMO_ATTR_TLTYPE);
1220 myTLSEditorParent->myTLSPrograms->discardChanges(
false);
1222 myTLSEditorParent->getViewNet()->getUndoList()->begin(
GUIIcon::MODETLS,
TL(
"disjoin TLS"));
1225 const std::string oldId = currentJunction->getAttribute(
SUMO_ATTR_TLID);
1226 const std::string tmpIdBase = oldId +
"_TMP";
1228 std::string tmpId = tmpIdBase +
toString(tmpIndex);
1229 while (tllCont.
exist(tmpId)) {
1230 tmpId = tmpIdBase +
toString(++tmpIndex);
1233 myTLSEditorParent->getViewNet()->getUndoList()->add(
new GNEChange_TLS(currentJunction, tlDef, tmpId),
true);
1236 for (
const auto& resetTLJunction : resetTLJunctions) {
1237 resetTLJunction->setAttribute(
SUMO_ATTR_TYPE,
"priority", myTLSEditorParent->getViewNet()->getUndoList());
1238 resetTLJunction->setAttribute(
SUMO_ATTR_TYPE, type, myTLSEditorParent->getViewNet()->getUndoList());
1239 resetTLJunction->setAttribute(
SUMO_ATTR_TLTYPE, tlType, myTLSEditorParent->getViewNet()->getUndoList());
1242 myTLSEditorParent->getViewNet()->getUndoList()->end();
1244 myJoinTLSToggleButton->setBackColor(4293980400);
1246 mySelectedJunctionIDs.clear();
1248 myTLSEditorParent->editJunction(currentJunction);
1249 myTLSEditorParent->updateModules();
1256 myJoinTLSToggleButton->setState(FALSE, TRUE);
1257 myTLSEditorParent->updateModules();
1265 mySelectedJunctionIDs = myOriginalSelectedJunctionIDs;
1266 myJoinTLSToggleButton->setState(FALSE, TRUE);
1267 myTLSEditorParent->updateModules();
1275 myJunctionIDLabel->setText(
TL(
"Junction ID"));
1277 mySelectedJunctionIDs.clear();
1279 onCmdCancelJoin(
nullptr, 0,
nullptr);
1281 if (myCurrentJunction ==
nullptr) {
1282 myJunctionIDTextField->setText(
TL(
"No junction selected"));
1285 const auto& TLSs = myCurrentJunction->getNBNode()->getControllingTLS();
1287 if (TLSs.size() > 0) {
1289 const auto TLS = (*TLSs.begin());
1291 if (
TLS->getNodes().size() > 1) {
1293 std::string TLSNodesStr;
1294 for (
auto it =
TLS->getNodes().begin(); it !=
TLS->getNodes().end(); it++) {
1295 if (it == (
TLS->getNodes().end() - 1)) {
1296 TLSNodesStr += (*it)->getID();
1298 TLSNodesStr += (*it)->getID() +
", ";
1302 myJunctionIDTextField->setText(TLSNodesStr.c_str());
1304 if (
TLS->getNodes().size() > 1) {
1305 myJunctionIDLabel->setText(
TL(
"Junction IDs"));
1308 const int index = myTLSTypeComboBox->findItem(myCurrentJunction->getAttribute(
SUMO_ATTR_TLTYPE).c_str());
1310 myTLSTypeComboBox->setCurrentItem(index, FALSE);
1315 myJunctionIDTextField->setText(myCurrentJunction->getID().c_str());
1316 myTLSTypeComboBox->setCurrentItem(0, FALSE);
1320 updateTLSJunction();
1329 myTLSEditorParent(TLSEditorParent) {
1374 if (getNumberOfPrograms() == 0) {
1376 if (myTLSEditorParent->getTLSJunction()->getCurrentJunction() !=
nullptr) {
1377 myCreateButton->enable();
1379 myCreateButton->disable();
1381 myDeleteButton->disable();
1382 myResetSingleButton->disable();
1383 myProgramComboBox->disable();
1384 myResetAllButton->disable();
1385 mySaveButon->disable();
1386 myCancelButon->disable();
1387 }
else if (myTLSEditorParent->myTLSAttributes->isSetDetectorsToggleButtonEnabled()) {
1389 myCreateButton->disable();
1390 myDeleteButton->disable();
1391 myResetSingleButton->disable();
1392 myProgramComboBox->disable();
1393 myResetAllButton->disable();
1394 mySaveButon->disable();
1395 myCancelButon->disable();
1396 }
else if (myTLSEditorParent->myTLSJunction->isJoiningJunctions()) {
1398 myCreateButton->disable();
1399 myDeleteButton->disable();
1400 myResetSingleButton->disable();
1401 myProgramComboBox->disable();
1402 myResetAllButton->disable();
1403 mySaveButon->disable();
1404 myCancelButon->disable();
1405 }
else if (myHaveModifications) {
1407 myCreateButton->disable();
1408 myDeleteButton->disable();
1409 myResetSingleButton->disable();
1410 myProgramComboBox->disable();
1411 myResetAllButton->disable();
1413 mySaveButon->enable();
1414 myCancelButon->enable();
1416 myCreateButton->enable();
1417 myDeleteButton->enable();
1418 myResetSingleButton->enable();
1419 myProgramComboBox->enable();
1421 mySaveButon->disable();
1422 myCancelButon->disable();
1424 if (getNumberOfPrograms() > 1) {
1425 myResetAllButton->enable();
1427 myResetAllButton->disable();
1431 const auto currentJunction = myTLSEditorParent->myTLSJunction->getCurrentJunction();
1433 if (currentJunction ==
nullptr) {
1434 myCreateButton->setText(
TL(
"Create"));
1435 }
else if (currentJunction->getNBNode()->isTLControlled()) {
1436 myCreateButton->setText(
TL(
"Duplicate"));
1438 myCreateButton->setText(
TL(
"Create"));
1458 const auto junction = myTLSEditorParent->myTLSJunction->getCurrentJunction();
1459 if (junction ==
nullptr) {
1465 std::set<std::string> programIDs;
1466 for (
const auto&
TLS : junction->getNBNode()->getControllingTLS()) {
1468 programIDs.insert(
TLS->getProgramID());
1470 for (
const auto& programID : programIDs) {
1471 myProgramComboBox->appendIconItem(programID.c_str());
1475 myProgramComboBox->enable();
1476 myProgramComboBox->setCurrentItem(0);
1478 return switchProgram();
1490 myProgramComboBox->clearItems();
1491 myProgramComboBox->disable();
1497 return myProgramComboBox->getNumItems();
1503 return myHaveModifications;
1509 myHaveModifications =
true;
1510 myTLSEditorParent->updateModules();
1518 if (
TLSPrograms->getProgramID() == myProgramComboBox->getText().text()) {
1528 if (myProgramComboBox->getNumItems() == 0) {
1531 return myProgramComboBox->getText().text();
1539 auto currentJunction = myTLSEditorParent->myTLSJunction->getCurrentJunction();
1540 if (currentJunction !=
nullptr) {
1541 myTLSEditorParent->getViewNet()->getUndoList()->abortAllChangeGroups();
1542 myTLSEditorParent->cleanup();
1543 myTLSEditorParent->getViewNet()->updateViewNet();
1545 if (editJunctionAgain) {
1546 myTLSEditorParent->editJunction(currentJunction);
1549 myTLSEditorParent->updateModules();
1556 GNEJunction* currentJunction = myTLSEditorParent->myTLSJunction->getCurrentJunction();
1558 discardChanges(
false);
1562 FXMessageBox::warning(
this, MBOX_OK,
1563 TL(
"TLS cannot be created"),
"%s",
1564 (
TL(
"Traffic Light cannot be created because junction must have") + std::string(
"\n") +
1565 TL(
"at least one incoming edge and one outgoing edge.")).c_str());
1571 FXMessageBox::warning(
this, MBOX_OK,
1572 TL(
"TLS cannot be created"),
"%s",
1573 (
TL(
"Traffic Light cannot be created because junction") + std::string(
"\n") +
1574 TL(
"must have at least one connection.")).c_str());
1578 bool connectionControlled =
false;
1580 if (!connection->getNBEdgeConnection().uncontrolled) {
1581 connectionControlled =
true;
1584 if (!connectionControlled) {
1586 FXMessageBox::warning(
this, MBOX_OK,
1587 TL(
"TLS cannot be created"),
"%s",
1588 (
TL(
"Traffic Light cannot be created because junction") + std::string(
"\n") +
1589 TL(
"must have at least one controlled connection.")).c_str());
1593 createTLS(currentJunction);
1595 myTLSEditorParent->editJunction(currentJunction);
1597 myProgramComboBox->setCurrentItem(myProgramComboBox->getNumItems() - 1, TRUE);
1598 myTLSEditorParent->updateModules();
1606 GNEJunction* currentJunction = myTLSEditorParent->myTLSJunction->getCurrentJunction();
1610 const bool changeJunctionType = (myTLSEditorParent->myTLSPrograms->getNumberOfPrograms() == 1);
1612 discardChanges(
false);
1614 if (changeJunctionType) {
1618 myTLSEditorParent->getViewNet()->getUndoList()->add(
new GNEChange_TLS(currentJunction, tlDef,
false),
true);
1620 myTLSEditorParent->editJunction(currentJunction);
1622 myTLSEditorParent->updateModules();
1630 GNEJunction* junction = myTLSEditorParent->myTLSJunction->getCurrentJunction();
1634 discardChanges(
false);
1636 myTLSEditorParent->getViewNet()->getUndoList()->begin(
GUIIcon::MODETLS,
TL(
"reset current program"));
1638 myTLSEditorParent->getViewNet()->getUndoList()->add(
new GNEChange_TLS(junction, oldDef,
false),
true);
1642 myTLSEditorParent->getViewNet()->getUndoList()->add(
new GNEChange_TLS(junction, newDef,
true,
true),
true);
1645 myTLSEditorParent->getViewNet()->getUndoList()->end();
1647 myTLSEditorParent->editJunction(junction);
1650 for (
int i = 0; i < myProgramComboBox->getNumItems(); i++) {
1651 if (myProgramComboBox->getItemText(i) == programID) {
1656 myProgramComboBox->setCurrentItem(index, TRUE);
1658 myTLSEditorParent->updateModules();
1666 GNEJunction* junction = myTLSEditorParent->myTLSJunction->getCurrentJunction();
1669 std::vector<GNEJunction*> TLSJunctions;
1670 for (
const auto& TLSNode : oldDef->
getNodes()) {
1671 TLSJunctions.push_back(myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(TLSNode->getID()));
1674 discardChanges(
false);
1676 myTLSEditorParent->getViewNet()->getUndoList()->begin(
GUIIcon::MODETLS,
TL(
"reset TLS"));
1682 createTLS(junction);
1691 myTLSEditorParent->getViewNet()->getUndoList()->end();
1693 myTLSEditorParent->editJunction(junction);
1703 if (
TLSPrograms->getProgramID() == myProgramComboBox->getText().text()) {
1720 const auto currentJunction = myTLSEditorParent->myTLSJunction->getCurrentJunction();
1722 const auto currentProgram = myProgramComboBox->getCurrentItem();
1724 if (currentJunction !=
nullptr) {
1725 const auto oldDefinition = getCurrentTLSPrograms();
1726 std::vector<NBNode*> nodes = oldDefinition->getNodes();
1727 GNEUndoList* undoList = myTLSEditorParent->getViewNet()->getUndoList();
1728 for (
const auto& node : nodes) {
1731 undoList->
add(
new GNEChange_TLS(junction, myTLSEditorParent->myEditedDef,
true),
true);
1744 myTLSEditorParent->getViewNet()->getUndoList()->end();
1746 myHaveModifications =
false;
1748 myTLSEditorParent->myEditedDef =
nullptr;
1749 myTLSEditorParent->cleanup();
1750 myTLSEditorParent->getViewNet()->updateViewNet();
1752 myTLSEditorParent->editJunction(currentJunction);
1754 myProgramComboBox->setCurrentItem(currentProgram, TRUE);
1757 discardChanges(
true);
1759 myTLSEditorParent->updateModules();
1767 discardChanges(
true);
1775 const auto currentTLS = getCurrentTLSProgramID();
1777 if (junction ==
nullptr) {
1786 if (
TLS->getProgramID() == currentTLS) {
1791 if (tpl ==
nullptr) {
1807 myTLSEditorParent->getViewNet()->getUndoList()->add(
new GNEChange_TLS(j, newDef,
true,
false),
true);
1809 myTLSEditorParent->getViewNet()->getUndoList()->end();
1812 myTLSEditorParent->getViewNet()->getUndoList()->add(
new GNEChange_TLS(junction,
nullptr,
true,
true),
true);
1819 if (myTLSEditorParent->myTLSJunction->getCurrentJunction() ==
nullptr) {
1823 myHaveModifications =
false;
1829 myTLSEditorParent->getViewNet()->getNet()->computeJunction(myTLSEditorParent->myTLSJunction->getCurrentJunction());
1833 if (tllogic !=
nullptr) {
1835 myTLSEditorParent->buildInternalLanes(tlDef);
1837 delete myTLSEditorParent->myEditedDef;
1840 myTLSEditorParent->myTLSAttributes->setOffset(myTLSEditorParent->myEditedDef->getLogic()->getOffset());
1841 myTLSEditorParent->myTLSAttributes->setParameters(myTLSEditorParent->myEditedDef->getLogic()->getParametersStr());
1843 myTLSEditorParent->myTLSPhases->initPhaseTable();
1846 discardChanges(
false);
1847 myTLSEditorParent->getViewNet()->setStatusBarText(
TL(
"Traffic Light does not control any links"));
1860 myTLSEditorParent(TLSEditorParent) {
1870 TL(
"Clean States") + std::string(
"\t") +
1871 TL(
"Clean unused states from all phase") + std::string(
"\t") +
1872 TL(
"Clean unused states from all phase. (Not allowed for multiple programs)"),
1877 TL(
"Add States") + std::string(
"\t") +
1878 TL(
"Extend the state vector for all phases by one entry") + std::string(
"\t") +
1879 TL(
"Extend the state vector for all phases by one entry. (Unused until a connection or crossing is assigned to the new index)"),
1884 TL(
"Group Sig.") + std::string(
"\t") +
1885 TL(
"Shorten state definition by letting connections with the same signal states use the same index") + std::string(
"\t") +
1886 TL(
"Shorten state definition by letting connections with the same signal states use the same index. (Not allowed for multiple programs)"),
1891 TL(
"Ungroup Sig.") + std::string(
"\t") +
1892 TL(
"Let every connection use a distinct index (reverse state grouping)") + std::string(
"\t") +
1893 TL(
"Let every connection use a distinct index (reverse state grouping). (Not allowed for multiple programs)"),
1907 if (myTLSEditorParent->myTLSAttributes->isSetDetectorsToggleButtonEnabled()) {
1909 myPhaseTable->disable();
1910 myCleanStatesButton->disable();
1911 myAddStates->disable();
1912 myGroupSignalsButton->disable();
1913 myUngroupSignalsButton->disable();
1914 }
else if (myTLSEditorParent->myTLSJunction->isJoiningJunctions()) {
1916 myPhaseTable->disable();
1917 myCleanStatesButton->disable();
1918 myAddStates->disable();
1919 myGroupSignalsButton->disable();
1920 myUngroupSignalsButton->disable();
1921 myUngroupSignalsButton->disable();
1922 }
else if (myTLSEditorParent->myTLSPrograms->getNumberOfPrograms() == 0) {
1924 myPhaseTable->disable();
1925 myCleanStatesButton->disable();
1926 myAddStates->disable();
1927 myGroupSignalsButton->disable();
1928 myUngroupSignalsButton->disable();
1929 }
else if (myTLSEditorParent->myEditedDef ==
nullptr) {
1931 myPhaseTable->disable();
1932 myCleanStatesButton->disable();
1933 myAddStates->disable();
1934 myGroupSignalsButton->disable();
1935 myUngroupSignalsButton->disable();
1937 myPhaseTable->enable();
1938 myCleanStatesButton->enable();
1939 myAddStates->enable();
1940 myGroupSignalsButton->enable();
1941 if (myTLSEditorParent->myEditedDef->usingSignalGroups()) {
1942 myUngroupSignalsButton->enable();
1944 myUngroupSignalsButton->disable();
1964 return myTLSEditorParent;
1970 return myPhaseTable;
1978 if (myTLSEditorParent->myTLSPrograms->getNumberOfPrograms() > 0) {
1980 initStaticPhaseTable();
1982 initActuatedPhaseTable();
1984 initDelayBasePhaseTable();
1986 initNEMAPhaseTable();
1989 myPhaseTable->selectRow(0);
1991 myPhaseTable->recalcTableWidth();
1992 myPhaseTable->show();
1994 myPhaseTable->hide();
2002 myPhaseTable->clearTable();
2009 int colDuration = 1;
2015 int colEarliestEnd = -1;
2016 int colLatestEnd = -1;
2050 if (col == colDuration) {
2051 return setDuration(col, row, value);
2052 }
else if (col == colState) {
2053 return setState(col, row, value);
2054 }
else if (col == colNext) {
2055 return setNext(row, value);
2056 }
else if (col == colName) {
2057 return setName(row, value);
2058 }
else if (col == colMinDur) {
2059 return setMinDur(row, value);
2060 }
else if (col == colMaxDur) {
2061 return setMaxDur(row, value);
2062 }
else if (col == colEarliestEnd) {
2063 return setEarliestEnd(row, value);
2064 }
else if (col == colLatestEnd) {
2065 return setLatestEnd(row, value);
2066 }
else if (col == colVehExt) {
2067 return setVehExt(row, value);
2068 }
else if (col == colYellow) {
2069 return setYellow(row, value);
2070 }
else if (col == colRed) {
2071 return setRed(row, value);
2081 myTLSEditorParent->myTLSPrograms->markAsModified();
2083 const int newIndex = buildDefaultPhase(row);
2090 myTLSEditorParent->myEditedDef->getLogic()->overrideState(newIndex, c);
2098 myPhaseTable->selectRow(newIndex);
2100 getPhaseTable()->setFocus();
2107 myTLSEditorParent->myTLSPrograms->markAsModified();
2109 const int newIndex = buildDefaultPhase(row);
2111 myTLSEditorParent->myEditedDef->getLogic()->copyPhase(row, row + 1);
2115 myPhaseTable->selectRow(newIndex);
2117 getPhaseTable()->setFocus();
2124 myTLSEditorParent->myTLSPrograms->markAsModified();
2126 const auto newRow =
MAX2(0, (row - 1));
2128 myTLSEditorParent->myEditedDef->getLogic()->deletePhase(row);
2132 myPhaseTable->selectRow(newRow);
2134 getPhaseTable()->setFocus();
2141 myTLSEditorParent->myTLSPrograms->markAsModified();
2144 myTLSEditorParent->myEditedDef->getLogic()->swapfirstPhase();
2146 myTLSEditorParent->myEditedDef->getLogic()->swapPhase(row, row - 1);
2152 myPhaseTable->selectRow((
int)myTLSEditorParent->myEditedDef->getLogic()->getPhases().size() - 1);
2154 myPhaseTable->selectRow(row - 1);
2157 getPhaseTable()->setFocus();
2164 myTLSEditorParent->myTLSPrograms->markAsModified();
2166 if (row == (
int)myTLSEditorParent->myEditedDef->getLogic()->getPhases().size() - 1) {
2167 myTLSEditorParent->myEditedDef->getLogic()->swaplastPhase();
2169 myTLSEditorParent->myEditedDef->getLogic()->swapPhase(row, row + 1);
2174 if (row == (
int)myTLSEditorParent->myEditedDef->getLogic()->getPhases().size() - 1) {
2175 myPhaseTable->selectRow(0);
2177 myPhaseTable->selectRow(row + 1);
2180 getPhaseTable()->setFocus();
2187 const auto& phase = myTLSEditorParent->getPhase(myPhaseTable->getCurrentSelectedRow());
2189 for (
const auto& internalLane : myTLSEditorParent->myInternalLanes) {
2190 int tlIndex = internalLane.first;
2191 std::vector<GNEInternalLane*> lanes = internalLane.second;
2193 if (tlIndex >= 0 && tlIndex < (
int)phase.state.size()) {
2194 state = (
LinkState)phase.state[tlIndex];
2196 for (
const auto& lane : lanes) {
2197 lane->setLinkState(state);
2201 myTLSEditorParent->getViewNet()->updateViewNet();
2207 if (myTLSEditorParent->myEditedDef->cleanupStates()) {
2208 myTLSEditorParent->myTLSPrograms->markAsModified();
2210 myTLSEditorParent->buildInternalLanes(myTLSEditorParent->myEditedDef);
2212 myPhaseTable->setFocus();
2213 myTLSEditorParent->myTLSPrograms->markAsModified();
2214 myTLSEditorParent->updateModules();
2221 myTLSEditorParent->myEditedDef->getLogic()->setStateLength(myTLSEditorParent->myEditedDef->getLogic()->getNumLinks() + 1);
2222 myTLSEditorParent->myTLSPrograms->markAsModified();
2224 myPhaseTable->setFocus();
2225 myTLSEditorParent->updateModules();
2232 myTLSEditorParent->myEditedDef->groupSignals();
2233 myTLSEditorParent->myTLSPrograms->markAsModified();
2234 myTLSEditorParent->buildInternalLanes(myTLSEditorParent->myEditedDef);
2236 myPhaseTable->setFocus();
2237 myTLSEditorParent->updateModules();
2244 myTLSEditorParent->myEditedDef->setParticipantsInformation();
2245 myTLSEditorParent->myEditedDef->ungroupSignals();
2246 myTLSEditorParent->myTLSPrograms->markAsModified();
2247 myTLSEditorParent->buildInternalLanes(myTLSEditorParent->myEditedDef);
2249 myPhaseTable->setFocus();
2250 myTLSEditorParent->updateModules();
2258 const int colDuration = 1;
2259 const int colState = 2;
2260 const int colNext = 3;
2261 const int colName = 4;
2263 const auto& phases = myTLSEditorParent->myEditedDef->getLogic()->getPhases();
2265 myPhaseTable->setTableSize(
"sup-midtb", (
int)phases.size());
2267 for (
int row = 0; row < (int)phases.size(); row++) {
2268 myPhaseTable->setItemText(row, colDuration,
getSteps2Time(phases.at(row).duration).c_str());
2269 myPhaseTable->setItemText(row, colState, phases.at(row).state.c_str());
2270 myPhaseTable->setItemText(row, colNext, phases.at(row).next.size() > 0 ?
toString(phases.at(row).next).c_str() :
"");
2271 myPhaseTable->setItemText(row, colName, phases.at(row).name.c_str());
2274 myPhaseTable->setColumnLabelTop(colDuration,
"dur");
2275 myPhaseTable->setColumnLabelTop(colState,
"state");
2276 myPhaseTable->setColumnLabelTop(colNext,
"next");
2277 myPhaseTable->setColumnLabelTop(colName,
"name");
2279 updateCycleDuration(colDuration);
2280 updateStateSize(colState);
2282 myPhaseTable->setFocus();
2289 const int colDuration = 1;
2290 const int colMinDur = 2;
2291 const int colMaxDur = 3;
2292 const int colState = 4;
2293 const int colEarliestEnd = 5;
2294 const int colLatestEnd = 6;
2295 const int colNext = 7;
2296 const int colName = 8;
2298 const auto& phases = myTLSEditorParent->myEditedDef->getLogic()->getPhases();
2300 myPhaseTable->setTableSize(
"suffpff-midtb", (
int)phases.size());
2302 for (
int row = 0; row < (int)phases.size(); row++) {
2303 myPhaseTable->setItemText(row, colDuration,
getSteps2Time(phases.at(row).duration).c_str());
2304 myPhaseTable->setItemText(row, colMinDur,
varDurString(phases.at(row).minDur).c_str());
2305 myPhaseTable->setItemText(row, colMaxDur,
varDurString(phases.at(row).maxDur).c_str());
2306 myPhaseTable->setItemText(row, colState, phases.at(row).state.c_str());
2307 myPhaseTable->setItemText(row, colEarliestEnd,
varDurString(phases.at(row).earliestEnd).c_str());
2308 myPhaseTable->setItemText(row, colLatestEnd,
varDurString(phases.at(row).latestEnd).c_str());
2309 myPhaseTable->setItemText(row, colNext, phases.at(row).next.size() > 0 ?
toString(phases.at(row).next).c_str() :
"");
2310 myPhaseTable->setItemText(row, colName, phases.at(row).name.c_str());
2313 myPhaseTable->setColumnLabelTop(colDuration,
"dur");
2314 myPhaseTable->setColumnLabelTop(colMinDur,
"min");
2315 myPhaseTable->setColumnLabelTop(colMaxDur,
"max");
2316 myPhaseTable->setColumnLabelTop(colEarliestEnd,
"ear.end",
"earlyEnd");
2317 myPhaseTable->setColumnLabelTop(colLatestEnd,
"lat.end",
"latestEnd");
2318 myPhaseTable->setColumnLabelTop(colState,
"state");
2319 myPhaseTable->setColumnLabelTop(colNext,
"next");
2320 myPhaseTable->setColumnLabelTop(colName,
"name");
2322 updateCycleDuration(colDuration);
2323 updateStateSize(colState);
2325 myPhaseTable->setFocus();
2332 const int colDuration = 1;
2333 const int colMinDur = 2;
2334 const int colMaxDur = 3;
2335 const int colState = 4;
2336 const int colNext = 5;
2337 const int colName = 6;
2339 const auto& phases = myTLSEditorParent->myEditedDef->getLogic()->getPhases();
2341 myPhaseTable->setTableSize(
"suffp-midtb", (
int)phases.size());
2343 for (
int row = 0; row < (int)phases.size(); row++) {
2344 myPhaseTable->setItemText(row, colDuration,
getSteps2Time(phases.at(row).duration).c_str());
2345 myPhaseTable->setItemText(row, colMinDur,
varDurString(phases.at(row).minDur).c_str());
2346 myPhaseTable->setItemText(row, colMaxDur,
varDurString(phases.at(row).maxDur).c_str());
2347 myPhaseTable->setItemText(row, colState, phases.at(row).state.c_str());
2348 myPhaseTable->setItemText(row, colNext, phases.at(row).next.size() > 0 ?
toString(phases.at(row).next).c_str() :
"");
2349 myPhaseTable->setItemText(row, colName, phases.at(row).name.c_str());
2352 myPhaseTable->setColumnLabelTop(colDuration,
"dur");
2353 myPhaseTable->setColumnLabelTop(colMinDur,
"min");
2354 myPhaseTable->setColumnLabelTop(colMaxDur,
"max");
2355 myPhaseTable->setColumnLabelTop(colState,
"state");
2356 myPhaseTable->setColumnLabelTop(colNext,
"next");
2357 myPhaseTable->setColumnLabelTop(colName,
"name");
2359 updateCycleDuration(colDuration);
2360 updateStateSize(colState);
2362 myPhaseTable->setFocus();
2369 const int colDuration = 1;
2370 const int colMinDur = 2;
2371 const int colMaxDur = 3;
2372 const int colState = 4;
2373 const int colVehExt = 5;
2374 const int colYellow = 6;
2375 const int colRed = 7;
2376 const int colNext = 8;
2377 const int colName = 9;
2379 const auto& phases = myTLSEditorParent->myEditedDef->getLogic()->getPhases();
2381 myPhaseTable->setTableSize(
"suffpfff-midtb", (
int)phases.size());
2383 for (
int row = 0; row < (int)phases.size(); row++) {
2384 myPhaseTable->setItemText(row, colDuration,
getSteps2Time(phases.at(row).duration).c_str());
2385 myPhaseTable->setItemText(row, colMinDur,
varDurString(phases.at(row).minDur).c_str());
2386 myPhaseTable->setItemText(row, colMaxDur,
varDurString(phases.at(row).maxDur).c_str());
2387 myPhaseTable->setItemText(row, colState, phases.at(row).state.c_str());
2388 myPhaseTable->setItemText(row, colVehExt,
varDurString(phases.at(row).vehExt).c_str());
2389 myPhaseTable->setItemText(row, colYellow,
varDurString(phases.at(row).yellow).c_str());
2390 myPhaseTable->setItemText(row, colRed,
varDurString(phases.at(row).red).c_str());
2391 myPhaseTable->setItemText(row, colNext, phases.at(row).next.size() > 0 ?
toString(phases.at(row).next).c_str() :
"");
2392 myPhaseTable->setItemText(row, colName, phases.at(row).name.c_str());
2395 myPhaseTable->setColumnLabelTop(colDuration,
"dur");
2396 myPhaseTable->setColumnLabelTop(colMinDur,
"min");
2397 myPhaseTable->setColumnLabelTop(colMaxDur,
"max");
2398 myPhaseTable->setColumnLabelTop(colState,
"state");
2399 myPhaseTable->setColumnLabelTop(colVehExt,
"vehExt",
"vehicle extension");
2400 myPhaseTable->setColumnLabelTop(colYellow,
"yellow");
2401 myPhaseTable->setColumnLabelTop(colRed,
"red");
2402 myPhaseTable->setColumnLabelTop(colNext,
"next");
2403 myPhaseTable->setColumnLabelTop(colName,
"name");
2405 updateCycleDuration(colDuration);
2406 updateStateSize(colState);
2408 myPhaseTable->setFocus();
2420 const int newIndex = row + 1;
2422 auto duration =
getSUMOTime(myPhaseTable->getItemText(row, 1));
2423 const auto oldState = myPhaseTable->getItemText(row, TLSStatic ? 2 : 4);
2424 auto state = oldState;
2426 std::set<int> crossingIndices;
2427 for (
const auto& node : myTLSEditorParent->myEditedDef->getNodes()) {
2428 for (
const auto& crossing : node->getCrossings()) {
2429 crossingIndices.insert(crossing->tlLinkIndex);
2430 crossingIndices.insert(crossing->tlLinkIndex2);
2434 bool haveGreen =
false;
2435 bool haveYellow =
false;
2436 for (
const auto& linkStateChar : state) {
2443 if (haveGreen && haveYellow) {
2445 duration =
TIME2STEPS(neteditOptions.getInt(
"tls.left-green.time"));
2446 for (
int i = 0; i < (int)state.size(); i++) {
2453 }
else if (haveGreen) {
2455 myTLSEditorParent->myEditedDef->setParticipantsInformation();
2456 duration =
TIME2STEPS(myTLSEditorParent->myEditedDef->computeBrakingTime(neteditOptions.getFloat(
"tls.yellow.min-decel")));
2457 for (
int i = 0; i < (int)state.size(); i++) {
2459 if (crossingIndices.count(i) == 0) {
2466 }
else if (haveYellow) {
2467 duration =
TIME2STEPS(neteditOptions.isDefault(
"tls.allred.time") ? 2 : neteditOptions.getInt(
"tls.allred.time"));
2469 for (
int i = 0; i < (int)state.size(); i++) {
2476 const int nextIndex = (myPhaseTable->getNumRows() > newIndex) ? newIndex : 0;
2477 const std::string state2 = myPhaseTable->getItemText(nextIndex, (TLSStatic ? 2 : 4));
2478 for (
int i = 0; i < (int)state.size(); i++) {
2481 state[i] = oldState[i];
2490 myTLSEditorParent->myEditedDef->getLogic()->addStep(duration, state, std::vector<int>(),
"", newIndex);
2500 if (value.empty()) {
2502 getPhaseTable()->setItemText(row, col,
getSteps2Time(myTLSEditorParent->getPhase(row).duration).c_str());
2504 }
else if (GNEAttributeCarrier::canParse<double>(value)) {
2508 myTLSEditorParent->myEditedDef->getLogic()->setPhaseDuration(row, duration);
2509 myTLSEditorParent->myTLSPrograms->markAsModified();
2511 updateCycleDuration(col);
2525 const auto& phase = myTLSEditorParent->getPhase(row);
2527 const auto newState = value.empty() ? phase.state : value;
2530 myTLSEditorParent->myEditedDef->getLogic()->addStep(phase.duration, newState, phase.next, phase.name, row);
2537 myTLSEditorParent->myEditedDef->getLogic()->deletePhase(row + 1);
2543 if (value.size() > 0) {
2544 myTLSEditorParent->myTLSPrograms->markAsModified();
2546 myPhaseTable->selectRow(row);
2549 getPhaseTable()->setItemText(row, col, newState);
2552 updateStateSize(col);
2561 const auto nextEdited = GNEAttributeCarrier::parse<std::vector<int> >(value);
2562 for (
const auto nextPhase : nextEdited) {
2563 if ((nextPhase < 0) || (nextPhase >= myPhaseTable->getNumRows())) {
2568 myTLSEditorParent->myEditedDef->getLogic()->setPhaseNext(row, nextEdited);
2569 myTLSEditorParent->myTLSPrograms->markAsModified();
2580 myTLSEditorParent->myEditedDef->getLogic()->setPhaseName(row, value);
2581 myTLSEditorParent->myTLSPrograms->markAsModified();
2589 if (value.empty()) {
2592 myTLSEditorParent->myTLSPrograms->markAsModified();
2594 }
else if (GNEAttributeCarrier::canParse<double>(value)) {
2598 myTLSEditorParent->myEditedDef->getLogic()->setPhaseMinDuration(row, minDur);
2599 myTLSEditorParent->myTLSPrograms->markAsModified();
2606 myTLSEditorParent->myTLSPrograms->markAsModified();
2617 if (value.empty()) {
2620 myTLSEditorParent->myTLSPrograms->markAsModified();
2622 }
else if (GNEAttributeCarrier::canParse<double>(value)) {
2626 myTLSEditorParent->myEditedDef->getLogic()->setPhaseMaxDuration(row, maxDur);
2627 myTLSEditorParent->myTLSPrograms->markAsModified();
2634 myTLSEditorParent->myTLSPrograms->markAsModified();
2645 if (value.empty()) {
2648 myTLSEditorParent->myTLSPrograms->markAsModified();
2650 }
else if (GNEAttributeCarrier::canParse<double>(value)) {
2653 if (earliestEnd > 0) {
2654 myTLSEditorParent->myEditedDef->getLogic()->setPhaseEarliestEnd(row, earliestEnd);
2655 myTLSEditorParent->myTLSPrograms->markAsModified();
2662 myTLSEditorParent->myTLSPrograms->markAsModified();
2673 if (value.empty()) {
2676 myTLSEditorParent->myTLSPrograms->markAsModified();
2678 }
else if (GNEAttributeCarrier::canParse<double>(value)) {
2681 if (latestEnd > 0) {
2682 myTLSEditorParent->myEditedDef->getLogic()->setPhaseLatestEnd(row, latestEnd);
2683 myTLSEditorParent->myTLSPrograms->markAsModified();
2690 myTLSEditorParent->myTLSPrograms->markAsModified();
2701 if (value.empty()) {
2704 myTLSEditorParent->myTLSPrograms->markAsModified();
2706 }
else if (GNEAttributeCarrier::canParse<double>(value)) {
2710 myTLSEditorParent->myEditedDef->getLogic()->setPhaseVehExt(row, vehExt);
2711 myTLSEditorParent->myTLSPrograms->markAsModified();
2718 myTLSEditorParent->myTLSPrograms->markAsModified();
2729 if (value.empty()) {
2732 myTLSEditorParent->myTLSPrograms->markAsModified();
2734 }
else if (GNEAttributeCarrier::canParse<double>(value)) {
2738 myTLSEditorParent->myEditedDef->getLogic()->setPhaseYellow(row, yellow);
2739 myTLSEditorParent->myTLSPrograms->markAsModified();
2746 myTLSEditorParent->myTLSPrograms->markAsModified();
2757 if (value.empty()) {
2760 myTLSEditorParent->myTLSPrograms->markAsModified();
2762 }
else if (GNEAttributeCarrier::canParse<double>(value)) {
2766 myTLSEditorParent->myEditedDef->getLogic()->setPhaseRed(row, red);
2767 myTLSEditorParent->myTLSPrograms->markAsModified();
2774 myTLSEditorParent->myTLSPrograms->markAsModified();
2785 for (
const auto& phase : myTLSEditorParent->myEditedDef->getLogic()->getPhases()) {
2786 cycleDuration += phase.duration;
2789 myPhaseTable->setColumnLabelBot(col,
getSteps2Time(cycleDuration));
2796 myPhaseTable->setColumnLabelBot(col,
"Links: " +
toString(myTLSEditorParent->myEditedDef->getLogic()->getNumLinks()));
2805 myTLSEditorParent(TLSEditorParent) {
2823 if (myTLSEditorParent->myTLSPrograms->getNumberOfPrograms() == 0) {
2824 myLoadButton->disable();
2825 mySaveButton->disable();
2826 }
else if (myTLSEditorParent->myTLSAttributes->isSetDetectorsToggleButtonEnabled()) {
2828 myLoadButton->disable();
2829 mySaveButton->disable();
2830 }
else if (myTLSEditorParent->myTLSJunction->isJoiningJunctions()) {
2832 myLoadButton->disable();
2833 mySaveButton->disable();
2835 myLoadButton->enable();
2836 mySaveButton->enable();
2855 FXFileDialog opendialog(getCollapsableFrame(),
"Load TLS Program");
2857 opendialog.setSelectMode(SELECTFILE_EXISTING);
2862 if (opendialog.execute()) {
2866 tmpTLLCont.
insert(myTLSEditorParent->myEditedDef);
2870 std::set<NBLoadedSUMOTLDef*> newDefsOtherProgram;
2871 for (
auto item : tmpTLLCont.
getPrograms(myTLSEditorParent->myEditedDef->getID())) {
2872 if (item.second != myTLSEditorParent->myEditedDef) {
2874 if (item.first == myTLSEditorParent->myEditedDef->getProgramID()) {
2875 newDefSameProgram = sdef;
2877 newDefsOtherProgram.insert(sdef);
2881 const int newPrograms = (int)newDefsOtherProgram.size();
2882 if (newPrograms > 0 || newDefSameProgram !=
nullptr) {
2883 std::vector<NBNode*> nodes = myTLSEditorParent->myEditedDef->
getNodes();
2884 for (
auto newProg : newDefsOtherProgram) {
2885 for (
auto it_node : nodes) {
2887 myTLSEditorParent->getViewNet()->getUndoList()->add(
new GNEChange_TLS(junction, newProg,
true),
true);
2890 if (newPrograms > 0) {
2891 WRITE_MESSAGE(
TL(
"Loaded ") +
toString(newPrograms) +
TL(
" new programs for tlLogic '") + myTLSEditorParent->myEditedDef->getID() +
"'");
2893 if (newDefSameProgram !=
nullptr) {
2895 myTLSEditorParent->myEditedDef = newDefSameProgram;
2896 WRITE_MESSAGE(
TL(
"Updated program '") + newDefSameProgram->
getProgramID() +
TL(
"' for tlLogic '") + myTLSEditorParent->myEditedDef->getID() +
"'");
2899 if (tllHandler.
getSeenIDs().count(myTLSEditorParent->myEditedDef->getID()) == 0) {
2900 myTLSEditorParent->getViewNet()->setStatusBarText(
TL(
"No programs found for traffic light '") + myTLSEditorParent->myEditedDef->getID() +
"'");
2906 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
2909 myTLSEditorParent->myTLSPhases->initPhaseTable();
2910 myTLSEditorParent->myTLSPrograms->markAsModified();
2912 myTLSEditorParent->updateModules();
2932 myTLSEditorParent->updateModules();
2940 if (time == std::floor(time)) {
FXDEFMAP(GNETLSEditorFrame::TLSJunction) TLSJunctionMap[]
@ MID_GNE_TLSFRAME_TLSJUNCTION_DISJOIN
Disjoin TLS.
@ MID_GNE_TLSFRAME_DEFINITION_RESETCURRENT
reset current (single) TLS program
@ MID_GNE_TLSFRAME_PHASES_ADDUNUSED
add unused states
@ MID_GNE_TLSFRAME_ATTRIBUTES_TOGGLEDETECTOR
set detectors in TLS
@ MID_GNE_TLSFRAME_TLSJUNCTION_TOGGLEJOIN
join TLS
@ MID_GNE_TLSFRAME_PHASES_CLEANUP
cleanup unused states
@ MID_GNE_TLSFRAME_PHASES_GROUPSTATES
group states
@ MID_GNE_BUTTON_CANCEL
cancel button
@ MID_GNE_TLSFRAME_DEFINITION_DELETE
delete TLS
@ MID_GNE_TLSFRAME_FILE_SAVEPROGRAM
cleanup unused states
@ MID_GNE_TLSFRAME_PHASES_UNGROUPSTATES
ungroup states
@ MID_GNE_TLSFRAME_DEFINITION_CREATE
Create TLS.
@ MID_GNE_TLSFRAME_DEFINITION_SAVE
accept TLS modification
@ MID_GNE_TLSFRAME_DEFINITION_SWITCHPROGRAM
switch between programs
@ MID_GNE_TLSFRAME_DEFINITION_DISCARD
cancel TLS modification
@ MID_GNE_TLSFRAME_DEFINITION_RESETALL
reset all TLS programs
@ MID_GNE_TLSFRAME_TLSJUNCTION_TYPE
current TLS ID
@ MID_GNE_TLSFRAME_TLSJUNCTION_ID
current TLS ID
@ MID_GNE_BUTTON_ACCEPT
accept button
@ MID_GNE_TLSFRAME_ATTRIBUTES_OFFSET
TLS offset.
@ MID_GNE_TLSFRAME_ATTRIBUTES_PARAMETERSDIALOG
TLS parameters.
@ MID_GNE_TLSFRAME_FILE_LOADPROGRAM
Load Program.
@ MID_GNE_TLSFRAME_ATTRIBUTES_PARAMETERS
TLS parameters.
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
#define GUIDesignComboBoxNCol
number of column of every combo box
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignAuxiliarHorizontalFrameUniform
design for auxiliar (Without borders) horizontal frame used to pack another frames uniform
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignComboBoxVisibleItems
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
FXString gCurrentFolder
The folder used as last.
#define WRITE_WARNINGF(...)
#define WRITE_MESSAGE(msg)
std::vector< NBConnection > NBConnectionVector
Definition of a connection vector.
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
@ SUMO_TAG_INDUCTION_LOOP
alternative tag for e1 detector
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
@ LINKSTATE_TL_YELLOW_MAJOR
The link has yellow light, may pass.
@ LINKSTATE_TL_GREEN_MAJOR
The link has green light, may pass.
@ LINKSTATE_DEADEND
This is a dead end link.
@ LINKSTATE_TL_YELLOW_MINOR
The link has yellow light, has to brake anyway.
@ LINKSTATE_TL_RED
The link has red light (must brake)
@ LINKSTATE_TL_GREEN_MINOR
The link has green light, has to brake.
@ SUMO_ATTR_TLLINKINDEX2
link: the index of the opposite direction link of a pedestrian crossing
@ SUMO_ATTR_TLTYPE
node: the type of traffic light
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
const unsigned char TLS[]
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static std::string addExtension(const std::string &path, const std::string &extension)
Add an extension to the given file path.
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * getNet() const
get pointer to net
A road/street connecting two junctions (netedit-version)
GNEViewNet * getViewNet() const
get view net
GNEViewNet * myViewNet
FOX need this.
virtual void show()
show Frame
virtual void hide()
hide Frame
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
LinkState getLinkState() const
whether link state has been modified
int getTLIndex() const
get Traffic Light index
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
std::string getAttribute(SumoXMLAttr key) const
void selectTLS(bool selected)
notify the junction of being selected in tls-mode. (used to control drawing)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
std::vector< GNEConnection * > getGNEConnections() const
Returns all GNEConnections vinculated with this junction.
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
NBNode * getNBNode() const
Return net build node.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
GNEEdge * getParentEdge() const
get parent edge
void deleteInternalLane(GNEInternalLane *internalLane)
delete internalLane from container
void insertInternalLane(GNEInternalLane *internalLane)
insert internalLane in container
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
std::vector< GNELane * > getSelectedLanes() const
get selected lanes
std::vector< GNEEdge * > getSelectedEdges() const
return all edges
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
void clearOverlappedInspection()
clear overlapped inspection
GNEAttributeCarrier * getCurrentAC() const
get current AC
void hiderOverlappedInspection()
hide overlapped inspection
void showOverlappedInspection(GNEViewNetHelper::ViewObjectsSelector &viewObjects, const Position &clickedPosition, const bool shiftKeyPressed)
show overlapped inspection
int getNumberOfOverlappedACs() const
get number of overlapped ACs
Dialog for edit parameters.
long onCmdSetParameters(FXObject *, FXSelector, void *)
Called when the user changes parameters of a TLS.
long onCmdSetOffset(FXObject *, FXSelector, void *)
bool isValidOffset()
is current offset valid
long onCmdParametersDialog(FXObject *, FXSelector, void *ptr)
Called when user press edit parameters button.
MFXToggleButtonTooltip * mySetDetectorsToggleButton
toggle button for set detectors mode
bool isSetDetectorsToggleButtonEnabled() const
toggle button for set detectors mode
bool isValidParameters()
are current parameter valid
void updateTLSAttributes()
update TLSAttributes module
FXTextField * myOffsetTextField
the TextField for modifying offset
void updateE1Detectors()
FOX needs this.
void disableE1DetectorMode()
disable detector mode
SUMOTime getOffset() const
get current offset in string format
void setParameters(const std::string ¶meters)
set new parameters
const std::map< std::string, std::string > & getE1Detectors() const
get E1 detectors vinculated with this TLS
void clearTLSAttributes()
clear TLS attributes
void setOffset(const SUMOTime &offset)
set new offset
std::string getParameters() const
get current parameters in string format
bool toggleE1DetectorSelection(const GNEAdditional *E1)
select or unselect E1 detector in the current TLS
void initTLSAttributes()
initializes the definitions and corresponding listbox
FXButton * myButtonEditParameters
button for edit parameters
TLSAttributes(GNETLSEditorFrame *TLSEditorParent)
FOX-declaration.
FXTextField * myParametersTextField
the TextField for modifying parameters
~TLSAttributes()
destructor
void hideTLSAttributes()
hide TLSAttributes
void showTLSAttributes()
show TLSAttributes
long onCmdToggleDetectorMode(FXObject *, FXSelector, void *ptr)
Called when user toggle set detector mode.
void updateTLSFile()
update TLSFile module
FXButton * myLoadButton
load button
void showTLSFile()
show TLSPhases
void hideTLSFile()
hide TLSPhases
FXButton * mySaveButton
save button
long onCmdLoadTLSProgram(FXObject *, FXSelector, void *)
load TLS Program from an additional file
TLSFile(GNETLSEditorFrame *TLSEditorParent)
FOX-declaration.
std::string writeSUMOTime(SUMOTime steps)
FOX needs this.
long onCmdSaveTLSProgram(FXObject *, FXSelector, void *)
save TLS Program to an additional file
long onCmdChangeType(FXObject *, FXSelector, void *)
Called when the user change TLS Type.
long onCmdDisjoinTLS(FXObject *, FXSelector, void *)
Called when the user join TLS.
void refreshTLSJunction()
FOX needs this.
FXHorizontalFrame * myJoinControlButtons
frame for accept/cancel buttons
const std::vector< std::string > & getSelectedJunctionIDs() const
get selected junction IDs
long onCmdToggleJoinTLS(FXObject *, FXSelector, void *)
Called when the user join TLS.
long onCmdRenameTLS(FXObject *, FXSelector, void *)
TLSJunction(GNETLSEditorFrame *TLSEditorParent)
FOX-declaration.
long onCmdCancelJoin(FXObject *, FXSelector, void *)
cancel join
MFXComboBoxIcon * myTLSTypeComboBox
ComboBox for TLS Types.
MFXToggleButtonTooltip * myJoinTLSToggleButton
Toggle button for join TLS.
void updateTLSJunction()
update TLSJunction module
void toggleJunctionSelected(const GNEJunction *junction)
select or unselect junction in the current TLS
long onCmdAcceptJoin(FXObject *, FXSelector, void *)
accept join
GNEJunction * getCurrentJunction() const
get current modified junction
void setCurrentJunction(GNEJunction *junction)
set current junction
FXLabel * myJunctionIDLabel
label for junction ID
bool isJunctionSelected(const GNEJunction *junction) const
check if given junction is selected (used fo joining)
MFXButtonTooltip * myDisjoinTLSButton
button for disjoin TLS
bool isJoiningJunctions() const
is joining junctions
MFXTextFieldTooltip * myTLSIDTextField
text field for junction ID
MFXTextFieldTooltip * myJunctionIDTextField
text field for junction ID
bool setEarliestEnd(const int row, const std::string &value)
set earliestEnd
long onCmdUngroupStates(FXObject *, FXSelector, void *)
Called when the user ungroups states.
void showTLSPhases()
show TLSPhases
GNETLSTable * myPhaseTable
table for selecting and rearranging phases and for changing duration
long onCmdCleanStates(FXObject *, FXSelector, void *)
long onCmdGroupStates(FXObject *, FXSelector, void *)
Called when the user groups states.
void clearPhaseTable()
clear phase thable
MFXButtonTooltip * myGroupSignalsButton
group signals button
bool setVehExt(const int row, const std::string &value)
set vehExt
MFXButtonTooltip * myAddStates
add states button
int buildDefaultPhase(const int row)
build default phase
void updateTLSPhases()
update TLSPhases module
TLSPhases(GNETLSEditorFrame *TLSEditorParent)
FOX-declaration.
void movePhaseDown(const int row)
move phase down
void initActuatedPhaseTable()
init actuated phase table
void initPhaseTable()
initializes the phase table
void initNEMAPhaseTable()
init NEMA phase table
bool setYellow(const int row, const std::string &value)
set yellow
bool changePhaseValue(const int col, const int row, const std::string &value)
change phase value (state, name, next, etc.)
void initDelayBasePhaseTable()
init delayBase phase table
void movePhaseUp(const int row)
move phase up
bool setMinDur(const int row, const std::string &value)
set minDur
bool setLatestEnd(const int row, const std::string &value)
set latestEnd
MFXButtonTooltip * myCleanStatesButton
clean states button
void updateStateSize(const int col)
update state size
MFXButtonTooltip * myUngroupSignalsButton
ungroup signals button
long onCmdAddUnusedStates(FXObject *, FXSelector, void *)
Called when the user cleans up states.
void initStaticPhaseTable()
init static phase table
bool setDuration(const int col, const int row, const std::string &value)
set duration
bool setMaxDur(const int row, const std::string &value)
set maxDur
void updateTLSColoring()
update TLS coloring
GNETLSTable * getPhaseTable() const
get phase table
void removePhase(const int row)
delete phase
bool setRed(const int row, const std::string &value)
set red
bool setName(const int row, const std::string &value)
set name
bool setState(const int col, const int row, const std::string &value)
set state
void duplicatePhase(const int row)
duplicate phase
void addPhase(const int row, const char c=' ')
add phase
GNETLSEditorFrame * getTLSEditorParent() const
get TLSEditor Parent
bool setNext(const int row, const std::string &value)
set next
void hideTLSPhases()
hide TLSPhases
void updateCycleDuration(const int col)
recomputes cycle duration and updates label
bool checkHaveModifications() const
check if current TLS was modified
FXButton * mySaveButon
button for save TLS program
void updateTLSPrograms()
update TLSPrograms module
bool initTLSPrograms()
init TLS Definitions
long onCmdDefSwitchTLSProgram(FXObject *, FXSelector, void *)
Called when the user switches a TLS.
MFXComboBoxIcon * myProgramComboBox
the comboBox for selecting the tl-definition to edit
FXButton * myCancelButon
button for cancel TLS program
void clearTLSProgramss()
clear TLS Definitions
int getNumberOfPrograms() const
get number of programs
long onCmdSaveChanges(FXObject *, FXSelector, void *)
Called when the user presses the save-Button.
void hideTLSPrograms()
hide TLSPrograms
bool switchProgram()
switch program
void createTLS(GNEJunction *junction)
FOX needs this.
FXButton * myDeleteButton
button for delete existent TLS program
long onCmdDiscardChanges(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button.
void discardChanges(const bool editJunctionAgain)
discard changes
long onCmdCreate(FXObject *, FXSelector, void *)
FXButton * myResetAllButton
button for reset all TLS program
long onCmdResetAll(FXObject *, FXSelector, void *)
Called when the user press button reset all TLS Programs.
FXButton * myResetSingleButton
button for reset TLS program
long onCmdResetCurrentProgram(FXObject *, FXSelector, void *)
Called when the user press button reset current TLS Program.
NBTrafficLightDefinition * getCurrentTLSPrograms() const
get current definition
TLSPrograms(GNETLSEditorFrame *TLSEditorParent)
FOX-declaration.
void showTLSPrograms()
show TLSPrograms
void markAsModified()
mark Program as modified
long onCmdDelete(FXObject *, FXSelector, void *)
Called when the user press button delete TLS Program.
const std::string getCurrentTLSProgramID() const
get current program ID
FXButton * myCreateButton
button for create new TLS program
GNETLSEditorFrame::TLSPrograms * myTLSPrograms
module for TLS Definition
void handleChange(GNEInternalLane *lane)
update phase definition for the current traffic light and phase
GNEOverlappedInspection * myOverlappedInspection
Overlapped Inspection.
GNETLSEditorFrame::TLSPhases * getTLSPhases() const
get module for TLS Phases
GNETLSEditorFrame::TLSAttributes * getTLSAttributes() const
get module for TLS attributes
GNETLSEditorFrame::TLSAttributes * myTLSAttributes
module for TLS attributes
static std::string varDurString(SUMOTime dur)
convert duration (potentially undefined) to string
bool isTLSSaved()
check if modifications in TLS was saved
void editJunction(GNEJunction *junction)
edits the traffic light for the given junction
GNETLSEditorFrame::TLSPhases * myTLSPhases
module for TLS Phases
void selectedOverlappedElement(GNEAttributeCarrier *AC)
open GNEAttributesCreator extended dialog (can be reimplemented in frame children)
std::map< int, std::vector< GNEInternalLane * > > myInternalLanes
the internal lanes belonging to the current junction indexed by their tl-index
void updateModules()
update modules
bool parseTLSPrograms(const std::string &file)
parse TLS Programs from a file
bool controlsEdge(GNEEdge *edge) const
whether the given edge is controlled by the currently edited tlDef
static const std::string getSteps2Time(const SUMOTime value)
converts to SUMOTime
void buildInternalLanes(const NBTrafficLightDefinition *tlDef)
builds internal lanes for the given tlDef
const NBTrafficLightLogic::PhaseDefinition & getPhase(const int index)
get certain phase of the current traffic light
void handleMultiChange(GNELane *lane, FXObject *obj, FXSelector sel, void *data)
update phase definition for the current traffic light and phase
GNETLSEditorFrame::TLSJunction * getTLSJunction() const
get module for TLS Junction
static SUMOTime getSUMOTime(const std::string &value)
converts to SUMOTime
~GNETLSEditorFrame()
Destructor.
NBLoadedSUMOTLDef * myEditedDef
the traffic light definition being edited
void frameWidthUpdated()
function called after setting new width in current frame
void editTLS(GNEViewNetHelper::ViewObjectsSelector &viewObjects, const Position &clickedPosition, const bool shiftKeyPressed)
edits the traffic light for the given clicked junction
GNETLSEditorFrame::TLSJunction * myTLSJunction
module for TLS Junction
GNETLSEditorFrame::TLSPrograms * getTLSPrograms() const
get module for TLS Definition
void cleanup()
cleans up previous lanes
void show()
show inspector frame
void selectRow(const int rowIndex)
Select a row.
int getCurrentSelectedRow() const
Get current selected row.
void recalcTableWidth()
recalc width (call when all labels and contents are fill)
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
class used to group all variables related with objects under cursor after a click over view
GNEAdditional * getAdditionalFront() const
get front additional element or a pointer to nullptr
GNEJunction * getJunctionFront() const
get front junction or a pointer to nullptr
const std::vector< GNEJunction * > & getJunctions() const
get vector with junctions
GNENet * getNet() const
get the net object
bool changeAllPhases() const
change all phases
GNEViewParent * getViewParent() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
void setStatusBarText(const std::string &text)
set statusBar text
A single child window which contains a view of the simulation area.
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
MFXStaticToolTip * getStaticTooltipMenu() const
get static toolTip for menus
void disable()
Disable combo box.
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon item in the last position
FXuint openModalDialog(InternalTest *internalTests, FXuint placement=PLACEMENT_CURSOR)
Run modal invocation of the dialog.
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
void setText(const std::string &text)
set text
Options
GroupBoxModule options.
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extensions, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
A loaded (complete) traffic light logic.
NBTrafficLightLogic * getLogic()
Returns the internal logic.
void setProgramID(const std::string &programID)
Sets the programID.
A definition of a pedestrian crossing.
int tlLinkIndex
the traffic light index of this crossing (if controlled)
Represents a single node (junction) during network building.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
bool isTLControlled() const
Returns whether this node is controlled by any tls.
A traffic light logics which must be computed (only nodes/edges are given)
The base class for traffic light logic definitions.
const std::vector< NBNode * > & getNodes() const
Returns the list of controlled nodes.
const std::string & getProgramID() const
Returns the ProgramID.
TrafficLightType getType() const
get the algorithm type (static etc..)
virtual void setProgramID(const std::string &programID)
Sets the programID.
NBTrafficLightLogic * compute(const OptionsCont &oc)
Computes the traffic light logic.
SUMOTime getOffset()
Returns the offset.
const NBConnectionVector & getControlledLinks() const
returns the controlled links (depends on previous call to collectLinks)
static const SUMOTime UNSPECIFIED_DURATION
The definition of a single phase of the logic.
A container for traffic light definitions and built programs.
bool exist(const std::string &newID, bool requireComputed=true) const
check if exists a definition with the given ID
bool removeProgram(const std::string id, const std::string programID, bool del=true)
Removes a program of a logic definition from the dictionary.
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
Definitions getDefinitions() const
NBTrafficLightLogic * getLogic(const std::string &id, const std::string &programID) const
Returns the computed logic for the given name.
std::string getNextProgramID(const std::string &id) const
Returns a new (unused) programID for the given traffic light.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
A SUMO-compliant built logic for a traffic light.
void setPhaseState(int phaseIndex, int tlIndex, LinkState linkState)
Modifies the state for an existing phase (used by netedit)
const std::vector< PhaseDefinition > & getPhases() const
Returns the phases.
Importer for edge connections stored in XML.
const std::set< std::string > & getSeenIDs()
static void writeTrafficLight(OutputDevice &into, const NBTrafficLightLogic *logic)
writes a single traffic light logic to the given device
const std::string & getID() const
Returns the id.
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
void close()
Closes the device and removes it from the dictionary.
static OutputDevice & getDevice(const std::string &name, bool usePrefix=true)
Returns the described OutputDevice.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
A point in 2D or 3D with translation and scaling methods.
void append(const PositionVector &v, double sameThreshold=2.0)
double length() const
Returns the length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
PositionVector reverse() const
reverse position vector
static const RGBColor BLACK
static const RGBColor RED
named colors
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
static StringBijection< XMLFileExtension > XMLFileExtensions
XML file Extensions.
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
static std::string prune(const std::string &str)
Removes trailing and leading whitechars.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.
A structure which describes a connection between edges or lanes.
PositionVector viaShape
shape of via
PositionVector shape
shape of Connection