 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
84 FXIMPLEMENT(
GNETLSEditorFrame, FXVerticalFrame, GNETLSEditorFrameMap, ARRAYNUMBER(GNETLSEditorFrameMap))
93 GNEFrame(horizontalFrameParent, viewNet, "Edit Traffic Light"),
94 myEditedDef(
nullptr) {
151 WRITE_DEBUG(
"Opening question FXMessageBox 'save TLS'");
153 FXuint answer = FXMessageBox::question(
this, MBOX_YES_NO_CANCEL,
154 "Save TLS Changes",
"%s",
155 "There is unsaved changes in current edited traffic light.\nDo you want to save it before changing mode?");
156 if (answer == MBOX_CLICKED_YES) {
158 WRITE_DEBUG(
"Closed FXMessageBox 'save TLS' with 'YES'");
162 }
else if (answer == MBOX_CLICKED_NO) {
164 WRITE_DEBUG(
"Closed FXMessageBox 'save TLS' with 'No'");
170 WRITE_DEBUG(
"Closed FXMessageBox 'save TLS' with 'Cancel'");
186 std::set<NBTrafficLightDefinition*> origDefs;
190 if (logic !=
nullptr) {
192 std::vector<NBNode*> nodes = def->getNodes();
193 for (
auto it_node : nodes) {
199 origDefs.insert(copy);
201 WRITE_WARNING(
"tlLogic '" + def->getID() +
"', program '" + def->getProgramID() +
"' could not be built");
207 std::vector<NBLoadedSUMOTLDef*> loadedTLS;
210 if (sdef !=
nullptr) {
211 loadedTLS.push_back(sdef);
215 for (
auto def : loadedTLS) {
216 if (origDefs.count(def) != 0) {
221 std::vector<NBNode*> nodes = def->getNodes();
223 for (
auto it_node : nodes) {
231 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
253 std::vector<NBNode*> nodes = oldDefinition->
getNodes();
254 for (
auto it : nodes) {
286 WRITE_DEBUG(
"Opening warning FXMessageBox 'invalid TLS'");
288 FXMessageBox::warning(
this, MBOX_OK,
289 "TLS cannot be created",
"%s",
290 "Traffic Light cannot be created because junction must have\n at least one incoming edge and one outgoing edge.");
322 if (tllogic !=
nullptr) {
344 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
352 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
361 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
369 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
377 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
423 int tlIndex = it.first;
424 std::vector<GNEInternalLane*> lanes = it.second;
426 if (tlIndex >= 0 && tlIndex < (
int)phase.
state.size()) {
429 for (
auto it_lane : lanes) {
430 it_lane->setLinkState(state);
453 std::set<int> crossingIndices;
456 crossingIndices.insert(c->tlLinkIndex);
457 crossingIndices.insert(c->tlLinkIndex2);
462 bool haveGreen =
false;
463 bool haveYellow =
false;
464 for (
char c : state) {
472 if (haveGreen && haveYellow) {
475 for (
int i = 0; i < (int)state.size(); i++) {
482 }
else if (haveGreen) {
486 for (
int i = 0; i < (int)state.size(); i++) {
488 if (crossingIndices.count(i) == 0) {
495 }
else if (haveYellow) {
498 for (
int i = 0; i < (int)state.size(); i++) {
549 FXTablePos* tp = (FXTablePos*)ptr;
551 const int colDuration = 0;
558 if (tp->col == colDuration) {
560 if (GNEAttributeCarrier::canParse<double>(value.text())) {
571 }
else if (tp->col == colMinDur) {
573 if (GNEAttributeCarrier::canParse<double>(value.text())) {
587 }
else if (tp->col == colMaxDur) {
589 if (GNEAttributeCarrier::canParse<double>(value.text())) {
603 }
else if (tp->col == colState) {
616 }
else if (tp->col == colNext) {
620 std::vector<int> next = GNEAttributeCarrier::parse<std::vector<int> >(value.text());
635 }
else if (tp->col == colName) {
674 for (
auto it_intLanes : it.second) {
681 if (tlDef !=
nullptr) {
685 std::string innerID =
":" + nbn->
getID();
687 for (
auto it : links) {
688 int tlIndex = it.getTLIndex();
694 PositionVector laneShapeFrom = it.getFrom()->getLaneShape(it.getFromLane());
695 PositionVector laneShapeTo = it.getTo()->getLaneShape(it.getToLane());
704 for (
auto c : nbn->getCrossings()) {
705 if (c->tlLinkIndex2 > 0 && c->tlLinkIndex2 != c->tlLinkIndex) {
736 const std::vector<NBTrafficLightLogic::PhaseDefinition>&
746 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases =
getPhases();
747 for (
int row = 0; row < (int)phases.size(); row++) {
763 std::set<std::string> fromIDs;
768 for (
auto it_lane : edge.
getLanes()) {
769 fromIDs.insert(it_lane->getMicrosimID());
775 for (
auto it : edges) {
776 for (
auto it_lane : it->getLanes()) {
777 fromIDs.insert(it_lane->getMicrosimID());
784 for (
auto it_lane : lanes) {
785 fromIDs.insert(it_lane->getMicrosimID());
791 for (
auto it : links) {
792 if (fromIDs.count(it.getFrom()->getLaneID(it.getFromLane())) > 0) {
793 std::vector<GNEInternalLane*> lanes =
myInternalLanes[it.getTLIndex()];
794 for (
auto it_lane : lanes) {
795 it_lane->onDefault(obj, sel, eventData);
807 for (
auto it : links) {
819 assert(GNEAttributeCarrier::canParse<double>(
string.text()));
820 return TIME2STEPS(GNEAttributeCarrier::parse<double>(
string.text()));
829 myTLSEditorParent(TLSEditorParent) {
857 myTLSDefinitions.clear();
859 myNameTextField->enable();
861 myOffsetTextField->enable();
864 myTLSDefinitions.push_back(it);
865 myNameTextField->setText(it->getID().c_str());
866 myNameTextField->enable();
867 myProgramComboBox->appendItem(it->getProgramID().c_str());
869 if (myTLSDefinitions.size() > 0) {
870 myProgramComboBox->enable();
871 myProgramComboBox->setCurrentItem(0);
872 myProgramComboBox->setNumVisible(myProgramComboBox->getNumItems());
873 myTLSEditorParent->onCmdDefSwitch(
nullptr, 0,
nullptr);
881 myTLSDefinitions.clear();
883 myNameTextField->setText(
"");
884 myNameTextField->disable();
886 myProgramComboBox->clearItems();
887 myProgramComboBox->disable();
889 myOffsetTextField->setText(
"");
890 myOffsetTextField->disable();
896 return myTLSDefinitions.at(myProgramComboBox->getCurrentItem());
902 return (
int)myTLSDefinitions.size();
908 return myProgramComboBox->getNumItems();
929 myTLSEditorParent(TLSEditorParent),
930 myCurrentJunction(nullptr) {
953 return myCurrentJunction;
959 myCurrentJunction = junction;
965 if (myCurrentJunction ==
nullptr) {
966 myTextFieldJunctionID->setText(
"");
967 myTextFieldJunctionStatus->setText(
"");
969 NBNode* nbn = myCurrentJunction->getNBNode();
970 myTextFieldJunctionID->setText(nbn->
getID().c_str());
972 myTextFieldJunctionStatus->setText(
"uncontrolled");
974 myTextFieldJunctionStatus->setText(myTLSEditorParent->myTLSModifications->checkHaveModifications() ?
"modified" :
"unmodified");
986 myNewTLProgram =
new FXButton(
this,
"Create TLS\t\tCreate a new traffic light program",
989 myDeleteTLProgram =
new FXButton(
this,
"Delete TLS\t\tDelete a traffic light program. If all programs are deleted the junction turns into a priority junction.",
1004 myTLSEditorParent(TLSEditorParent),
1005 myTableFont(new FXFont(getApp(),
"Courier New", 9)) {
1008 myTableScroll =
new FXScrollWindow(
this, LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT);
1011 myPhaseTable->setColumnHeaderHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent() / 2);
1016 myPhaseTable->setHelpText(
"phase duration in seconds | phase state");
1045 return myPhaseTable;
1051 myPhaseTable->setVisibleRows(1);
1052 myPhaseTable->setVisibleColumns(2);
1053 myPhaseTable->hide();
1054 if (myTLSEditorParent->myTLSAttributes->getNumberOfTLSDefinitions() > 0) {
1055 const bool fixed = myTLSEditorParent->fixedDuration();
1056 const int cols = fixed ? 4 : 6;
1057 const int colDuration = 0;
1058 const int colMinDur = fixed ? -1 : 1;
1059 const int colMaxDur = fixed ? -1 : 2;
1060 const int colState = fixed ? 1 : 3;
1061 const int colNext = fixed ? 2 : 4;
1062 const int colName = fixed ? 3 : 5;
1064 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases = myTLSEditorParent->getPhases();
1065 myPhaseTable->setTableSize((
int)phases.size(), cols);
1066 myPhaseTable->setVisibleRows((
int)phases.size());
1067 myPhaseTable->setVisibleColumns(cols);
1068 for (
int row = 0; row < (int)phases.size(); row++) {
1069 myPhaseTable->setItemText(row, colDuration,
toString(
STEPS2TIME(phases[row].duration)).c_str());
1071 myPhaseTable->setItemText(row, colMinDur,
varDurString(phases[row].minDur).c_str());
1072 myPhaseTable->setItemText(row, colMaxDur,
varDurString(phases[row].maxDur).c_str());
1074 myPhaseTable->setItemText(row, colState, phases[row].state.c_str());
1075 myPhaseTable->setItemText(row, colNext, phases[row].next.size() > 0 ?
toString(phases[row].next).c_str() :
" ");
1076 myPhaseTable->setItemText(row, colName, phases[row].name.c_str());
1077 myPhaseTable->getItem(row, 1)->setJustify(FXTableItem::LEFT);
1079 myPhaseTable->fitColumnsToContents(0, cols);
1080 myPhaseTable->setColumnText(colDuration,
"dur");
1081 if (colMinDur >= 0) {
1082 myPhaseTable->setColumnText(colMinDur,
"min");
1083 myPhaseTable->setColumnText(colMaxDur,
"max");
1084 myPhaseTable->setColumnWidth(colMinDur,
MAX2(myPhaseTable->getColumnWidth(colMinDur), 30));
1085 myPhaseTable->setColumnWidth(colMaxDur,
MAX2(myPhaseTable->getColumnWidth(colMaxDur), 35));
1087 myPhaseTable->setColumnText(colState,
"state");
1088 myPhaseTable->setColumnText(colNext,
"nxt");
1089 myPhaseTable->setColumnText(colName,
"name");
1090 myPhaseTable->setColumnWidth(colNext,
MAX2(myPhaseTable->getColumnWidth(colNext), 30));
1091 myPhaseTable->setColumnWidth(colName,
MAX2(myPhaseTable->getColumnWidth(colName), 45));
1093 myPhaseTable->setHeight((
int)phases.size() * 21 + 21);
1094 myPhaseTable->setCurrentItem(index, 0);
1095 myPhaseTable->selectRow(index,
true);
1096 myPhaseTable->show();
1097 myPhaseTable->setFocus();
1098 myTableScroll->setHeight(myPhaseTable->getHeight() + 15);
1105 int neededWidth = 0;
1106 for (
int i = 0; i < cols; i++) {
1107 neededWidth += myPhaseTable->getColumnWidth(i);
1109 myPhaseTable->setDefColumnWidth(neededWidth / cols);
1117 myCycleDuration->show();
1123 myCycleDuration->hide();
1129 for (
auto it : myTLSEditorParent->getPhases()) {
1130 cycleDuration += it.duration;
1133 myCycleDuration->setText(text.c_str());
1142 myTLSEditorParent(TLSEditorParent),
1143 myHaveModifications(false) {
1160 return myHaveModifications;
1166 myHaveModifications = value;
1175 myTLSEditorParent(TLSEditorParent) {
1190 FXFileDialog opendialog(
this,
"Load TLS Program");
1192 opendialog.setSelectMode(SELECTFILE_EXISTING);
1193 opendialog.setPatternList(
"*.xml");
1197 if (opendialog.execute()) {
1201 tmpTLLCont.
insert(myTLSEditorParent->myEditedDef);
1205 std::set<NBLoadedSUMOTLDef*> newDefsOtherProgram;
1206 for (
auto item : tmpTLLCont.
getPrograms(myTLSEditorParent->myEditedDef->getID())) {
1207 if (item.second != myTLSEditorParent->myEditedDef) {
1209 if (item.first == myTLSEditorParent->myEditedDef->getProgramID()) {
1210 newDefSameProgram = sdef;
1212 newDefsOtherProgram.insert(sdef);
1216 const int newPrograms = (int)newDefsOtherProgram.size();
1217 if (newPrograms > 0 || newDefSameProgram !=
nullptr) {
1218 std::vector<NBNode*> nodes = myTLSEditorParent->myEditedDef->
getNodes();
1219 for (
auto newProg : newDefsOtherProgram) {
1220 for (
auto it_node : nodes) {
1222 myTLSEditorParent->getViewNet()->getUndoList()->add(
new GNEChange_TLS(junction, newProg,
true),
true);
1225 if (newPrograms > 0) {
1226 WRITE_MESSAGE(
"Loaded " +
toString(newPrograms) +
" new programs for tlLogic '" + myTLSEditorParent->myEditedDef->getID() +
"'");
1228 if (newDefSameProgram !=
nullptr) {
1230 myTLSEditorParent->myEditedDef = newDefSameProgram;
1231 WRITE_MESSAGE(
"Updated program '" + newDefSameProgram->getProgramID() +
"' for tlLogic '" + myTLSEditorParent->myEditedDef->getID() +
"'");
1234 myTLSEditorParent->getViewNet()->setStatusBarText(
"No programs found for traffic light '" + myTLSEditorParent->myEditedDef->getID() +
"'");
1239 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
1242 myTLSEditorParent->myTLSPhases->initPhaseTable();
1243 myTLSEditorParent->myTLSModifications->setHaveModifications(
true);
1252 "Save TLS Program as",
".xml",
1268 const bool varPhaseLength = myTLSEditorParent->myEditedDef->getLogic()->getType() !=
TLTYPE_STATIC;
1269 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases = myTLSEditorParent->myEditedDef->getLogic()->getPhases();
1270 for (
auto j : phases) {
1274 if (varPhaseLength) {
1292 if (time == std::floor(time)) {
1301 const bool enable = myTLSEditorParent->myTLSAttributes->getNumberOfTLSDefinitions() > 0;
1302 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
void initTLSAttributes(GNEJunction *junction)
initializes the definitions and corresponding listbox
long onCmdDefOffset(FXObject *, FXSelector, void *)
Called when the user changes the offset of a TLS.
FXTextField * myTextFieldJunctionStatus
text field for junction status
GNETLSEditorFrame::TLSAttributes * myTLSAttributes
modul for TLS attributes
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
NBTrafficLightDefinition * getCurrentTLSDefinition() const
get current definition
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
#define GUIDesignTextFieldNCol
Num of column of text field.
GNETLSEditorFrame::TLSJunction * myTLSJunction
modul for TLS Junction
#define WRITE_WARNING(msg)
bool removeProgram(const std::string id, const std::string programID, bool del=true)
Removes a program of a logic definition from the dictionary.
void setPhaseName(int phaseIndex, const std::string &name)
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame and height of 23
GNETLSEditorFrame::TLSPhases * myTLSPhases
modul for TLS Phases
long onUpdDefSwitch(FXObject *, FXSelector, void *)
Called when occurs an update of switch definition.
long onUpdNeedsDef(FXObject *, FXSelector, void *)
Called when occurs an update of needs definition.
long onUpdDefCreate(FXObject *, FXSelector, void *)
Called when occurs an update of create definition.
A container for traffic light definitions and built programs.
SUMOTime getOffset() const
Returns the offset of first switch.
Static storage of an output device and its base (abstract) implementation.
int getNumberOfTLSDefinitions() const
get number of definitions
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
~TLSAttributes()
destructor
long onCmdDefSwitch(FXObject *, FXSelector, void *)
Called when the user switchs a TLS.
FXLabel * myLabelJunctionStatus
label for junction status
Importer for edge connections stored in XML.
void initPhaseTable(int index=0)
initialies the phase table
long onCmdOK(FXObject *, FXSelector, void *)
FXDEFMAP(GNETLSEditorFrame) GNETLSEditorFrameMap[]
std::vector< int > next
next phase indices or empty list
bool isTLSSaved()
check if modifications in TLS was saved
bool checkHaveModifications() const
check if current TLS was modified
int getNumberOfPrograms() const
get number of programs
static std::string varDurString(SUMOTime dur)
convert duration (potentially undefined) to string
long onCmdPhaseDelete(FXObject *, FXSelector, void *)
Called when the user deletes a Phase.
const std::vector< NBTrafficLightLogic::PhaseDefinition > & getPhases()
the phase of the current traffic light
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
void editJunction(GNEJunction *junction)
edits the traffic light for the given junction
void setStatusBarText(const std::string &text)
set staturBar text
GNETLSEditorFrame::TLSModifications * myTLSModifications
modul for load/Save TLS Modifications
SUMOTime getOffset() const
get current offset in SUMOTIme
#define GUIDesignComboBoxNCol
number of column of every combo box
void setPhaseDuration(int phaseIndex, SUMOTime duration)
Modifies the duration for an existing phase (used by NETEDIT)
static OptionsCont & getOptions()
Retrieves the options.
long onUpdModified(FXObject *, FXSelector, void *)
Called when occurs an update of modified.
The link has green light, has to brake.
void setOffset(SUMOTime offset)
Sets the offset of this tls.
double length() const
Returns the length.
FXButton * myLoadTLSProgramButton
button for load TLS Programs
NBTrafficLightLogic * getLogic()
Returns the internal logic.
SUMOTime duration
The duration of the phase in s.
SUMORTree & getVisualisationSpeedUp()
Returns the RTree used for visualisation speed-up.
The link has green light, may pass.
#define GUIDesignTextField
FXTextField * myTextFieldJunctionID
text field for junction ID
a single phase description
void update() const
Mark the entire GNEViewNet to be repainted later.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
FXFont * myTableFont
font for the phase table
void close()
Closes the device and removes it from the dictionary.
void cleanup()
cleans up previous lanes
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
bool changeAllPhases() const
change all phases
std::string writeSUMOTime(SUMOTime steps)
convert SUMOTime into string
GNEJunction * getCurrentJunction() const
get current modified junction
FXLabel * myCycleDuration
label with the cycle duration
The definition of a single phase of the logic.
~TLSModifications()
destructor
void updateJunctionDescription() const
update descrition
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
void setPhaseState(int phaseIndex, int tlIndex, LinkState linkState)
Modifies the state for an existing phase (used by NETEDIT)
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setOffset(SUMOTime offset)
set new offset
std::string state
The state definition.
void addStep(SUMOTime duration, const std::string &state, const std::vector< int > &next=std::vector< int >(), const std::string &name="", int index=-1)
Adds a phase to the logic.
void setHaveModifications(bool value)
set if current TLS was modified
FXLabel * myLabelJunctionID
label for junction ID
A road/street connecting two junctions (netedit-version)
GNENet * getNet() const
get the net object
long onCmdDefSubRename(FXObject *, FXSelector, void *)
Called when the user sub-renames a TLS.
A RT-tree for efficient storing of SUMO's GL-objects.
GNETLSEditorFrame * myTLSEditorParent
pointer to TLSEditor Parent
FXButton * myDeleteTLProgram
button for delete traffic light program
long onUpdNeedsDef(FXObject *, FXSelector, void *)
enable buttons, only when a tlLogic is being edited
NBNode * getNBNode() const
Return net build node.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
bool isTLControlled() const
Returns whether this node is controlled by any tls.
long onCmdDefCreate(FXObject *, FXSelector, void *)
Called when the user creates a TLS.
TrafficLightType getType() const
get the algorithm type (static etc..)
void setPhaseMinDuration(int phaseIndex, SUMOTime duration)
~TLSDefinition()
destructor
The link has yellow light, has to brake anyway.
static std::string prune(const std::string &str)
Removes trailing and leading whitechars.
bool controlsEdge(GNEEdge &edge) const
whether the given edge is controlled by the currently edited tlDef
long onCmdGuess(FXObject *, FXSelector, void *)
Called when the user presses the button Guess.
std::string getAttribute(SumoXMLAttr key) const
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
static const SUMOTime UNSPECIFIED_DURATION
void setStateLength(int numLinks, LinkState fill=LINKSTATE_TL_RED)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
FXButton * myNewTLProgram
button for create new Traffic light program
void setCurrentJunction(GNEJunction *junction)
set current junction
long onCmdDefDelete(FXObject *, FXSelector, void *)
Called when the user deletes a TLS.
FXTextField * myOffsetTextField
the control for modifying offset
std::string name
option phase name
const NBConnectionVector & getControlledLinks() const
returns the controlled links (depends on previous call to collectLinks)
void removeAdditionalGLObject(GUIGlObject *o)
Removes an additional object (detector/shape/trigger) from being visualised.
const std::vector< PhaseDefinition > & getPhases() const
Returns the phases.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
#define GUIDesignTableLimitedHeight
design for table extended over frame but with limited Height
long onCmdPhaseEdit(FXObject *, FXSelector, void *)
Called when the user edits a Phase.
TLSDefinition(GNETLSEditorFrame *TLSEditorParent)
constructor
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
GNETLSEditorFrame * myTLSEditorParent
pointer to TLSEditor Parent
bool parseTLSPrograms(const std::string &file)
parse TLS Programs from a file
int getNumLinks()
Returns the number of participating links.
GNEEdge & getParentEdge()
Returns underlying parent edge.
long onCmdDefRename(FXObject *, FXSelector, void *)
Called when the user renames a TLS.
FXButton * myDeleteSelectedPhaseButton
delete phase button
#define GUIDesignLabelLeft
int computeBrakingTime(double minDecel) const
Computes the time vehicles may need to brake.
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
void handleChange(GNEInternalLane *lane)
update phase definition for the current traffic light and phase
TLSModifications(GNETLSEditorFrame *TLSEditorParent)
constructor
FXTable * getPhaseTable() const
get phase table
const std::vector< NBNode * > & getNodes() const
Returns the list of controlled nodes.
void hideCycleDuration()
hide cycle duration
GNEViewNet * myViewNet
View Net.
GNEUndoList * getUndoList() const
get the undoList object
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
int getTLIndex() const
get Traffic Light index
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
A storage for options typed value containers)
long onCmdSaveTLSProgram(FXObject *, FXSelector, void *)
save TLS Programm to an additional file
FXLabel * myOffsetLabel
offset label
definition related controls
replace program with a newly guessed program
long onCmdPhaseCreate(FXObject *, FXSelector, void *)
Called when the user creates a Phase.
FXString gCurrentFolder
The folder used as last.
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
~GNETLSEditorFrame()
Destructor.
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button.
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
static SUMOTime getSUMOTime(const FXString &string)
converts to SUMOTime
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
void p_abort()
reverts and discards ALL active command groups
TLSJunction(GNETLSEditorFrame *TLSEditorParent)
constructor
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to doubles/floats
FXScrollWindow * myTableScroll
window for oversized phase tables
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
long onUpdNeedsDefAndPhase(FXObject *, FXSelector, void *)
Called when occurs an update of needs definition an dphase.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
bool fixedDuration() const
whether the current traffic light uses fixed phase durations
FXComboBox * myProgramComboBox
the comboBox for selecting the tl-definition to edit
FXLabel * myNameLabel
name label
void buildIinternalLanes(NBTrafficLightDefinition *tlDef)
builds internal lanes for the given tlDef
The link has yellow light, may pass.
GNENet * getNet() const
get Net in which this element is placed
PositionVector reverse() const
reverse position vector
void deletePhase(int index)
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
FXButton * mySaveTLSProgramButton
button for save TLS Programs
long onCmdDefAddOff(FXObject *, FXSelector, void *)
Called when the user adds a OFF.
NBLoadedSUMOTLDef * myEditedDef
the traffic light definition being edited
TLSPhases(GNETLSEditorFrame *TLSEditorParent)
constructor
FXLabel * myProgramLabel
program label
FXButton * mySaveModificationsButtons
button for save modifications
FXButton * myInsertDuplicateButton
insert new phase button
virtual void setParticipantsInformation()
Builds the list of participating nodes/edges/links.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
std::vector< NBConnection > NBConnectionVector
Definition of a connection vector.
FXTable * myPhaseTable
table for selecting and rearranging phases and for changing duration
void handleMultiChange(GNELane *lane, FXObject *obj, FXSelector sel, void *data)
update phase definition for the current traffic light and phase
long onCmdPhaseSwitch(FXObject *, FXSelector, void *)
Called when the user switchs a Phase.
LinkState getLinkState() const
whether link state has been modfied
long onCmdLoadTLSProgram(FXObject *, FXSelector, void *)
void computeJunction(GNEJunction *junction)
trigger recomputation of junction shape and logic param[in] window The window to inform about delay
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
maximum duration of a phase
void updateCycleDuration()
recomputes cycle duration and updates label
void selectTLS(bool selected)
notify the junction of being selected in tls-mode. (used to control drawing)
FXButton * myDiscardModificationsButtons
button for cancel modifications
long onCmdCleanup(FXObject *, FXSelector, void *)
Called when the user cleans up states.
The link has red light (must brake)
long onCmdAddUnused(FXObject *, FXSelector, void *)
Called when the user cleans up states.
void showCycleDuration()
show cycle duration
A SUMO-compliant built logic for a traffic light.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >())
Writes an XML header with optional configuration.
TLIndexMap myInternalLanes
Represents a single node (junction) during network building.
void setPhaseNext(int phaseIndex, const std::vector< int > &next)
NBTrafficLightLogic * getLogic(const std::string &id, const std::string &programID) const
Returns the computed logic for the given name.
A definition of a pedestrian crossing.
Definitions getDefinitions() const
A structure which describes a connection between edges or lanes.
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
selected junction von TLS
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
virtual void show()
show Frame
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string & getID() const
Returns the id.
TLSAttributes(GNETLSEditorFrame *TLSEditorParent)
constructor
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
#define WRITE_MESSAGE(msg)
void clearTLSAttributes()
clear TLS attributes
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
The base class for traffic light logic definitions.
GNETLSEditorFrame * myTLSEditorParent
pointer to TLSEditorParent
void setPhaseMaxDuration(int phaseIndex, SUMOTime duration)
FXTextField * myNameTextField
name text field
A loaded (complete) traffic light logic.