102 GNEFrame(viewParent, viewNet,
TL(
"Edit Traffic Light")),
181 for (
const auto& junction : viewObjects.
getJunctions()) {
201 TL(
"Save TLS Changes"),
202 TL(
"There are unsaved changes in the currently edited traffic light."),
203 TL(
"Do you want to save it before changing mode?"));
229 std::set<NBTrafficLightDefinition*> origDefs;
233 if (logic !=
nullptr) {
235 std::vector<NBNode*> nodes = def->getNodes();
236 for (
auto it_node : nodes) {
237 GNEJunction* junction =
myViewNet->getNet()->getAttributeCarriers()->retrieveJunction(it_node->getID());
241 tmpTLLCont.
insert(duplicate);
242 origDefs.insert(duplicate);
244 WRITE_WARNINGF(
TL(
"tlLogic '%', program '%' could not be built"), def->getID(), def->getProgramID());
250 std::vector<NBLoadedSUMOTLDef*> loadedTLS;
253 if (sdef !=
nullptr) {
254 loadedTLS.push_back(sdef);
258 for (
auto def : loadedTLS) {
259 if (origDefs.count(def) != 0) {
264 std::vector<NBNode*> nodes = def->getNodes();
266 for (
auto it_node : nodes) {
267 GNEJunction* junction =
myViewNet->getNet()->getAttributeCarriers()->retrieveJunction(it_node->getID());
274 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
294 for (
const auto& node :
myTLSPrograms->getCurrentTLSPrograms()->getNodes()) {
295 myViewNet->getNet()->getAttributeCarriers()->retrieveJunction(node->getID())->selectTLS(
false);
345 for (
const auto& internalLane : internalLanes.second) {
347 myViewNet->getNet()->getAttributeCarriers()->deleteInternalLane(internalLane);
355 if (tlDef !=
nullptr) {
356 const int NUM_POINTS = 10;
359 const std::string innerID =
":" + nbnCurrentJunction->
getID();
362 for (
const auto& link : links) {
363 int tlIndex = link.getTLIndex();
366 const NBEdge::Connection& con = link.getFrom()->getConnection(link.getFromLane(), link.getTo(), link.getToLane());
370 shape = link.getFrom()->getToNode()->computeInternalLaneShape(link.getFrom(),
NBEdge::Connection(link.getFromLane(),
371 link.getTo(), link.getToLane()), NUM_POINTS);
376 const PositionVector laneShapeFrom = link.getFrom()->getLaneShape(link.getFromLane());
377 const PositionVector laneShapeTo = link.getTo()->getLaneShape(link.getToLane());
383 myViewNet->getNet()->getAttributeCarriers()->insertInternalLane(internalLane);
387 for (
const auto& nbn : tlDef->
getNodes()) {
388 for (
const auto& crossing : nbn->getCrossings()) {
389 if (crossing->tlLinkIndex2 > 0 && crossing->tlLinkIndex2 != crossing->tlLinkIndex) {
395 myViewNet->getNet()->getAttributeCarriers()->insertInternalLane(internalLane);
401 myViewNet->getNet()->getAttributeCarriers()->insertInternalLane(internalLaneReverse);
402 myInternalLanes[crossing->tlLinkIndex2].push_back(internalLaneReverse);
407 myViewNet->getNet()->getAttributeCarriers()->insertInternalLane(internalLane);
424 if ((index >= 0) || (index < (
int)
myEditedDef->getLogic()->getPhases().size())) {
425 return myEditedDef->getLogic()->getPhases().at(index);
436 const auto selectedRow =
myTLSPhases->getPhaseTable()->getCurrentSelectedRow();
438 for (
int row = 0; row < (int)
myEditedDef->getLogic()->getPhases().size(); row++) {
447 myTLSPhases->getPhaseTable()->selectRow(selectedRow);
458 std::set<std::string> fromIDs;
463 fromIDs.insert(it_lane->getMicrosimID());
468 const auto selectedEdge =
myViewNet->getNet()->getAttributeCarriers()->getSelectedEdges();
469 for (
const auto& edge : selectedEdge) {
470 for (
auto it_lane : edge->getChildLanes()) {
471 fromIDs.insert(it_lane->getMicrosimID());
477 const auto selectedLanes =
myViewNet->getNet()->getAttributeCarriers()->getSelectedLanes();
478 for (
auto it_lane : selectedLanes) {
479 fromIDs.insert(it_lane->getMicrosimID());
485 for (
auto it : links) {
486 if (fromIDs.count(it.getFrom()->getLaneID(it.getFromLane())) > 0) {
487 std::vector<GNEInternalLane*> lanes =
myInternalLanes[it.getTLIndex()];
488 for (
auto it_lane : lanes) {
489 it_lane->onDefault(obj, sel, eventData);
501 for (
auto it : links) {
530 myViewNet->getNet()->getAttributeCarriers()->retrieveJunction(node->getID())->selectTLS(
true);
537 myViewNet->setStatusBarText(
TL(
"Unsaved modifications. Abort or Save"));
574 TL(
"Assign E1 detectors") + std::string(
"\t") +
TL(
"Enable assign E1 mode") + std::string(
"\t") +
TL(
"Assign E1 detectors to the current TLS"),
575 TL(
"Assign E1 detectors") + std::string(
"\t") +
TL(
"Disable assign E1 mode") + std::string(
"\t") +
TL(
"Assign E1 detectors to the current TLS"),
655 if (junction ==
nullptr) {
748 const auto laneID =
E1->getParentLanes().front()->getID();
751 if (
E1->getID() == it->second) {
760 }
else if (laneID == it->first) {
782const std::map<std::string, std::string>&
830 myTLSEditorParent->myEditedDef->setParameters(parametersDialog.getEditedParameters());
865 for (
const auto& parameter :
myTLSEditorParent->myEditedDef->getParametersMap()) {
867 if (
myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveLane(parameter.first,
false) &&
886 const auto staticTooltip = TLSEditorParent->
getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
911 TL(
"Join") + std::string(
"\t") +
TL(
"Enable join mode") + std::string(
"\t") +
TL(
"Join TLS and junctions in the current junction."),
912 TL(
"Join") + std::string(
"\t") +
TL(
"Disable join mode") + std::string(
"\t") +
TL(
"Join TLS and junctions in the current junction."),
916 TL(
"Disjoin") + std::string(
"\t") +
TL(
"Disjoin current TLS") + std::string(
"\t") +
TL(
"Disjoin current TLS."),
983 if (
TLS->getNodes().size() == 1) {
1035const std::vector<std::string>&
1044 const std::string currentTLID = (*
myCurrentJunction->getNBNode()->getControllingTLS().begin())->getID();
1047 if (newTLID.empty() || (newTLID == currentTLID)) {
1099 if (newTLType.empty() || (newTLType == currentTLType)) {
1160 const auto TLNodes = (*
myCurrentJunction->getNBNode()->getControllingTLS().begin())->getNodes();
1163 for (
const auto& TLNode : TLNodes) {
1178 std::vector<GNEJunction*> selectedJunctions, resetTLJunctions;
1181 if (selectedJunctionID != currentJunction->getID()) {
1182 selectedJunctions.push_back(
myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(selectedJunctionID));
1186 for (
const auto& TLNBNode : (*currentJunction->getNBNode()->getControllingTLS().begin())->getNodes()) {
1187 if (TLNBNode != currentJunction->getNBNode()) {
1188 resetTLJunctions.push_back(
myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(TLNBNode->getID()));
1196 for (
const auto& resetTLJunction : resetTLJunctions) {
1200 for (
const auto& selectedJunction : selectedJunctions) {
1225 std::vector<GNEJunction*> resetTLJunctions;
1227 for (
const auto& TLNBNode : (*currentJunction->getNBNode()->getControllingTLS().begin())->getNodes()) {
1228 resetTLJunctions.push_back(
myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(TLNBNode->getID()));
1231 const auto type = resetTLJunctions.front()->getAttribute(
SUMO_ATTR_TYPE);
1232 const auto tlType = resetTLJunctions.front()->getAttribute(
SUMO_ATTR_TLTYPE);
1239 const std::string oldId = currentJunction->getAttribute(
SUMO_ATTR_TLID);
1240 const std::string tmpIdBase = oldId +
"_TMP";
1242 std::string tmpId = tmpIdBase +
toString(tmpIndex);
1243 while (tllCont.
exist(tmpId)) {
1244 tmpId = tmpIdBase +
toString(++tmpIndex);
1250 for (
const auto& resetTLJunction : resetTLJunctions) {
1301 if (TLSs.size() > 0) {
1303 const auto TLS = (*TLSs.begin());
1305 if (
TLS->getNodes().size() > 1) {
1307 std::string TLSNodesStr;
1308 for (
auto it =
TLS->getNodes().begin(); it !=
TLS->getNodes().end(); it++) {
1309 if (it == (
TLS->getNodes().end() - 1)) {
1310 TLSNodesStr += (*it)->getID();
1312 TLSNodesStr += (*it)->getID() +
", ";
1318 if (
TLS->getNodes().size() > 1) {
1401 }
else if (
myTLSEditorParent->myTLSAttributes->isSetDetectorsToggleButtonEnabled()) {
1445 const auto currentJunction =
myTLSEditorParent->myTLSJunction->getCurrentJunction();
1447 if (currentJunction ==
nullptr) {
1449 }
else if (currentJunction->getNBNode()->isTLControlled()) {
1473 if (junction ==
nullptr) {
1479 std::set<std::string> programIDs;
1480 for (
const auto&
TLS : junction->getNBNode()->getControllingTLS()) {
1482 programIDs.insert(
TLS->getProgramID());
1484 for (
const auto& programID : programIDs) {
1554 if (currentJunction !=
nullptr) {
1559 if (editJunctionAgain) {
1577 TL(
"TLS cannot be created"),
1578 TL(
"Traffic Light cannot be created because junction must have"),
1579 TL(
"at least one incoming edge and one outgoing edge.")
1587 TL(
"TLS cannot be created"),
1588 TL(
"Traffic Light cannot be created because junction"),
1589 TL(
"must have at least one connection.")
1594 bool connectionControlled =
false;
1596 if (!connection->getNBEdgeConnection().uncontrolled) {
1597 connectionControlled =
true;
1600 if (!connectionControlled) {
1603 TL(
"TLS cannot be created"),
1604 TL(
"Traffic Light cannot be created because junction"),
1605 TL(
"must have at least one controlled connection.")
1627 const bool changeJunctionType = (
myTLSEditorParent->myTLSPrograms->getNumberOfPrograms() == 1);
1631 if (changeJunctionType) {
1686 std::vector<GNEJunction*> TLSJunctions;
1687 for (
const auto& TLSNode : oldDef->
getNodes()) {
1688 TLSJunctions.push_back(
myTLSEditorParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveJunction(TLSNode->getID()));
1737 const auto currentJunction =
myTLSEditorParent->myTLSJunction->getCurrentJunction();
1741 if (currentJunction !=
nullptr) {
1743 std::vector<NBNode*> nodes = oldDefinition->getNodes();
1745 for (
const auto& node : nodes) {
1794 if (junction ==
nullptr) {
1803 if (
TLS->getProgramID() == currentTLS) {
1808 if (tpl ==
nullptr) {
1850 if (tllogic !=
nullptr) {
1864 myTLSEditorParent->getViewNet()->setStatusBarText(
TL(
"Traffic Light does not control any links"));
1887 TL(
"Clean States") + std::string(
"\t") +
1888 TL(
"Clean unused states from all phase") + std::string(
"\t") +
1889 TL(
"Clean unused states from all phase. (Not allowed for multiple programs)"),
1894 TL(
"Add States") + std::string(
"\t") +
1895 TL(
"Extend the state vector for all phases by one entry") + std::string(
"\t") +
1896 TL(
"Extend the state vector for all phases by one entry. (Unused until a connection or crossing is assigned to the new index)"),
1901 TL(
"Group Sig.") + std::string(
"\t") +
1902 TL(
"Shorten state definition by letting connections with the same signal states use the same index") + std::string(
"\t") +
1903 TL(
"Shorten state definition by letting connections with the same signal states use the same index. (Not allowed for multiple programs)"),
1908 TL(
"Ungroup Sig.") + std::string(
"\t") +
1909 TL(
"Let every connection use a distinct index (reverse state grouping)") + std::string(
"\t") +
1910 TL(
"Let every connection use a distinct index (reverse state grouping). (Not allowed for multiple programs)"),
2026 int colDuration = 1;
2032 int colEarliestEnd = -1;
2033 int colLatestEnd = -1;
2067 if (col == colDuration) {
2069 }
else if (col == colState) {
2071 }
else if (col == colNext) {
2073 }
else if (col == colName) {
2075 }
else if (col == colMinDur) {
2077 }
else if (col == colMaxDur) {
2079 }
else if (col == colEarliestEnd) {
2081 }
else if (col == colLatestEnd) {
2083 }
else if (col == colVehExt) {
2085 }
else if (col == colYellow) {
2087 }
else if (col == colRed) {
2143 const auto newRow =
MAX2(0, (row - 1));
2183 if (row == (
int)
myTLSEditorParent->myEditedDef->getLogic()->getPhases().size() - 1) {
2191 if (row == (
int)
myTLSEditorParent->myEditedDef->getLogic()->getPhases().size() - 1) {
2207 int tlIndex = internalLane.first;
2208 std::vector<GNEInternalLane*> lanes = internalLane.second;
2210 if (tlIndex >= 0 && tlIndex < (
int)phase.state.size()) {
2211 state = (
LinkState)phase.state[tlIndex];
2213 for (
const auto& lane : lanes) {
2214 lane->setLinkState(state);
2275 const int colDuration = 1;
2276 const int colState = 2;
2277 const int colNext = 3;
2278 const int colName = 4;
2282 myPhaseTable->setTableSize(
"sup-midtb", (
int)phases.size());
2284 for (
int row = 0; row < (int)phases.size(); row++) {
2286 myPhaseTable->setItemText(row, colState, phases.at(row).state.c_str());
2287 myPhaseTable->setItemText(row, colNext, phases.at(row).next.size() > 0 ?
toString(phases.at(row).next).c_str() :
"");
2288 myPhaseTable->setItemText(row, colName, phases.at(row).name.c_str());
2306 const int colDuration = 1;
2307 const int colMinDur = 2;
2308 const int colMaxDur = 3;
2309 const int colState = 4;
2310 const int colEarliestEnd = 5;
2311 const int colLatestEnd = 6;
2312 const int colNext = 7;
2313 const int colName = 8;
2317 myPhaseTable->setTableSize(
"suffpff-midtb", (
int)phases.size());
2319 for (
int row = 0; row < (int)phases.size(); row++) {
2323 myPhaseTable->setItemText(row, colState, phases.at(row).state.c_str());
2326 myPhaseTable->setItemText(row, colNext, phases.at(row).next.size() > 0 ?
toString(phases.at(row).next).c_str() :
"");
2327 myPhaseTable->setItemText(row, colName, phases.at(row).name.c_str());
2333 myPhaseTable->setColumnLabelTop(colEarliestEnd,
"ear.end",
"earlyEnd");
2334 myPhaseTable->setColumnLabelTop(colLatestEnd,
"lat.end",
"latestEnd");
2349 const int colDuration = 1;
2350 const int colMinDur = 2;
2351 const int colMaxDur = 3;
2352 const int colState = 4;
2353 const int colNext = 5;
2354 const int colName = 6;
2358 myPhaseTable->setTableSize(
"suffp-midtb", (
int)phases.size());
2360 for (
int row = 0; row < (int)phases.size(); row++) {
2364 myPhaseTable->setItemText(row, colState, phases.at(row).state.c_str());
2365 myPhaseTable->setItemText(row, colNext, phases.at(row).next.size() > 0 ?
toString(phases.at(row).next).c_str() :
"");
2366 myPhaseTable->setItemText(row, colName, phases.at(row).name.c_str());
2386 const int colDuration = 1;
2387 const int colMinDur = 2;
2388 const int colMaxDur = 3;
2389 const int colState = 4;
2390 const int colVehExt = 5;
2391 const int colYellow = 6;
2392 const int colRed = 7;
2393 const int colNext = 8;
2394 const int colName = 9;
2398 myPhaseTable->setTableSize(
"suffpfff-midtb", (
int)phases.size());
2400 for (
int row = 0; row < (int)phases.size(); row++) {
2404 myPhaseTable->setItemText(row, colState, phases.at(row).state.c_str());
2408 myPhaseTable->setItemText(row, colNext, phases.at(row).next.size() > 0 ?
toString(phases.at(row).next).c_str() :
"");
2409 myPhaseTable->setItemText(row, colName, phases.at(row).name.c_str());
2416 myPhaseTable->setColumnLabelTop(colVehExt,
"vehExt",
"vehicle extension");
2437 const int newIndex = row + 1;
2440 const auto oldState =
myPhaseTable->getItemText(row, TLSStatic ? 2 : 4);
2441 auto state = oldState;
2443 std::set<int> crossingIndices;
2445 for (
const auto& crossing : node->getCrossings()) {
2446 crossingIndices.insert(crossing->tlLinkIndex);
2447 crossingIndices.insert(crossing->tlLinkIndex2);
2451 bool haveGreen =
false;
2452 bool haveYellow =
false;
2453 for (
const auto& linkStateChar : state) {
2460 if (haveGreen && haveYellow) {
2462 duration =
TIME2STEPS(neteditOptions.getInt(
"tls.left-green.time"));
2463 for (
int i = 0; i < (int)state.size(); i++) {
2470 }
else if (haveGreen) {
2474 for (
int i = 0; i < (int)state.size(); i++) {
2476 if (crossingIndices.count(i) == 0) {
2483 }
else if (haveYellow) {
2484 duration =
TIME2STEPS(neteditOptions.isDefault(
"tls.allred.time") ? 2 : neteditOptions.getInt(
"tls.allred.time"));
2486 for (
int i = 0; i < (int)state.size(); i++) {
2493 const int nextIndex = (
myPhaseTable->getNumRows() > newIndex) ? newIndex : 0;
2494 const std::string state2 =
myPhaseTable->getItemText(nextIndex, (TLSStatic ? 2 : 4));
2495 for (
int i = 0; i < (int)state.size(); i++) {
2498 state[i] = oldState[i];
2507 myTLSEditorParent->myEditedDef->getLogic()->addStep(duration, state, std::vector<int>(),
"", newIndex);
2517 if (
value.empty()) {
2544 const auto newState =
value.empty() ? phase.state :
value;
2547 myTLSEditorParent->myEditedDef->getLogic()->addStep(phase.duration, newState, phase.next, phase.name, row);
2560 if (
value.size() > 0) {
2579 for (
const auto nextPhase : nextEdited) {
2580 if ((nextPhase < 0) || (nextPhase >=
myPhaseTable->getNumRows())) {
2606 if (
value.empty()) {
2634 if (
value.empty()) {
2662 if (
value.empty()) {
2670 if (earliestEnd > 0) {
2671 myTLSEditorParent->myEditedDef->getLogic()->setPhaseEarliestEnd(row, earliestEnd);
2690 if (
value.empty()) {
2698 if (latestEnd > 0) {
2718 if (
value.empty()) {
2746 if (
value.empty()) {
2774 if (
value.empty()) {
2802 for (
const auto& phase :
myTLSEditorParent->myEditedDef->getLogic()->getPhases()) {
2803 cycleDuration += phase.duration;
2843 }
else if (
myTLSEditorParent->myTLSAttributes->isSetDetectorsToggleButtonEnabled()) {
2874 opendialog.setSelectMode(SELECTFILE_EXISTING);
2879 if (opendialog.execute()) {
2887 std::set<NBLoadedSUMOTLDef*> newDefsOtherProgram;
2892 newDefSameProgram = sdef;
2894 newDefsOtherProgram.insert(sdef);
2898 const int newPrograms = (int)newDefsOtherProgram.size();
2899 if (newPrograms > 0 || newDefSameProgram !=
nullptr) {
2901 for (
auto newProg : newDefsOtherProgram) {
2902 for (
auto it_node : nodes) {
2907 if (newPrograms > 0) {
2910 if (newDefSameProgram !=
nullptr) {
2923 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
2957 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
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.
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
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 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
MFXGroupBoxModule (based on FXGroupBox).
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
Options
GroupBoxModule options.
MFXGroupBoxModule(GNEFrame *frame, const std::string &text, const int options=Options::COLLAPSIBLE)
constructor for frames
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