107 GNEFrame(viewParent, viewNet,
TL(
"Edit Traffic Light")),
186 for (
const auto& junction : viewObjects.
getJunctions()) {
207 TL(
"Save TLS Changes"),
208 TL(
"There are unsaved changes in the currently edited traffic light."),
209 TL(
"Do you want to save it before changing mode?"));
235 std::set<NBTrafficLightDefinition*> origDefs;
239 if (logic !=
nullptr) {
241 std::vector<NBNode*> nodes = def->getNodes();
242 for (
auto it_node : nodes) {
243 GNEJunction* junction =
myViewNet->getNet()->getAttributeCarriers()->retrieveJunction(it_node->getID());
247 tmpTLLCont.
insert(duplicate);
248 origDefs.insert(duplicate);
250 WRITE_WARNINGF(
TL(
"tlLogic '%', program '%' could not be built"), def->getID(), def->getProgramID());
256 std::vector<NBLoadedSUMOTLDef*> loadedTLS;
259 if (sdef !=
nullptr) {
260 loadedTLS.push_back(sdef);
264 for (
auto def : loadedTLS) {
265 if (origDefs.count(def) != 0) {
270 std::vector<NBNode*> nodes = def->getNodes();
272 for (
auto it_node : nodes) {
273 GNEJunction* junction =
myViewNet->getNet()->getAttributeCarriers()->retrieveJunction(it_node->getID());
280 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
300 for (
const auto& node :
myTLSPrograms->getCurrentTLSPrograms()->getNodes()) {
301 myViewNet->getNet()->getAttributeCarriers()->retrieveJunction(node->getID())->selectTLS(
false);
351 for (
const auto& internalLane : internalLanes.second) {
353 myViewNet->getNet()->getAttributeCarriers()->deleteInternalLane(internalLane);
361 if (tlDef !=
nullptr) {
362 const int NUM_POINTS = 10;
365 const std::string innerID =
":" + nbnCurrentJunction->
getID();
368 for (
const auto& link : links) {
369 int tlIndex = link.getTLIndex();
372 const NBEdge::Connection& con = link.getFrom()->getConnection(link.getFromLane(), link.getTo(), link.getToLane());
376 shape = link.getFrom()->getToNode()->computeInternalLaneShape(link.getFrom(),
NBEdge::Connection(link.getFromLane(),
377 link.getTo(), link.getToLane()), NUM_POINTS);
382 const PositionVector laneShapeFrom = link.getFrom()->getLaneShape(link.getFromLane());
383 const PositionVector laneShapeTo = link.getTo()->getLaneShape(link.getToLane());
389 myViewNet->getNet()->getAttributeCarriers()->insertInternalLane(internalLane);
393 for (
const auto& nbn : tlDef->
getNodes()) {
394 for (
const auto& crossing : nbn->getCrossings()) {
395 if (crossing->tlLinkIndex2 > 0 && crossing->tlLinkIndex2 != crossing->tlLinkIndex) {
401 myViewNet->getNet()->getAttributeCarriers()->insertInternalLane(internalLane);
407 myViewNet->getNet()->getAttributeCarriers()->insertInternalLane(internalLaneReverse);
408 myInternalLanes[crossing->tlLinkIndex2].push_back(internalLaneReverse);
413 myViewNet->getNet()->getAttributeCarriers()->insertInternalLane(internalLane);
430 if ((index >= 0) || (index < (
int)
myEditedDef->getLogic()->getPhases().size())) {
431 return myEditedDef->getLogic()->getPhases().at(index);
442 const auto selectedRow =
myTLSPhases->getPhaseTable()->getCurrentSelectedRow();
444 for (
int row = 0; row < (int)
myEditedDef->getLogic()->getPhases().size(); row++) {
453 myTLSPhases->getPhaseTable()->selectRow(selectedRow);
464 std::set<std::string> fromIDs;
469 fromIDs.insert(it_lane->getMicrosimID());
474 const auto selectedEdge =
myViewNet->getNet()->getAttributeCarriers()->getSelectedEdges();
475 for (
const auto& edge : selectedEdge) {
476 for (
auto it_lane : edge->getChildLanes()) {
477 fromIDs.insert(it_lane->getMicrosimID());
483 const auto selectedLanes =
myViewNet->getNet()->getAttributeCarriers()->getSelectedLanes();
484 for (
auto it_lane : selectedLanes) {
485 fromIDs.insert(it_lane->getMicrosimID());
491 for (
auto it : links) {
492 if (fromIDs.count(it.getFrom()->getLaneID(it.getFromLane())) > 0) {
493 std::vector<GNEInternalLane*> lanes =
myInternalLanes[it.getTLIndex()];
494 for (
auto it_lane : lanes) {
495 it_lane->onDefault(obj, sel, eventData);
507 for (
auto it : links) {
536 myViewNet->getNet()->getAttributeCarriers()->retrieveJunction(node->getID())->selectTLS(
true);
543 myViewNet->setStatusBarText(
TL(
"Unsaved modifications. Abort or Save"));
580 TL(
"Assign E1 detectors") + std::string(
"\t") +
TL(
"Enable assign E1 mode") + std::string(
"\t") +
TL(
"Assign E1 detectors to the current TLS"),
581 TL(
"Assign E1 detectors") + std::string(
"\t") +
TL(
"Disable assign E1 mode") + std::string(
"\t") +
TL(
"Assign E1 detectors to the current TLS"),
661 if (junction ==
nullptr) {
754 const auto laneID =
E1->getParentLanes().front()->getID();
757 if (
E1->getID() == it->second) {
766 }
else if (laneID == it->first) {
788const std::map<std::string, std::string>&
826 auto GNEApp =
myTLSEditorParent->getViewNet()->getViewParent()->getGNEAppWindows();
871 for (
const auto& parameter :
myTLSEditorParent->myEditedDef->getParametersMap()) {
873 if (
myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveLane(parameter.first,
false) &&
892 const auto staticTooltip = TLSEditorParent->
getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
917 TL(
"Join") + std::string(
"\t") +
TL(
"Enable join mode") + std::string(
"\t") +
TL(
"Join TLS and junctions in the current junction."),
918 TL(
"Join") + std::string(
"\t") +
TL(
"Disable join mode") + std::string(
"\t") +
TL(
"Join TLS and junctions in the current junction."),
922 TL(
"Disjoin") + std::string(
"\t") +
TL(
"Disjoin current TLS") + std::string(
"\t") +
TL(
"Disjoin current TLS."),
989 if (
TLS->getNodes().size() == 1) {
1041const std::vector<std::string>&
1050 const std::string currentTLID = (*
myCurrentJunction->getNBNode()->getControllingTLS().begin())->getID();
1053 if (newTLID.empty() || (newTLID == currentTLID)) {
1105 if (newTLType.empty() || (newTLType == currentTLType)) {
1166 const auto TLNodes = (*
myCurrentJunction->getNBNode()->getControllingTLS().begin())->getNodes();
1169 for (
const auto& TLNode : TLNodes) {
1184 std::vector<GNEJunction*> selectedJunctions, resetTLJunctions;
1187 if (selectedJunctionID != currentJunction->getID()) {
1188 selectedJunctions.push_back(
myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(selectedJunctionID));
1192 for (
const auto& TLNBNode : (*currentJunction->getNBNode()->getControllingTLS().begin())->getNodes()) {
1193 if (TLNBNode != currentJunction->getNBNode()) {
1194 resetTLJunctions.push_back(
myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(TLNBNode->getID()));
1202 for (
const auto& resetTLJunction : resetTLJunctions) {
1206 for (
const auto& selectedJunction : selectedJunctions) {
1231 std::vector<GNEJunction*> resetTLJunctions;
1233 for (
const auto& TLNBNode : (*currentJunction->getNBNode()->getControllingTLS().begin())->getNodes()) {
1234 resetTLJunctions.push_back(
myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(TLNBNode->getID()));
1237 const auto type = resetTLJunctions.front()->getAttribute(
SUMO_ATTR_TYPE);
1238 const auto tlType = resetTLJunctions.front()->getAttribute(
SUMO_ATTR_TLTYPE);
1245 const std::string oldId = currentJunction->getAttribute(
SUMO_ATTR_TLID);
1246 const std::string tmpIdBase = oldId +
"_TMP";
1248 std::string tmpId = tmpIdBase +
toString(tmpIndex);
1249 while (tllCont.
exist(tmpId)) {
1250 tmpId = tmpIdBase +
toString(++tmpIndex);
1256 for (
const auto& resetTLJunction : resetTLJunctions) {
1307 if (TLSs.size() > 0) {
1309 const auto TLS = (*TLSs.begin());
1311 if (
TLS->getNodes().size() > 1) {
1313 std::string TLSNodesStr;
1314 for (
auto it =
TLS->getNodes().begin(); it !=
TLS->getNodes().end(); it++) {
1315 if (it == (
TLS->getNodes().end() - 1)) {
1316 TLSNodesStr += (*it)->getID();
1318 TLSNodesStr += (*it)->getID() +
", ";
1324 if (
TLS->getNodes().size() > 1) {
1407 }
else if (
myTLSEditorParent->myTLSAttributes->isSetDetectorsToggleButtonEnabled()) {
1451 const auto currentJunction =
myTLSEditorParent->myTLSJunction->getCurrentJunction();
1453 if (currentJunction ==
nullptr) {
1455 }
else if (currentJunction->getNBNode()->isTLControlled()) {
1479 if (junction ==
nullptr) {
1485 std::set<std::string> programIDs;
1486 for (
const auto&
TLS : junction->getNBNode()->getControllingTLS()) {
1488 programIDs.insert(
TLS->getProgramID());
1490 for (
const auto& programID : programIDs) {
1560 if (currentJunction !=
nullptr) {
1565 if (editJunctionAgain) {
1575 auto GNEApp =
myTLSEditorParent->getViewNet()->getViewParent()->getGNEAppWindows();
1584 TL(
"TLS cannot be created"),
1585 TL(
"Traffic Light cannot be created because junction must have"),
1586 TL(
"at least one incoming edge and one outgoing edge.")
1594 TL(
"TLS cannot be created"),
1595 TL(
"Traffic Light cannot be created because junction"),
1596 TL(
"must have at least one connection.")
1601 bool connectionControlled =
false;
1603 if (!connection->getNBEdgeConnection().uncontrolled) {
1604 connectionControlled =
true;
1607 if (!connectionControlled) {
1610 TL(
"TLS cannot be created"),
1611 TL(
"Traffic Light cannot be created because junction"),
1612 TL(
"must have at least one controlled connection.")
1634 const bool changeJunctionType = (
myTLSEditorParent->myTLSPrograms->getNumberOfPrograms() == 1);
1638 if (changeJunctionType) {
1693 std::vector<GNEJunction*> TLSJunctions;
1694 for (
const auto& TLSNode : oldDef->
getNodes()) {
1695 TLSJunctions.push_back(
myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(TLSNode->getID()));
1744 const auto currentJunction =
myTLSEditorParent->myTLSJunction->getCurrentJunction();
1748 if (currentJunction !=
nullptr) {
1750 std::vector<NBNode*> nodes = oldDefinition->getNodes();
1752 for (
const auto& node : nodes) {
1801 if (junction ==
nullptr) {
1810 if (
TLS->getProgramID() == currentTLS) {
1815 if (tpl ==
nullptr) {
1857 if (tllogic !=
nullptr) {
1871 myTLSEditorParent->getViewNet()->setStatusBarText(
TL(
"Traffic Light does not control any links"));
1894 TL(
"Clean States") + std::string(
"\t") +
1895 TL(
"Clean unused states from all phase") + std::string(
"\t") +
1896 TL(
"Clean unused states from all phase. (Not allowed for multiple programs)"),
1901 TL(
"Add States") + std::string(
"\t") +
1902 TL(
"Extend the state vector for all phases by one entry") + std::string(
"\t") +
1903 TL(
"Extend the state vector for all phases by one entry. (Unused until a connection or crossing is assigned to the new index)"),
1908 TL(
"Group Sig.") + std::string(
"\t") +
1909 TL(
"Shorten state definition by letting connections with the same signal states use the same index") + std::string(
"\t") +
1910 TL(
"Shorten state definition by letting connections with the same signal states use the same index. (Not allowed for multiple programs)"),
1915 TL(
"Ungroup Sig.") + std::string(
"\t") +
1916 TL(
"Let every connection use a distinct index (reverse state grouping)") + std::string(
"\t") +
1917 TL(
"Let every connection use a distinct index (reverse state grouping). (Not allowed for multiple programs)"),
2033 int colDuration = 1;
2039 int colEarliestEnd = -1;
2040 int colLatestEnd = -1;
2074 if (col == colDuration) {
2076 }
else if (col == colState) {
2078 }
else if (col == colNext) {
2080 }
else if (col == colName) {
2082 }
else if (col == colMinDur) {
2084 }
else if (col == colMaxDur) {
2086 }
else if (col == colEarliestEnd) {
2088 }
else if (col == colLatestEnd) {
2090 }
else if (col == colVehExt) {
2092 }
else if (col == colYellow) {
2094 }
else if (col == colRed) {
2120 for (
int i = (
int)
myTLSEditorParent->myEditedDef->getLogic()->getPhases().size() - 1; i > row; --i) {
2154 const auto newRow =
MAX2(0, (row - 1));
2158 for (
int i = row; i < (int)
myTLSEditorParent->myEditedDef->getLogic()->getPhases().size() + 1; ++i) {
2200 if (row == (
int)
myTLSEditorParent->myEditedDef->getLogic()->getPhases().size() - 1) {
2210 if (row == (
int)
myTLSEditorParent->myEditedDef->getLogic()->getPhases().size() - 1) {
2226 int tlIndex = internalLane.first;
2227 std::vector<GNEInternalLane*> lanes = internalLane.second;
2229 if (tlIndex >= 0 && tlIndex < (
int)phase.state.size()) {
2230 state = (
LinkState)phase.state[tlIndex];
2232 for (
const auto& lane : lanes) {
2233 lane->setLinkState(state);
2294 const int colDuration = 1;
2295 const int colState = 2;
2296 const int colNext = 3;
2297 const int colName = 4;
2301 myPhaseTable->setTableSize(
"sup-midtb", (
int)phases.size());
2303 for (
int row = 0; row < (int)phases.size(); row++) {
2305 myPhaseTable->setItemText(row, colState, phases.at(row).state.c_str());
2306 myPhaseTable->setItemText(row, colNext, phases.at(row).next.size() > 0 ?
toString(phases.at(row).next).c_str() :
"");
2307 myPhaseTable->setItemText(row, colName, phases.at(row).name.c_str());
2325 const int colDuration = 1;
2326 const int colMinDur = 2;
2327 const int colMaxDur = 3;
2328 const int colState = 4;
2329 const int colEarliestEnd = 5;
2330 const int colLatestEnd = 6;
2331 const int colNext = 7;
2332 const int colName = 8;
2336 myPhaseTable->setTableSize(
"suffpff-midtb", (
int)phases.size());
2338 for (
int row = 0; row < (int)phases.size(); row++) {
2342 myPhaseTable->setItemText(row, colState, phases.at(row).state.c_str());
2345 myPhaseTable->setItemText(row, colNext, phases.at(row).next.size() > 0 ?
toString(phases.at(row).next).c_str() :
"");
2346 myPhaseTable->setItemText(row, colName, phases.at(row).name.c_str());
2352 myPhaseTable->setColumnLabelTop(colEarliestEnd,
"ear.end",
"earlyEnd");
2353 myPhaseTable->setColumnLabelTop(colLatestEnd,
"lat.end",
"latestEnd");
2368 const int colDuration = 1;
2369 const int colMinDur = 2;
2370 const int colMaxDur = 3;
2371 const int colState = 4;
2372 const int colNext = 5;
2373 const int colName = 6;
2377 myPhaseTable->setTableSize(
"suffp-midtb", (
int)phases.size());
2379 for (
int row = 0; row < (int)phases.size(); row++) {
2383 myPhaseTable->setItemText(row, colState, phases.at(row).state.c_str());
2384 myPhaseTable->setItemText(row, colNext, phases.at(row).next.size() > 0 ?
toString(phases.at(row).next).c_str() :
"");
2385 myPhaseTable->setItemText(row, colName, phases.at(row).name.c_str());
2405 const int colDuration = 1;
2406 const int colMinDur = 2;
2407 const int colMaxDur = 3;
2408 const int colState = 4;
2409 const int colVehExt = 5;
2410 const int colYellow = 6;
2411 const int colRed = 7;
2412 const int colNext = 8;
2413 const int colName = 9;
2417 myPhaseTable->setTableSize(
"suffpfff-midtb", (
int)phases.size());
2419 for (
int row = 0; row < (int)phases.size(); row++) {
2423 myPhaseTable->setItemText(row, colState, phases.at(row).state.c_str());
2427 myPhaseTable->setItemText(row, colNext, phases.at(row).next.size() > 0 ?
toString(phases.at(row).next).c_str() :
"");
2428 myPhaseTable->setItemText(row, colName, phases.at(row).name.c_str());
2435 myPhaseTable->setColumnLabelTop(colVehExt,
"vehExt",
"vehicle extension");
2456 const int newIndex = row + 1;
2459 const auto oldState =
myPhaseTable->getItemText(row, TLSStatic ? 2 : 4);
2460 auto state = oldState;
2462 std::set<int> crossingIndices;
2464 for (
const auto& crossing : node->getCrossings()) {
2465 crossingIndices.insert(crossing->tlLinkIndex);
2466 crossingIndices.insert(crossing->tlLinkIndex2);
2470 bool haveGreen =
false;
2471 bool haveYellow =
false;
2472 for (
const auto& linkStateChar : state) {
2479 if (haveGreen && haveYellow) {
2481 duration =
TIME2STEPS(neteditOptions.getInt(
"tls.left-green.time"));
2482 for (
int i = 0; i < (int)state.size(); i++) {
2489 }
else if (haveGreen) {
2493 for (
int i = 0; i < (int)state.size(); i++) {
2495 if (crossingIndices.count(i) == 0) {
2502 }
else if (haveYellow) {
2503 duration =
TIME2STEPS(neteditOptions.isDefault(
"tls.allred.time") ? 2 : neteditOptions.getInt(
"tls.allred.time"));
2505 for (
int i = 0; i < (int)state.size(); i++) {
2513 const int nextIndex = (
myPhaseTable->getNumRows() > newIndex) ? newIndex : 0;
2514 const std::string state2 =
myPhaseTable->getItemText(nextIndex, (TLSStatic ? 2 : 4));
2515 for (
int i = 0; i < (int)state.size(); i++) {
2518 state[i] = oldState[i];
2528 myTLSEditorParent->myEditedDef->getLogic()->addStep(duration, state, std::vector<int>(),
"", newIndex);
2538 if (
value.empty()) {
2565 const auto newState =
value.empty() ? phase.state :
value;
2568 myTLSEditorParent->myEditedDef->getLogic()->addStep(phase.duration, newState, phase.next, phase.name, row);
2581 if (
value.size() > 0) {
2600 for (
const auto nextPhase : nextEdited) {
2601 if ((nextPhase < 0) || (nextPhase >=
myPhaseTable->getNumRows())) {
2627 if (
value.empty()) {
2655 if (
value.empty()) {
2683 if (
value.empty()) {
2691 if (earliestEnd > 0) {
2692 myTLSEditorParent->myEditedDef->getLogic()->setPhaseEarliestEnd(row, earliestEnd);
2711 if (
value.empty()) {
2719 if (latestEnd > 0) {
2739 if (
value.empty()) {
2767 if (
value.empty()) {
2795 if (
value.empty()) {
2823 for (
const auto& phase :
myTLSEditorParent->myEditedDef->getLogic()->getPhases()) {
2824 cycleDuration += phase.duration;
2843 for (std::vector<NBTrafficLightLogic::PhaseDefinition>::const_iterator it = phases.begin(); it != phases.end(); it++, ++i) {
2844 bool oldRef = std::find(it->next.begin(), it->next.end(), oldNext) != it->next.end();
2845 bool newRef = std::find(it->next.begin(), it->next.end(), newNext) != it->next.end();
2846 std::vector<int> nextPhases(it->next);
2847 bool changed =
false;
2849 if (oldRef && newRef) {
2850 std::replace(nextPhases.begin(), nextPhases.end(), oldNext, -1);
2851 std::replace(nextPhases.begin(), nextPhases.end(), newNext, oldNext);
2852 std::replace(nextPhases.begin(), nextPhases.end(), -1, newNext);
2854 }
else if (oldRef) {
2855 std::replace(nextPhases.begin(), nextPhases.end(), oldNext, newNext);
2857 }
else if (newRef) {
2858 std::replace(nextPhases.begin(), nextPhases.end(), newNext, oldNext);
2861 }
else if (oldRef) {
2863 nextPhases.erase(std::find(nextPhases.begin(), nextPhases.end(), oldNext));
2865 std::replace(nextPhases.begin(), nextPhases.end(), oldNext, newNext);
2902 }
else if (
myTLSEditorParent->myTLSAttributes->isSetDetectorsToggleButtonEnabled()) {
2933 opendialog.setSelectMode(SELECTFILE_EXISTING);
2938 if (opendialog.execute()) {
2946 std::set<NBLoadedSUMOTLDef*> newDefsOtherProgram;
2951 newDefSameProgram = sdef;
2953 newDefsOtherProgram.insert(sdef);
2957 const int newPrograms = (int)newDefsOtherProgram.size();
2958 if (newPrograms > 0 || newDefSameProgram !=
nullptr) {
2960 for (
auto newProg : newDefsOtherProgram) {
2961 for (
auto it_node : nodes) {
2966 if (newPrograms > 0) {
2969 if (newDefSameProgram !=
nullptr) {
2982 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
3016 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 GUIDesignTextColorRed
red color (for invalid text)
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
#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 GUIDesignTextColorBlack
black color (for correct text)
#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.
const std::string invalid_return< std::string >::value
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.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const std::string getID() const override
get ID (all Attribute Carriers have one)
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
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
Result getResult() const
get result to indicate if this dialog was closed accepting or rejecting changes
GNEViewNet * getViewNet() const
get view net
GNEViewNet * myViewNet
FOX need this.
virtual void show()
show Frame
virtual void hide()
hide Frame
GNEFrame(GNEViewParent *viewParent, GNEViewNet *viewNet, const std::string &frameLabel)
Constructor.
GNEGroupBoxModule (based on FXGroupBox).
Options
GroupBoxModule options.
GNEGroupBoxModule(GNEFrame *frame, const std::string &text, const int options=Options::COLLAPSIBLE)
constructor for frames
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
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 override
std::vector< GNEConnection * > getGNEConnections() const
Returns all GNEConnections vinculated with this junction.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
NBNode * getNBNode() const
Return net build node.
GNEEdge * getParentEdge() const
get parent edge
std::vector< std::pair< std::string, std::string > > getEditedParameters() const
get edited 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::map< std::string, std::string > myE1Detectors
set with E1 detector IDs and their lanes vinculated with the TLS <laneID, E1ID>
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
GNETLSEditorFrame * myTLSEditorParent
pointer to TLSEditorParent
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
GNETLSEditorFrame * myTLSEditorParent
pointer to TLSEditor Parent
long onCmdChangeType(FXObject *, FXSelector, void *)
Called when the user change TLS Type.
long onCmdDisjoinTLS(FXObject *, FXSelector, void *)
Called when the user join TLS.
std::vector< std::string > mySelectedJunctionIDs
selected junction (used for join)
GNETLSEditorFrame * myTLSEditorParent
TLS editor frame parent.
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.
std::vector< std::string > myOriginalSelectedJunctionIDs
original selected junction (used for join)
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
GNEJunction * myCurrentJunction
the junction of the tls is being modified
bool isJunctionSelected(const GNEJunction *junction) const
check if given junction is selected (used fo joining)
MFXTextFieldIcon * myJunctionIDTextField
text field for junction ID
MFXButtonTooltip * myDisjoinTLSButton
button for disjoin TLS
bool isJoiningJunctions() const
is joining junctions
MFXTextFieldIcon * myTLSIDTextField
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 updateNextPhase(const int oldNext, const int newNext=-1, const bool swap=false)
update phase references given in next field
void initStaticPhaseTable()
init static phase table
GNETLSEditorFrame * myTLSEditorParent
pointer to TLSEditor Parent
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
GNETLSEditorFrame * myTLSEditorParent
pointer to GNETLSEditorFrame parent
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.
bool myHaveModifications
whether the current tls was modified
std::vector< NBTrafficLightDefinition * > myTLSPrograms
the list of Definitions for the current junction
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::TLSFile * myTLSFile
module for load/Save TLS Programs
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)
GNETLSEditorFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
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
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
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
GNEViewParent * getViewParent() const
get the net object
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
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.
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.
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