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) {
303 WRITE_DEBUG(
"Opening warning FXMessageBox 'invalid TLS'");
305 FXMessageBox::warning(
this, MBOX_OK,
306 "TLS cannot be created",
"%s",
307 "Traffic Light cannot be created because junction must have\n at least one incoming edge and one outgoing edge.");
339 if (tllogic !=
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);
378 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
387 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
389 static_cast<FXButton*
>(o)->setText(copy ?
"Copy" :
"Create");
397 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
443 int tlIndex = it.first;
444 std::vector<GNEInternalLane*> lanes = it.second;
446 if (tlIndex >= 0 && tlIndex < (
int)phase.
state.size()) {
449 for (
auto it_lane : lanes) {
450 it_lane->setLinkState(state);
480 std::string state = oldState;
482 std::set<int> crossingIndices;
485 crossingIndices.insert(c->tlLinkIndex);
486 crossingIndices.insert(c->tlLinkIndex2);
491 bool haveGreen =
false;
492 bool haveYellow =
false;
493 for (
char c : state) {
501 if (haveGreen && haveYellow) {
504 for (
int i = 0; i < (int)state.size(); i++) {
511 }
else if (haveGreen) {
515 for (
int i = 0; i < (int)state.size(); i++) {
517 if (crossingIndices.count(i) == 0) {
524 }
else if (haveYellow) {
527 for (
int i = 0; i < (int)state.size(); i++) {
536 for (
int i = 0; i < (int)state.size(); i++) {
539 state[i] = oldState[i];
610 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
617 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
626 FXTablePos* tp = (FXTablePos*)ptr;
628 const int colDuration = 0;
635 if (tp->col == colDuration) {
637 if (GNEAttributeCarrier::canParse<double>(value.text())) {
648 }
else if (tp->col == colMinDur) {
650 if (GNEAttributeCarrier::canParse<double>(value.text())) {
664 }
else if (tp->col == colMaxDur) {
666 if (GNEAttributeCarrier::canParse<double>(value.text())) {
680 }
else if (tp->col == colState) {
693 }
else if (tp->col == colNext) {
697 std::vector<int> nextEdited = GNEAttributeCarrier::parse<std::vector<int> >(value.text());
698 for (
int n : nextEdited) {
712 }
else if (tp->col == colName) {
752 for (
const auto& internalLane : internalLanes.second) {
762 if (tlDef !=
nullptr) {
766 const std::string innerID =
":" + nbnCurrentJunction->
getID();
769 for (
const auto& link : links) {
770 int tlIndex = link.getTLIndex();
776 const PositionVector laneShapeFrom = link.getFrom()->getLaneShape(link.getFromLane());
777 const PositionVector laneShapeTo = link.getTo()->getLaneShape(link.getToLane());
787 for (
const auto& nbn : tlDef->
getNodes()) {
788 for (
const auto& crossing : nbn->getCrossings()) {
789 if (crossing->tlLinkIndex2 > 0 && crossing->tlLinkIndex2 != crossing->tlLinkIndex) {
802 myInternalLanes[crossing->tlLinkIndex2].push_back(internalLaneReverse);
822 const std::vector<NBTrafficLightLogic::PhaseDefinition>&
832 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases =
getPhases();
833 for (
int row = 0; row < (int)phases.size(); row++) {
849 std::set<std::string> fromIDs;
854 fromIDs.insert(it_lane->getMicrosimID());
860 for (
auto it : edges) {
861 for (
auto it_lane : it->getLanes()) {
862 fromIDs.insert(it_lane->getMicrosimID());
869 for (
auto it_lane : lanes) {
870 fromIDs.insert(it_lane->getMicrosimID());
876 for (
auto it : links) {
877 if (fromIDs.count(it.getFrom()->getLaneID(it.getFromLane())) > 0) {
878 std::vector<GNEInternalLane*> lanes =
myInternalLanes[it.getTLIndex()];
879 for (
auto it_lane : lanes) {
880 it_lane->onDefault(obj, sel, eventData);
892 for (
auto it : links) {
927 return TIME2STEPS(GNEAttributeCarrier::parse<double>(
string.text()));
936 myTLSEditorParent(TLSEditorParent) {
964 myTLSDefinitions.clear();
966 myNameTextField->enable();
968 myOffsetTextField->enable();
971 myTLSDefinitions.push_back(it);
972 myNameTextField->setText(it->getID().c_str());
973 myNameTextField->enable();
974 myProgramComboBox->appendItem(it->getProgramID().c_str());
976 if (myTLSDefinitions.size() > 0) {
977 myProgramComboBox->enable();
978 myProgramComboBox->setCurrentItem(0);
979 myProgramComboBox->setNumVisible(myProgramComboBox->getNumItems());
980 myTLSEditorParent->onCmdDefSwitch(
nullptr, 0,
nullptr);
988 myTLSDefinitions.clear();
990 myNameTextField->setText(
"");
991 myNameTextField->disable();
993 myProgramComboBox->clearItems();
994 myProgramComboBox->disable();
996 myOffsetTextField->setText(
"");
997 myOffsetTextField->disable();
1003 return myTLSDefinitions.at(myProgramComboBox->getCurrentItem());
1009 return (
int)myTLSDefinitions.size();
1015 return myProgramComboBox->getNumItems();
1036 myCurrentJunction(nullptr) {
1054 return myCurrentJunction;
1060 myCurrentJunction = junction;
1066 if (myCurrentJunction ==
nullptr) {
1067 myTextFieldJunctionID->setText(
"");
1069 NBNode* nbn = myCurrentJunction->getNBNode();
1070 myTextFieldJunctionID->setText(nbn->
getID().c_str());
1082 myNewTLProgram =
new FXButton(buttonsFrame,
"Create\t\tCreate a new traffic light program",
1085 myDeleteTLProgram =
new FXButton(buttonsFrame,
"Delete\t\tDelete a traffic light program. If all programs are deleted the junction turns into a priority junction.",
1100 myTLSEditorParent(TLSEditorParent),
1101 myTableFont(new FXFont(getApp(),
"Courier New", 9)) {
1104 myTableScroll =
new FXScrollWindow(
this, LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT);
1107 myPhaseTable->setColumnHeaderHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent() / 2);
1112 myPhaseTable->setHelpText(
"phase duration in seconds | phase state");
1122 FXVerticalFrame* col1 =
new FXVerticalFrame(phaseButtons, LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1123 FXVerticalFrame* col2 =
new FXVerticalFrame(phaseButtons, LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1153 return myPhaseTable;
1159 myPhaseTable->setVisibleRows(1);
1160 myPhaseTable->setVisibleColumns(2);
1161 myPhaseTable->hide();
1162 if (myTLSEditorParent->myTLSAttributes->getNumberOfTLSDefinitions() > 0) {
1163 const bool fixed = myTLSEditorParent->fixedDuration();
1164 const int cols = fixed ? 4 : 6;
1165 const int colDuration = 0;
1166 const int colMinDur = fixed ? -1 : 1;
1167 const int colMaxDur = fixed ? -1 : 2;
1168 const int colState = fixed ? 1 : 3;
1169 const int colNext = fixed ? 2 : 4;
1170 const int colName = fixed ? 3 : 5;
1172 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases = myTLSEditorParent->getPhases();
1173 myPhaseTable->setTableSize((
int)phases.size(), cols);
1174 myPhaseTable->setVisibleRows((
int)phases.size());
1175 myPhaseTable->setVisibleColumns(cols);
1176 for (
int row = 0; row < (int)phases.size(); row++) {
1177 myPhaseTable->setItemText(row, colDuration,
toString(
STEPS2TIME(phases[row].duration)).c_str());
1179 myPhaseTable->setItemText(row, colMinDur,
varDurString(phases[row].minDur).c_str());
1180 myPhaseTable->setItemText(row, colMaxDur,
varDurString(phases[row].maxDur).c_str());
1182 myPhaseTable->setItemText(row, colState, phases[row].state.c_str());
1183 myPhaseTable->setItemText(row, colNext, phases[row].next.size() > 0 ?
toString(phases[row].next).c_str() :
" ");
1184 myPhaseTable->setItemText(row, colName, phases[row].name.c_str());
1185 myPhaseTable->getItem(row, 1)->setJustify(FXTableItem::LEFT);
1187 myPhaseTable->fitColumnsToContents(0, cols);
1188 myPhaseTable->setColumnText(colDuration,
"dur");
1189 if (colMinDur >= 0) {
1190 myPhaseTable->setColumnText(colMinDur,
"min");
1191 myPhaseTable->setColumnText(colMaxDur,
"max");
1192 myPhaseTable->setColumnWidth(colMinDur,
MAX2(myPhaseTable->getColumnWidth(colMinDur), 30));
1193 myPhaseTable->setColumnWidth(colMaxDur,
MAX2(myPhaseTable->getColumnWidth(colMaxDur), 35));
1195 myPhaseTable->setColumnText(colState,
"state");
1196 myPhaseTable->setColumnText(colNext,
"nxt");
1197 myPhaseTable->setColumnText(colName,
"name");
1198 myPhaseTable->setColumnWidth(colNext,
MAX2(myPhaseTable->getColumnWidth(colNext), 30));
1199 myPhaseTable->setColumnWidth(colName,
MAX2(myPhaseTable->getColumnWidth(colName), 45));
1201 myPhaseTable->setHeight((
int)phases.size() * 21 + 21);
1202 myPhaseTable->setCurrentItem(index, 0);
1203 myPhaseTable->selectRow(index,
true);
1204 myPhaseTable->show();
1205 myPhaseTable->setFocus();
1206 myTableScroll->setHeight(myPhaseTable->getHeight() + 15);
1213 int neededWidth = 0;
1214 for (
int i = 0; i < cols; i++) {
1215 neededWidth += myPhaseTable->getColumnWidth(i);
1217 myPhaseTable->setDefColumnWidth(neededWidth / cols);
1225 myCycleDuration->show();
1231 myCycleDuration->hide();
1237 for (
auto it : myTLSEditorParent->getPhases()) {
1238 cycleDuration += it.duration;
1241 myCycleDuration->setText(text.c_str());
1250 myTLSEditorParent(TLSEditorParent),
1251 myHaveModifications(false) {
1269 return myHaveModifications;
1275 myHaveModifications = value;
1284 myTLSEditorParent(TLSEditorParent) {
1300 FXFileDialog opendialog(
this,
"Load TLS Program");
1302 opendialog.setSelectMode(SELECTFILE_EXISTING);
1303 opendialog.setPatternList(
"*.xml");
1307 if (opendialog.execute()) {
1311 tmpTLLCont.
insert(myTLSEditorParent->myEditedDef);
1315 std::set<NBLoadedSUMOTLDef*> newDefsOtherProgram;
1316 for (
auto item : tmpTLLCont.
getPrograms(myTLSEditorParent->myEditedDef->getID())) {
1317 if (item.second != myTLSEditorParent->myEditedDef) {
1319 if (item.first == myTLSEditorParent->myEditedDef->getProgramID()) {
1320 newDefSameProgram = sdef;
1322 newDefsOtherProgram.insert(sdef);
1326 const int newPrograms = (int)newDefsOtherProgram.size();
1327 if (newPrograms > 0 || newDefSameProgram !=
nullptr) {
1328 std::vector<NBNode*> nodes = myTLSEditorParent->myEditedDef->
getNodes();
1329 for (
auto newProg : newDefsOtherProgram) {
1330 for (
auto it_node : nodes) {
1332 myTLSEditorParent->getViewNet()->getUndoList()->add(
new GNEChange_TLS(junction, newProg,
true),
true);
1335 if (newPrograms > 0) {
1336 WRITE_MESSAGE(
"Loaded " +
toString(newPrograms) +
" new programs for tlLogic '" + myTLSEditorParent->myEditedDef->getID() +
"'");
1338 if (newDefSameProgram !=
nullptr) {
1340 myTLSEditorParent->myEditedDef = newDefSameProgram;
1341 WRITE_MESSAGE(
"Updated program '" + newDefSameProgram->
getProgramID() +
"' for tlLogic '" + myTLSEditorParent->myEditedDef->getID() +
"'");
1344 myTLSEditorParent->getViewNet()->setStatusBarText(
"No programs found for traffic light '" + myTLSEditorParent->myEditedDef->getID() +
"'");
1349 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
1352 myTLSEditorParent->myTLSPhases->initPhaseTable();
1353 myTLSEditorParent->myTLSModifications->setHaveModifications(
true);
1362 "Save TLS Program as",
".xml",
1379 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases = myTLSEditorParent->myEditedDef->getLogic()->getPhases();
1380 for (
auto j : phases) {
1384 if (varPhaseLength) {
1402 if (time == std::floor(time)) {
1411 const bool enable = myTLSEditorParent->myTLSAttributes->getNumberOfTLSDefinitions() > 0;
1412 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
FXDEFMAP(GNETLSEditorFrame) GNETLSEditorFrameMap[]
@ MID_GNE_TLSFRAME_SUBRENAME
sub-rename TLS
@ MID_GNE_TLSFRAME_PHASE_CREATE
create phase thable
@ MID_CANCEL
Cancel-button pressed.
@ MID_GNE_TLSFRAME_ADDOFF
add off to TLS
@ MID_GNE_TLSFRAME_SAVE_PROGRAM
cleanup unused states
@ MID_GNE_TLSFRAME_GUESSPROGRAM
replace program with a newly guessed program
@ MID_GNE_TLSFRAME_GROUP_STATES
group states
@ MID_GNE_TLSFRAME_PHASE_DELETE
delete phase thable
@ MID_GNE_TLSFRAME_CREATE
Create TLS.
@ MID_GNE_TLSFRAME_ADDUNUSED
add unused states
@ MID_OK
Ok-button pressed.
@ MID_GNE_TLSFRAME_SWITCH
switch between programs
@ MID_GNE_TLSFRAME_SELECT_JUNCTION
selected junction von TLS
@ MID_GNE_TLSFRAME_OFFSET
definition related controls
@ MID_GNE_TLSFRAME_CLEANUP
cleanup unused states
@ MID_GNE_TLSFRAME_LOAD_PROGRAM
Load Program.
@ MID_GNE_TLSFRAME_UNGROUP_STATES
ungroup states
@ MID_GNE_TLSFRAME_RENAME
rename TLS
@ MID_GNE_TLSFRAME_PHASE_TABLE
select phase thable
@ MID_GNE_TLSFRAME_DELETE
delete TLS
#define GUIDesignLabelLeft
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
#define GUIDesignComboBoxNCol
number of column of every combo box
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
#define GUIDesignTableLimitedHeight
design for table extended over frame but with limited Height
FXString gCurrentFolder
The folder used as last.
#define WRITE_MESSAGE(msg)
#define WRITE_WARNING(msg)
std::vector< NBConnection > NBConnectionVector
Definition of a connection vector.
@ SUMO_TAG_PHASE
a single phase description
@ SUMO_TAG_TLLOGIC
a traffic light logic
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
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_MAXDURATION
maximum duration of a phase
@ SUMO_ATTR_STATE
The state of a link.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * getNet() const
get pointer to net
A road/street connecting two junctions (netedit-version)
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
GNEViewNet * myViewNet
View Net.
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
virtual void show()
show Frame
void showOverlappedInspection(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor, const Position &clickedPosition)
show template editor
int getNumberOfOverlappedACs() const
get number of overlapped ACSs
void hideOverlappedInspection()
hide template editor
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
LinkState getLinkState() const
whether link state has been modfied
int getTLIndex() const
get Traffic Light index
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
std::string getAttribute(SumoXMLAttr key) const
void selectTLS(bool selected)
notify the junction of being selected in tls-mode. (used to control drawing)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
NBNode * getNBNode() const
Return net build node.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
GNEEdge * getParentEdge() const
get arent edge
SUMORTree & getGrid()
Returns the RTree used for visualisation speed-up.
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
void computeJunction(GNEJunction *junction)
trigger recomputation of junction shape and logic param[in] window The window to inform about delay
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true) const
get junction by id
void initTLSAttributes(GNEJunction *junction)
initializes the definitions and corresponding listbox
FXLabel * myProgramLabel
program label
FXTextField * myOffsetTextField
the control for modifying offset
int getNumberOfPrograms() const
get number of programs
SUMOTime getOffset() const
get current offset in SUMOTIme
void setOffset(SUMOTime offset)
set new offset
void clearTLSAttributes()
clear TLS attributes
FXComboBox * myProgramComboBox
the comboBox for selecting the tl-definition to edit
FXLabel * myNameLabel
name label
int getNumberOfTLSDefinitions() const
get number of definitions
TLSAttributes(GNETLSEditorFrame *TLSEditorParent)
constructor
NBTrafficLightDefinition * getCurrentTLSDefinition() const
get current definition
~TLSAttributes()
destructor
FXTextField * myNameTextField
name text field
FXLabel * myOffsetLabel
offset label
GNETLSEditorFrame * myTLSEditorParent
pointer to TLSEditorParent
FXButton * myNewTLProgram
button for create new Traffic light program
FXButton * myDeleteTLProgram
button for delete traffic light program
~TLSDefinition()
destructor
TLSDefinition(GNETLSEditorFrame *TLSEditorParent)
constructor
FXButton * mySaveTLSProgramButton
button for save TLS Programs
FXButton * myLoadTLSProgramButton
button for load TLS Programs
long onCmdLoadTLSProgram(FXObject *, FXSelector, void *)
TLSFile(GNETLSEditorFrame *TLSEditorParent)
FOX-declaration.
std::string writeSUMOTime(SUMOTime steps)
convert SUMOTime into string
long onCmdSaveTLSProgram(FXObject *, FXSelector, void *)
save TLS Programm to an additional file
long onUpdNeedsDef(FXObject *, FXSelector, void *)
enable buttons, only when a tlLogic is being edited
FXLabel * myLabelJunctionID
label for junction ID
FXTextField * myTextFieldJunctionID
text field for junction ID
GNEJunction * getCurrentJunction() const
get current modified junction
void setCurrentJunction(GNEJunction *junction)
set current junction
void updateJunctionDescription() const
update descrition
TLSJunction(GNETLSEditorFrame *tlsEditorParent)
constructor
TLSModifications(GNETLSEditorFrame *TLSEditorParent)
constructor
~TLSModifications()
destructor
void setHaveModifications(bool value)
set if current TLS was modified
FXButton * myDiscardModificationsButtons
button for cancel modifications
bool checkHaveModifications() const
check if current TLS was modified
GNETLSEditorFrame * myTLSEditorParent
pointer to TLSEditor Parent
FXButton * mySaveModificationsButtons
button for save modifications
FXScrollWindow * myTableScroll
window for oversized phase tables
FXLabel * myCycleDuration
label with the cycle duration
void showCycleDuration()
show cycle duration
FXButton * myDeleteSelectedPhaseButton
delete phase button
FXFont * myTableFont
font for the phase table
FXButton * myInsertDuplicateButton
insert new phase button
TLSPhases(GNETLSEditorFrame *TLSEditorParent)
constructor
FXTable * myPhaseTable
table for selecting and rearranging phases and for changing duration
FXTable * getPhaseTable() const
get phase table
GNETLSEditorFrame * myTLSEditorParent
pointer to TLSEditor Parent
void updateCycleDuration()
recomputes cycle duration and updates label
void initPhaseTable(int index=0)
initialies the phase table
void hideCycleDuration()
hide cycle duration
const std::vector< NBTrafficLightLogic::PhaseDefinition > & getPhases()
the phase of the current traffic light
long onCmdOK(FXObject *, FXSelector, void *)
void handleChange(GNEInternalLane *lane)
update phase definition for the current traffic light and phase
long onCmdGuess(FXObject *, FXSelector, void *)
Called when the user presses the button Guess.
void buildInternalLanes(NBTrafficLightDefinition *tlDef)
builds internal lanes for the given tlDef
GNETLSEditorFrame::TLSAttributes * myTLSAttributes
modul for TLS attributes
static std::string varDurString(SUMOTime dur)
convert duration (potentially undefined) to string
long onCmdDefCreate(FXObject *, FXSelector, void *)
Called when the user creates a TLS.
long onCmdDefAddOff(FXObject *, FXSelector, void *)
Called when the user adds a OFF.
long onCmdDefDelete(FXObject *, FXSelector, void *)
Called when the user deletes a TLS.
bool isTLSSaved()
check if modifications in TLS was saved
void editJunction(GNEJunction *junction)
edits the traffic light for the given junction
GNEFrameModuls::OverlappedInspection * myOverlappedInspection
Overlapped Inspection.
GNETLSEditorFrame::TLSModifications * myTLSModifications
modul for load/Save TLS Modifications
long onCmdPhaseEdit(FXObject *, FXSelector, void *)
Called when the user edits a Phase.
long onUpdDefCreate(FXObject *, FXSelector, void *)
Called when occurs an update of create definition.
GNETLSEditorFrame::TLSPhases * myTLSPhases
modul for TLS Phases
void selectedOverlappedElement(GNEAttributeCarrier *AC)
open AttributesCreator extended dialog (can be reimplemented in frame children)
long onCmdDefOffset(FXObject *, FXSelector, void *)
Called when the user changes the offset of a TLS.
TLIndexMap myInternalLanes
long onUpdNeedsSingleDef(FXObject *, FXSelector, void *)
Called to buttons that modify link indices.
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
long onCmdDefSubRename(FXObject *, FXSelector, void *)
Called when the user sub-renames a TLS.
long onUpdUngroupStates(FXObject *, FXSelector, void *)
Called to update the ungroups states button.
long onCmdPhaseDelete(FXObject *, FXSelector, void *)
Called when the user deletes a Phase.
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button.
long onUpdModified(FXObject *, FXSelector, void *)
Called when occurs an update of modified.
static SUMOTime getSUMOTime(const FXString &string)
converts to SUMOTime
void handleMultiChange(GNELane *lane, FXObject *obj, FXSelector sel, void *data)
update phase definition for the current traffic light and phase
long onCmdDefRename(FXObject *, FXSelector, void *)
Called when the user renames a TLS.
long onUpdNeedsDef(FXObject *, FXSelector, void *)
Called when occurs an update of needs definition.
long onUpdNeedsDefAndPhase(FXObject *, FXSelector, void *)
Called when occurs an update of needs definition an dphase.
long onCmdUngroupStates(FXObject *, FXSelector, void *)
Called when the user ungroups states.
~GNETLSEditorFrame()
Destructor.
long onCmdGroupStates(FXObject *, FXSelector, void *)
Called when the user groups states.
NBLoadedSUMOTLDef * myEditedDef
the traffic light definition being edited
long onUpdDefSwitch(FXObject *, FXSelector, void *)
Called when occurs an update of switch definition.
long onCmdPhaseCreate(FXObject *, FXSelector, void *)
Called when the user creates a Phase.
GNETLSEditorFrame::TLSJunction * myTLSJunction
modul for TLS Junction
bool fixedDuration() const
whether the current traffic light uses fixed phase durations
void editTLS(const Position &clickedPosition, const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
edits the traffic light for the given clicked junction
long onCmdPhaseSwitch(FXObject *, FXSelector, void *)
Called when the user switchs a Phase.
void cleanup()
cleans up previous lanes
long onCmdAddUnused(FXObject *, FXSelector, void *)
Called when the user cleans up states.
long onCmdDefSwitch(FXObject *, FXSelector, void *)
Called when the user switchs a TLS.
void show()
show inspector frame
long onCmdCleanup(FXObject *, FXSelector, void *)
Called when the user cleans up states.
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...
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void p_abort()
reverts and discards ALL active command groups
class used to group all variables related with objects under cursor after a click over view
GNEJunction * getJunctionFront() const
get front junction or a pointer to nullptr
GNENet * getNet() const
get the net object
bool changeAllPhases() const
change all phases
GNEUndoList * getUndoList() const
get the undoList object
void updateViewNet() const
Mark the entire GNEViewNet to be repainted later.
void setStatusBarText(const std::string &text)
set staturBar text
virtual 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
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
A loaded (complete) traffic light logic.
bool usingSignalGroups() const
whether this definition uses signal group (multiple connections with the same link index)
void ungroupSignals()
let all connections use a distinct link index
void groupSignals()
let connections with the same state use the same link index
NBTrafficLightLogic * getLogic()
Returns the internal logic.
void setOffset(SUMOTime offset)
Sets the offset of this tls.
A definition of a pedestrian crossing.
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.
The base class for traffic light logic definitions.
const NBConnectionVector & getControlledLinks() const
returns the controlled links (depends on previous call to collectLinks)
const std::string & getProgramID() const
Returns the ProgramID.
TrafficLightType getType() const
get the algorithm type (static etc..)
const std::vector< NBNode * > & getNodes() const
Returns the list of controlled nodes.
int computeBrakingTime(double minDecel) const
Computes the time vehicles may need to brake.
NBTrafficLightLogic * compute(OptionsCont &oc)
Computes the traffic light logic.
virtual void setParticipantsInformation()
Builds the list of participating nodes/edges/links.
static const SUMOTime UNSPECIFIED_DURATION
The definition of a single phase of the logic.
std::string state
The state definition.
std::string name
option phase name
SUMOTime duration
The duration of the phase in s.
std::vector< int > next
next phase indices or empty list
A container for traffic light definitions and built programs.
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.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
A SUMO-compliant built logic for a traffic light.
void setPhaseMinDuration(int phaseIndex, SUMOTime duration)
SUMOTime getOffset() const
Returns the offset of first switch.
const std::vector< PhaseDefinition > & getPhases() const
Returns the phases.
void setPhaseName(int phaseIndex, const std::string &name)
void setPhaseDuration(int phaseIndex, SUMOTime duration)
Modifies the duration for an existing phase (used by NETEDIT)
void setPhaseState(int phaseIndex, int tlIndex, LinkState linkState)
Modifies the state for an existing phase (used by NETEDIT)
void setPhaseMaxDuration(int phaseIndex, SUMOTime duration)
int getNumLinks()
Returns the number of participating links.
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 setPhaseNext(int phaseIndex, const std::vector< int > &next)
void setStateLength(int numLinks, LinkState fill=LINKSTATE_TL_RED)
void deletePhase(int index)
Importer for edge connections stored in XML.
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
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.
void close()
Closes the device and removes it from the dictionary.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
A point in 2D or 3D with translation and scaling methods.
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 ammount
PositionVector reverse() const
reverse position vector
void removeAdditionalGLObject(GUIGlObject *o)
Removes an additional object (detector/shape/trigger) from being visualised.
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
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)
Runs the given handler on the given file; returns if everything's ok.
A structure which describes a connection between edges or lanes.