 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
83 FXIMPLEMENT(
GNETLSEditorFrame, FXVerticalFrame, GNETLSEditorFrameMap, ARRAYNUMBER(GNETLSEditorFrameMap))
92 GNEFrame(horizontalFrameParent, viewNet, "Edit Traffic Light"),
93 myEditedDef(
nullptr) {
158 WRITE_DEBUG(
"Opening question FXMessageBox 'save TLS'");
160 FXuint answer = FXMessageBox::question(
this, MBOX_YES_NO_CANCEL,
161 "Save TLS Changes",
"%s",
162 "There is unsaved changes in current edited traffic light.\nDo you want to save it before changing mode?");
163 if (answer == MBOX_CLICKED_YES) {
165 WRITE_DEBUG(
"Closed FXMessageBox 'save TLS' with 'YES'");
169 }
else if (answer == MBOX_CLICKED_NO) {
171 WRITE_DEBUG(
"Closed FXMessageBox 'save TLS' with 'No'");
177 WRITE_DEBUG(
"Closed FXMessageBox 'save TLS' with 'Cancel'");
193 std::set<NBTrafficLightDefinition*> origDefs;
197 if (logic !=
nullptr) {
199 std::vector<NBNode*> nodes = def->getNodes();
200 for (
auto it_node : nodes) {
206 origDefs.insert(copy);
208 WRITE_WARNING(
"tlLogic '" + def->getID() +
"', program '" + def->getProgramID() +
"' could not be built");
214 std::vector<NBLoadedSUMOTLDef*> loadedTLS;
217 if (sdef !=
nullptr) {
218 loadedTLS.push_back(sdef);
222 for (
auto def : loadedTLS) {
223 if (origDefs.count(def) != 0) {
228 std::vector<NBNode*> nodes = def->getNodes();
230 for (
auto it_node : nodes) {
238 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
260 std::vector<NBNode*> nodes = oldDefinition->
getNodes();
261 for (
auto it : nodes) {
293 WRITE_DEBUG(
"Opening warning FXMessageBox 'invalid TLS'");
295 FXMessageBox::warning(
this, MBOX_OK,
296 "TLS cannot be created",
"%s",
297 "Traffic Light cannot be created because junction must have\n at least one incoming edge and one outgoing edge.");
329 if (tllogic !=
nullptr) {
351 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
359 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
368 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
376 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
384 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
430 int tlIndex = it.first;
431 std::vector<GNEInternalLane*> lanes = it.second;
433 if (tlIndex >= 0 && tlIndex < (
int)phase.
state.size()) {
436 for (
auto it_lane : lanes) {
437 it_lane->setLinkState(state);
468 std::set<int> crossingIndices;
471 crossingIndices.insert(c->tlLinkIndex);
472 crossingIndices.insert(c->tlLinkIndex2);
477 bool haveGreen =
false;
478 bool haveYellow =
false;
479 for (
char c : state) {
487 if (haveGreen && haveYellow) {
490 for (
int i = 0; i < (int)state.size(); i++) {
497 }
else if (haveGreen) {
501 for (
int i = 0; i < (int)state.size(); i++) {
503 if (crossingIndices.count(i) == 0) {
510 }
else if (haveYellow) {
513 for (
int i = 0; i < (int)state.size(); i++) {
564 FXTablePos* tp = (FXTablePos*)ptr;
566 const int colDuration = 0;
573 if (tp->col == colDuration) {
575 if (GNEAttributeCarrier::canParse<double>(value.text())) {
586 }
else if (tp->col == colMinDur) {
588 if (GNEAttributeCarrier::canParse<double>(value.text())) {
602 }
else if (tp->col == colMaxDur) {
604 if (GNEAttributeCarrier::canParse<double>(value.text())) {
618 }
else if (tp->col == colState) {
631 }
else if (tp->col == colNext) {
635 std::vector<int> nextEdited = GNEAttributeCarrier::parse<std::vector<int> >(value.text());
636 for (
int n : nextEdited) {
650 }
else if (tp->col == colName) {
689 for (
auto it_intLanes : it.second) {
696 if (tlDef !=
nullptr) {
700 std::string innerID =
":" + nbnCurrentJunction->
getID();
702 for (
auto it : links) {
703 int tlIndex = it.getTLIndex();
709 PositionVector laneShapeFrom = it.getFrom()->getLaneShape(it.getFromLane());
710 PositionVector laneShapeTo = it.getTo()->getLaneShape(it.getToLane());
719 for (
auto c : nbn->getCrossings()) {
720 if (c->tlLinkIndex2 > 0 && c->tlLinkIndex2 != c->tlLinkIndex) {
751 const std::vector<NBTrafficLightLogic::PhaseDefinition>&
761 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases =
getPhases();
762 for (
int row = 0; row < (int)phases.size(); row++) {
778 std::set<std::string> fromIDs;
783 fromIDs.insert(it_lane->getMicrosimID());
789 for (
auto it : edges) {
790 for (
auto it_lane : it->getLanes()) {
791 fromIDs.insert(it_lane->getMicrosimID());
798 for (
auto it_lane : lanes) {
799 fromIDs.insert(it_lane->getMicrosimID());
805 for (
auto it : links) {
806 if (fromIDs.count(it.getFrom()->getLaneID(it.getFromLane())) > 0) {
807 std::vector<GNEInternalLane*> lanes =
myInternalLanes[it.getTLIndex()];
808 for (
auto it_lane : lanes) {
809 it_lane->onDefault(obj, sel, eventData);
821 for (
auto it : links) {
856 return TIME2STEPS(GNEAttributeCarrier::parse<double>(
string.text()));
865 myTLSEditorParent(TLSEditorParent) {
893 myTLSDefinitions.clear();
895 myNameTextField->enable();
897 myOffsetTextField->enable();
900 myTLSDefinitions.push_back(it);
901 myNameTextField->setText(it->getID().c_str());
902 myNameTextField->enable();
903 myProgramComboBox->appendItem(it->getProgramID().c_str());
905 if (myTLSDefinitions.size() > 0) {
906 myProgramComboBox->enable();
907 myProgramComboBox->setCurrentItem(0);
908 myProgramComboBox->setNumVisible(myProgramComboBox->getNumItems());
909 myTLSEditorParent->onCmdDefSwitch(
nullptr, 0,
nullptr);
917 myTLSDefinitions.clear();
919 myNameTextField->setText(
"");
920 myNameTextField->disable();
922 myProgramComboBox->clearItems();
923 myProgramComboBox->disable();
925 myOffsetTextField->setText(
"");
926 myOffsetTextField->disable();
932 return myTLSDefinitions.at(myProgramComboBox->getCurrentItem());
938 return (
int)myTLSDefinitions.size();
944 return myProgramComboBox->getNumItems();
965 myTLSEditorParent(TLSEditorParent),
966 myCurrentJunction(nullptr) {
989 return myCurrentJunction;
995 myCurrentJunction = junction;
1001 if (myCurrentJunction ==
nullptr) {
1002 myTextFieldJunctionID->setText(
"");
1003 myTextFieldJunctionStatus->setText(
"");
1005 NBNode* nbn = myCurrentJunction->getNBNode();
1006 myTextFieldJunctionID->setText(nbn->
getID().c_str());
1008 myTextFieldJunctionStatus->setText(
"uncontrolled");
1010 myTextFieldJunctionStatus->setText(myTLSEditorParent->myTLSModifications->checkHaveModifications() ?
"modified" :
"unmodified");
1022 myNewTLProgram =
new FXButton(
this,
"Create TLS\t\tCreate a new traffic light program",
1025 myDeleteTLProgram =
new FXButton(
this,
"Delete TLS\t\tDelete a traffic light program. If all programs are deleted the junction turns into a priority junction.",
1040 myTLSEditorParent(TLSEditorParent),
1041 myTableFont(new FXFont(getApp(),
"Courier New", 9)) {
1044 myTableScroll =
new FXScrollWindow(
this, LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT);
1047 myPhaseTable->setColumnHeaderHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent() / 2);
1052 myPhaseTable->setHelpText(
"phase duration in seconds | phase state");
1081 return myPhaseTable;
1087 myPhaseTable->setVisibleRows(1);
1088 myPhaseTable->setVisibleColumns(2);
1089 myPhaseTable->hide();
1090 if (myTLSEditorParent->myTLSAttributes->getNumberOfTLSDefinitions() > 0) {
1091 const bool fixed = myTLSEditorParent->fixedDuration();
1092 const int cols = fixed ? 4 : 6;
1093 const int colDuration = 0;
1094 const int colMinDur = fixed ? -1 : 1;
1095 const int colMaxDur = fixed ? -1 : 2;
1096 const int colState = fixed ? 1 : 3;
1097 const int colNext = fixed ? 2 : 4;
1098 const int colName = fixed ? 3 : 5;
1100 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases = myTLSEditorParent->getPhases();
1101 myPhaseTable->setTableSize((
int)phases.size(), cols);
1102 myPhaseTable->setVisibleRows((
int)phases.size());
1103 myPhaseTable->setVisibleColumns(cols);
1104 for (
int row = 0; row < (int)phases.size(); row++) {
1105 myPhaseTable->setItemText(row, colDuration,
toString(
STEPS2TIME(phases[row].duration)).c_str());
1107 myPhaseTable->setItemText(row, colMinDur,
varDurString(phases[row].minDur).c_str());
1108 myPhaseTable->setItemText(row, colMaxDur,
varDurString(phases[row].maxDur).c_str());
1110 myPhaseTable->setItemText(row, colState, phases[row].state.c_str());
1111 myPhaseTable->setItemText(row, colNext, phases[row].next.size() > 0 ?
toString(phases[row].next).c_str() :
" ");
1112 myPhaseTable->setItemText(row, colName, phases[row].name.c_str());
1113 myPhaseTable->getItem(row, 1)->setJustify(FXTableItem::LEFT);
1115 myPhaseTable->fitColumnsToContents(0, cols);
1116 myPhaseTable->setColumnText(colDuration,
"dur");
1117 if (colMinDur >= 0) {
1118 myPhaseTable->setColumnText(colMinDur,
"min");
1119 myPhaseTable->setColumnText(colMaxDur,
"max");
1120 myPhaseTable->setColumnWidth(colMinDur,
MAX2(myPhaseTable->getColumnWidth(colMinDur), 30));
1121 myPhaseTable->setColumnWidth(colMaxDur,
MAX2(myPhaseTable->getColumnWidth(colMaxDur), 35));
1123 myPhaseTable->setColumnText(colState,
"state");
1124 myPhaseTable->setColumnText(colNext,
"nxt");
1125 myPhaseTable->setColumnText(colName,
"name");
1126 myPhaseTable->setColumnWidth(colNext,
MAX2(myPhaseTable->getColumnWidth(colNext), 30));
1127 myPhaseTable->setColumnWidth(colName,
MAX2(myPhaseTable->getColumnWidth(colName), 45));
1129 myPhaseTable->setHeight((
int)phases.size() * 21 + 21);
1130 myPhaseTable->setCurrentItem(index, 0);
1131 myPhaseTable->selectRow(index,
true);
1132 myPhaseTable->show();
1133 myPhaseTable->setFocus();
1134 myTableScroll->setHeight(myPhaseTable->getHeight() + 15);
1141 int neededWidth = 0;
1142 for (
int i = 0; i < cols; i++) {
1143 neededWidth += myPhaseTable->getColumnWidth(i);
1145 myPhaseTable->setDefColumnWidth(neededWidth / cols);
1153 myCycleDuration->show();
1159 myCycleDuration->hide();
1165 for (
auto it : myTLSEditorParent->getPhases()) {
1166 cycleDuration += it.duration;
1169 myCycleDuration->setText(text.c_str());
1178 myTLSEditorParent(TLSEditorParent),
1179 myHaveModifications(false) {
1196 return myHaveModifications;
1202 myHaveModifications = value;
1211 myTLSEditorParent(TLSEditorParent) {
1226 FXFileDialog opendialog(
this,
"Load TLS Program");
1228 opendialog.setSelectMode(SELECTFILE_EXISTING);
1229 opendialog.setPatternList(
"*.xml");
1233 if (opendialog.execute()) {
1237 tmpTLLCont.
insert(myTLSEditorParent->myEditedDef);
1241 std::set<NBLoadedSUMOTLDef*> newDefsOtherProgram;
1242 for (
auto item : tmpTLLCont.
getPrograms(myTLSEditorParent->myEditedDef->getID())) {
1243 if (item.second != myTLSEditorParent->myEditedDef) {
1245 if (item.first == myTLSEditorParent->myEditedDef->getProgramID()) {
1246 newDefSameProgram = sdef;
1248 newDefsOtherProgram.insert(sdef);
1252 const int newPrograms = (int)newDefsOtherProgram.size();
1253 if (newPrograms > 0 || newDefSameProgram !=
nullptr) {
1254 std::vector<NBNode*> nodes = myTLSEditorParent->myEditedDef->
getNodes();
1255 for (
auto newProg : newDefsOtherProgram) {
1256 for (
auto it_node : nodes) {
1258 myTLSEditorParent->getViewNet()->getUndoList()->add(
new GNEChange_TLS(junction, newProg,
true),
true);
1261 if (newPrograms > 0) {
1262 WRITE_MESSAGE(
"Loaded " +
toString(newPrograms) +
" new programs for tlLogic '" + myTLSEditorParent->myEditedDef->getID() +
"'");
1264 if (newDefSameProgram !=
nullptr) {
1266 myTLSEditorParent->myEditedDef = newDefSameProgram;
1267 WRITE_MESSAGE(
"Updated program '" + newDefSameProgram->
getProgramID() +
"' for tlLogic '" + myTLSEditorParent->myEditedDef->getID() +
"'");
1270 myTLSEditorParent->getViewNet()->setStatusBarText(
"No programs found for traffic light '" + myTLSEditorParent->myEditedDef->getID() +
"'");
1275 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
1278 myTLSEditorParent->myTLSPhases->initPhaseTable();
1279 myTLSEditorParent->myTLSModifications->setHaveModifications(
true);
1288 "Save TLS Program as",
".xml",
1304 const bool varPhaseLength = myTLSEditorParent->myEditedDef->getLogic()->getType() !=
TLTYPE_STATIC;
1305 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases = myTLSEditorParent->myEditedDef->getLogic()->getPhases();
1306 for (
auto j : phases) {
1310 if (varPhaseLength) {
1328 if (time == std::floor(time)) {
1337 const bool enable = myTLSEditorParent->myTLSAttributes->getNumberOfTLSDefinitions() > 0;
1338 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
void initTLSAttributes(GNEJunction *junction)
initializes the definitions and corresponding listbox
int getNumberOfOverlappedACs() const
get number of overlapped ACSs
@ MID_GNE_TLSFRAME_ADDOFF
add off to TLS
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
@ MID_GNE_TLSFRAME_DELETE
delete TLS
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.
@ MID_GNE_TLSFRAME_RENAME
rename TLS
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,...
GNEEdge * getParentEdge() const
Returns underlying parent edge.
~TLSAttributes()
destructor
long onCmdDefSwitch(FXObject *, FXSelector, void *)
Called when the user switchs a TLS.
GNEFrameModuls::OverlappedInspection * myOverlappedInspection
Overlapped Inspection.
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)
@ MID_GNE_TLSFRAME_PHASE_CREATE
create phase thable
static OptionsCont & getOptions()
Retrieves the options.
long onUpdModified(FXObject *, FXSelector, void *)
Called when occurs an update of modified.
@ LINKSTATE_TL_GREEN_MINOR
The link has green light, has to brake.
void setOffset(SUMOTime offset)
Sets the offset of this tls.
@ MID_GNE_TLSFRAME_SWITCH
switch between programs
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.
@ MID_GNE_TLSFRAME_UPDATE_STATUS
update TLS status
@ LINKSTATE_TL_GREEN_MAJOR
The link has green light, may pass.
@ MID_CANCEL
Cancel-button pressed.
#define GUIDesignTextField
FXTextField * myTextFieldJunctionID
text field for junction ID
@ SUMO_TAG_PHASE
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
SUMORTree & getVisualisationSpeedUp()
Returns the RTree used for visualisation speed-up.
void selectedOverlappedElement(GNEAttributeCarrier *AC)
open AttributesCreator extended dialog (can be reimplemented in frame children)
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)
TLSFile(GNETLSEditorFrame *TLSEditorParent)
FOX-declaration.
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,...
void editTLS(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
edits the traffic light for the given clicked junction
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
@ LINKSTATE_TL_YELLOW_MINOR
The link has yellow light, has to brake anyway.
static std::string prune(const std::string &str)
Removes trailing and leading whitechars.
@ MID_GNE_TLSFRAME_CLEANUP
cleanup unused states
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)
class used to group all variables related with objects under cursor after a click over view
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.
@ MID_OK
Ok-button pressed.
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.
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
A point in 2D or 3D with translation and scaling methods.
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
void showOverlappedInspection(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor, const Position &clickedPosition)
show template editor
@ LINKSTATE_DEADEND
This is a dead end link.
void show()
show inspector frame
#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
@ MID_GNE_TLSFRAME_OFFSET
definition related controls
@ MID_GNE_TLSFRAME_GUESSPROGRAM
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
GNEJunction * getJunctionFront() const
get front junction (or a pointer to nullptr if there isn't)
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
@ SUMO_TAG_TLLOGIC
a traffic light logic
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)
@ SUMO_ATTR_STATE
The state of a link.
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
@ LINKSTATE_TL_YELLOW_MAJOR
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
@ MID_GNE_TLSFRAME_ADDUNUSED
mark unused states
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.
const std::string & getProgramID() const
Returns the ProgramID.
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
void hideOverlappedInspection()
hide template editor
@ MID_GNE_TLSFRAME_LOAD_PROGRAM
Load Program.
@ MID_GNE_TLSFRAME_PHASE_TABLE
select phase thable
long onCmdPhaseSwitch(FXObject *, FXSelector, void *)
Called when the user switchs a Phase.
bool controlsEdge(GNEEdge *edge) const
whether the given edge is controlled by the currently edited tlDef
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.
@ SUMO_ATTR_MAXDURATION
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.
@ MID_GNE_TLSFRAME_SUBRENAME
sub-rename TLS
@ LINKSTATE_TL_RED
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.
@ MID_GNE_TLSFRAME_SAVE_PROGRAM
cleanup unused states
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...
@ MID_GNE_TLSFRAME_SELECT_JUNCTION
selected junction von TLS
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
@ MID_GNE_TLSFRAME_PHASE_DELETE
delete phase thable
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.
@ MID_GNE_TLSFRAME_CREATE
Create TLS.
#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
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
void setPhaseMaxDuration(int phaseIndex, SUMOTime duration)
FXTextField * myNameTextField
name text field
A loaded (complete) traffic light logic.