87 FXIMPLEMENT(
GNETLSEditorFrame, FXVerticalFrame, GNETLSEditorFrameMap, ARRAYNUMBER(GNETLSEditorFrameMap))
96 GNEFrame(horizontalFrameParent, viewNet, "Edit Traffic Light"),
97 myEditedDef(
nullptr) {
162 WRITE_DEBUG(
"Opening question FXMessageBox 'save TLS'");
164 FXuint answer = FXMessageBox::question(
this, MBOX_YES_NO_CANCEL,
165 "Save TLS Changes",
"%s",
166 "There is unsaved changes in current edited traffic light.\nDo you want to save it before changing mode?");
167 if (answer == MBOX_CLICKED_YES) {
169 WRITE_DEBUG(
"Closed FXMessageBox 'save TLS' with 'YES'");
173 }
else if (answer == MBOX_CLICKED_NO) {
175 WRITE_DEBUG(
"Closed FXMessageBox 'save TLS' with 'No'");
181 WRITE_DEBUG(
"Closed FXMessageBox 'save TLS' with 'Cancel'");
197 std::set<NBTrafficLightDefinition*> origDefs;
201 if (logic !=
nullptr) {
203 std::vector<NBNode*> nodes = def->getNodes();
204 for (
auto it_node : nodes) {
210 origDefs.insert(copy);
212 WRITE_WARNING(
"tlLogic '" + def->getID() +
"', program '" + def->getProgramID() +
"' could not be built");
218 std::vector<NBLoadedSUMOTLDef*> loadedTLS;
221 if (sdef !=
nullptr) {
222 loadedTLS.push_back(sdef);
226 for (
auto def : loadedTLS) {
227 if (origDefs.count(def) != 0) {
232 std::vector<NBNode*> nodes = def->getNodes();
234 for (
auto it_node : nodes) {
242 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
264 std::vector<NBNode*> nodes = oldDefinition->
getNodes();
265 for (
auto it : nodes) {
298 if (
TLS->getProgramID() == currentTLS) {
302 if (tpl ==
nullptr) {
317 WRITE_DEBUG(
"Opening warning FXMessageBox 'invalid TLS'");
319 FXMessageBox::warning(
this, MBOX_OK,
320 "TLS cannot be created",
"%s",
321 "Traffic Light cannot be created because junction must have\n at least one incoming edge and one outgoing edge.");
353 if (tllogic !=
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);
393 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
402 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
404 static_cast<FXButton*
>(o)->setText(copy ?
"Copy" :
"Create");
412 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
470 int tlIndex = it.first;
471 std::vector<GNEInternalLane*> lanes = it.second;
473 if (tlIndex >= 0 && tlIndex < (
int)phase.
state.size()) {
476 for (
auto it_lane : lanes) {
477 it_lane->setLinkState(state);
507 std::string state = oldState;
509 std::set<int> crossingIndices;
512 crossingIndices.insert(c->tlLinkIndex);
513 crossingIndices.insert(c->tlLinkIndex2);
518 bool haveGreen =
false;
519 bool haveYellow =
false;
520 for (
char c : state) {
528 if (haveGreen && haveYellow) {
531 for (
int i = 0; i < (int)state.size(); i++) {
538 }
else if (haveGreen) {
542 for (
int i = 0; i < (int)state.size(); i++) {
544 if (crossingIndices.count(i) == 0) {
551 }
else if (haveYellow) {
554 for (
int i = 0; i < (int)state.size(); i++) {
563 for (
int i = 0; i < (int)state.size(); i++) {
566 state[i] = oldState[i];
639 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
647 o->handle(
this, FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
657 FXTablePos* tp = (FXTablePos*)ptr;
659 const int colDuration = 0;
665 if (tp->col == colDuration) {
667 if (GNEAttributeCarrier::canParse<double>(value.text())) {
678 }
else if (tp->col == colMinDur) {
680 if (GNEAttributeCarrier::canParse<double>(value.text())) {
694 }
else if (tp->col == colMaxDur) {
696 if (GNEAttributeCarrier::canParse<double>(value.text())) {
710 }
else if (tp->col == colState) {
723 }
else if (tp->col == colNext) {
727 std::vector<int> nextEdited = GNEAttributeCarrier::parse<std::vector<int> >(value.text());
728 for (
int n : nextEdited) {
742 }
else if (tp->col == colName) {
802 for (
const auto& internalLane : internalLanes.second) {
812 if (tlDef !=
nullptr) {
816 const std::string innerID =
":" + nbnCurrentJunction->
getID();
819 for (
const auto& link : links) {
820 int tlIndex = link.getTLIndex();
823 const NBEdge::Connection& con = link.getFrom()->getConnectionRef(link.getFromLane(), link.getTo(), link.getToLane());
827 shape = link.getFrom()->getToNode()->computeInternalLaneShape(link.getFrom(),
NBEdge::Connection(link.getFromLane(),
833 const PositionVector laneShapeFrom = link.getFrom()->getLaneShape(link.getFromLane());
834 const PositionVector laneShapeTo = link.getTo()->getLaneShape(link.getToLane());
844 for (
const auto& nbn : tlDef->
getNodes()) {
845 for (
const auto& crossing : nbn->getCrossings()) {
846 if (crossing->tlLinkIndex2 > 0 && crossing->tlLinkIndex2 != crossing->tlLinkIndex) {
859 myInternalLanes[crossing->tlLinkIndex2].push_back(internalLaneReverse);
879 const std::vector<NBTrafficLightLogic::PhaseDefinition>&
889 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases =
getPhases();
890 for (
int row = 0; row < (int)phases.size(); row++) {
906 std::set<std::string> fromIDs;
911 fromIDs.insert(it_lane->getMicrosimID());
917 for (
const auto& edge : selectedEdge) {
918 for (
auto it_lane : edge->getLanes()) {
919 fromIDs.insert(it_lane->getMicrosimID());
926 for (
auto it_lane : selectedLanes) {
927 fromIDs.insert(it_lane->getMicrosimID());
933 for (
auto it : links) {
934 if (fromIDs.count(it.getFrom()->getLaneID(it.getFromLane())) > 0) {
935 std::vector<GNEInternalLane*> lanes =
myInternalLanes[it.getTLIndex()];
936 for (
auto it_lane : lanes) {
937 it_lane->onDefault(obj, sel, eventData);
949 for (
auto it : links) {
984 return TIME2STEPS(GNEAttributeCarrier::parse<double>(
string.text()));
992 FXGroupBoxModule(TLSEditorParent->myContentFrame,
"Traffic light Attributes"),
993 myTLSEditorParent(TLSEditorParent) {
1028 myTLSDefinitions.clear();
1030 myNameTextField->enable();
1032 myOffsetTextField->enable();
1035 myButtonEditParameters->enable();
1036 myParametersTextField->enable();
1040 myTLSDefinitions.push_back(it);
1041 myNameTextField->setText(it->getID().c_str());
1042 myNameTextField->enable();
1043 myProgramComboBox->appendItem(it->getProgramID().c_str());
1045 if (myTLSDefinitions.size() > 0) {
1046 myProgramComboBox->enable();
1047 myProgramComboBox->setCurrentItem(0);
1048 myProgramComboBox->setNumVisible(myProgramComboBox->getNumItems());
1049 myTLSEditorParent->onCmdDefSwitch(
nullptr, 0,
nullptr);
1057 myTLSDefinitions.clear();
1059 myNameTextField->setText(
"");
1060 myNameTextField->disable();
1062 myProgramComboBox->clearItems();
1063 myProgramComboBox->disable();
1065 myOffsetTextField->setText(
"");
1066 myOffsetTextField->disable();
1069 myButtonEditParameters->disable();
1070 myParametersTextField->setText(
"");
1071 myParametersTextField->disable();
1078 return myTLSDefinitions.at(myProgramComboBox->getCurrentItem());
1084 if (myProgramComboBox->getNumItems() == 0) {
1087 return myProgramComboBox->getText().text();
1094 return (
int)myTLSDefinitions.size();
1100 return myProgramComboBox->getNumItems();
1106 return getSUMOTime(myOffsetTextField->getText().text());
1119 if (GNEAttributeCarrier::canParse<SUMOTime>(myOffsetTextField->getText().text())) {
1131 return myParametersTextField->getText().text();
1137 myParametersTextField->setText(parameters.c_str());
1159 myCurrentJunction(nullptr) {
1177 return myCurrentJunction;
1183 myCurrentJunction = junction;
1189 if (myCurrentJunction ==
nullptr) {
1190 myTextFieldJunctionID->setText(
"");
1192 NBNode* nbn = myCurrentJunction->getNBNode();
1193 myTextFieldJunctionID->setText(nbn->
getID().c_str());
1205 myNewTLProgram =
new FXButton(buttonsFrame,
"Create\t\tCreate a new traffic light program",
1208 myDeleteTLProgram =
new FXButton(buttonsFrame,
"Delete\t\tDelete a traffic light program. If all programs are deleted the junction turns into a priority junction.",
1223 myTLSEditorParent(TLSEditorParent),
1224 myTableFont(new FXFont(getApp(),
"Courier New", 9)) {
1230 myPhaseTable->setColumnHeaderHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent() / 2);
1235 myPhaseTable->setHelpText(
"phase duration in seconds | phase state");
1245 FXVerticalFrame* col1 =
new FXVerticalFrame(phaseButtons, LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1246 FXVerticalFrame* col2 =
new FXVerticalFrame(phaseButtons, LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1276 return myPhaseTable;
1282 myPhaseTable->setVisibleRows(1);
1283 myPhaseTable->setVisibleColumns(2);
1284 myPhaseTable->hide();
1285 if (myTLSEditorParent->myTLSAttributes->getNumberOfTLSDefinitions() > 0) {
1286 const bool fixed = myTLSEditorParent->fixedDuration();
1287 const int cols = fixed ? 4 : 6;
1288 const int colDuration = 0;
1289 const int colMinDur = fixed ? -1 : 1;
1290 const int colMaxDur = fixed ? -1 : 2;
1291 const int colState = fixed ? 1 : 3;
1292 const int colNext = fixed ? 2 : 4;
1293 const int colName = fixed ? 3 : 5;
1295 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases = myTLSEditorParent->getPhases();
1296 myPhaseTable->setTableSize((
int)phases.size(), cols);
1297 myPhaseTable->setVisibleRows((
int)phases.size());
1298 myPhaseTable->setVisibleColumns(cols);
1299 for (
int row = 0; row < (int)phases.size(); row++) {
1300 myPhaseTable->setItemText(row, colDuration,
toString(
STEPS2TIME(phases[row].duration)).c_str());
1302 myPhaseTable->setItemText(row, colMinDur,
varDurString(phases[row].minDur).c_str());
1303 myPhaseTable->setItemText(row, colMaxDur,
varDurString(phases[row].maxDur).c_str());
1305 myPhaseTable->setItemText(row, colState, phases[row].state.c_str());
1306 myPhaseTable->setItemText(row, colNext, phases[row].next.size() > 0 ?
toString(phases[row].next).c_str() :
" ");
1307 myPhaseTable->setItemText(row, colName, phases[row].name.c_str());
1308 myPhaseTable->getItem(row, 1)->setJustify(FXTableItem::LEFT);
1310 myPhaseTable->fitColumnsToContents(0, cols);
1311 myPhaseTable->setColumnText(colDuration,
"dur");
1312 if (colMinDur >= 0) {
1313 myPhaseTable->setColumnText(colMinDur,
"min");
1314 myPhaseTable->setColumnText(colMaxDur,
"max");
1315 myPhaseTable->setColumnWidth(colMinDur,
MAX2(myPhaseTable->getColumnWidth(colMinDur), 30));
1316 myPhaseTable->setColumnWidth(colMaxDur,
MAX2(myPhaseTable->getColumnWidth(colMaxDur), 35));
1318 myPhaseTable->setColumnText(colState,
"state");
1319 myPhaseTable->setColumnText(colNext,
"nxt");
1320 myPhaseTable->setColumnText(colName,
"name");
1321 myPhaseTable->setColumnWidth(colNext,
MAX2(myPhaseTable->getColumnWidth(colNext), 30));
1322 myPhaseTable->setColumnWidth(colName,
MAX2(myPhaseTable->getColumnWidth(colName), 45));
1324 myPhaseTable->setHeight((
int)phases.size() * 21 + 21);
1325 myPhaseTable->setCurrentItem(index, 0);
1326 myPhaseTable->selectRow(index,
true);
1327 myPhaseTable->show();
1328 myPhaseTable->setFocus();
1329 myTableScroll->setHeight(myPhaseTable->getHeight() + 15);
1336 int neededWidth = 0;
1337 for (
int i = 0; i < cols; i++) {
1338 neededWidth += myPhaseTable->getColumnWidth(i);
1340 myPhaseTable->setDefColumnWidth(neededWidth / cols);
1348 myCycleDuration->show();
1354 myCycleDuration->hide();
1360 for (
auto it : myTLSEditorParent->getPhases()) {
1361 cycleDuration += it.duration;
1364 myCycleDuration->setText(text.c_str());
1373 myTLSEditorParent(TLSEditorParent),
1374 myHaveModifications(false) {
1392 return myHaveModifications;
1398 myHaveModifications = value;
1407 myTLSEditorParent(TLSEditorParent) {
1423 FXFileDialog opendialog(getCollapsableFrame(),
"Load TLS Program");
1425 opendialog.setSelectMode(SELECTFILE_EXISTING);
1426 opendialog.setPatternList(
"XML files (*.xml)\nAll files (*)");
1430 if (opendialog.execute()) {
1434 tmpTLLCont.
insert(myTLSEditorParent->myEditedDef);
1438 std::set<NBLoadedSUMOTLDef*> newDefsOtherProgram;
1439 for (
auto item : tmpTLLCont.
getPrograms(myTLSEditorParent->myEditedDef->getID())) {
1440 if (item.second != myTLSEditorParent->myEditedDef) {
1442 if (item.first == myTLSEditorParent->myEditedDef->getProgramID()) {
1443 newDefSameProgram = sdef;
1445 newDefsOtherProgram.insert(sdef);
1449 const int newPrograms = (int)newDefsOtherProgram.size();
1450 if (newPrograms > 0 || newDefSameProgram !=
nullptr) {
1451 std::vector<NBNode*> nodes = myTLSEditorParent->myEditedDef->
getNodes();
1452 for (
auto newProg : newDefsOtherProgram) {
1453 for (
auto it_node : nodes) {
1455 myTLSEditorParent->getViewNet()->getUndoList()->add(
new GNEChange_TLS(junction, newProg,
true),
true);
1458 if (newPrograms > 0) {
1459 WRITE_MESSAGE(
"Loaded " +
toString(newPrograms) +
" new programs for tlLogic '" + myTLSEditorParent->myEditedDef->getID() +
"'");
1461 if (newDefSameProgram !=
nullptr) {
1463 myTLSEditorParent->myEditedDef = newDefSameProgram;
1464 WRITE_MESSAGE(
"Updated program '" + newDefSameProgram->
getProgramID() +
"' for tlLogic '" + myTLSEditorParent->myEditedDef->getID() +
"'");
1467 if (tllHandler.
getSeenIDs().count(myTLSEditorParent->myEditedDef->getID()) == 0) {
1468 myTLSEditorParent->getViewNet()->setStatusBarText(
"No programs found for traffic light '" + myTLSEditorParent->myEditedDef->getID() +
"'");
1474 tmpTLLCont.
removeProgram(def->getID(), def->getProgramID(),
false);
1477 myTLSEditorParent->myTLSPhases->initPhaseTable();
1478 myTLSEditorParent->myTLSModifications->setHaveModifications(
true);
1487 "Save TLS Program as",
".xml",
1503 myTLSEditorParent->myEditedDef->writeParams(device);
1506 const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases = myTLSEditorParent->myEditedDef->getLogic()->getPhases();
1507 for (
auto j : phases) {
1511 if (varPhaseLength) {
1529 if (time == std::floor(time)) {
1538 const bool enable = myTLSEditorParent->myTLSAttributes->getNumberOfTLSDefinitions() > 0;
1539 o->handle(getCollapsableFrame(), FXSEL(SEL_COMMAND, enable ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE),
nullptr);
static const int NUM_POINTS
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_OPEN_PARAMETERS_DIALOG
open parameters dialog
@ 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_PARAMETERS
TLS parameters.
@ 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
TLS offset.
@ 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 GUIDesignButtonAttribute
button extended over over column with thick and raise frame
#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 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)
FXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toogled)
static std::string addExtension(const std::string &path, const std::string &extension)
Add an extension to the given file path.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
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
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
std::vector< GNELane * > getSelectedLanes() const
get selected lanes
std::vector< GNEEdge * > getSelectedEdges() const
return all edges
SUMORTree & getGrid()
Returns the RTree used for visualisation speed-up.
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
void computeJunction(GNEJunction *junction)
trigger recomputation of junction shape and logic param[in] window The window to inform about delay
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
Dialog for edit parameters.
void initTLSAttributes(GNEJunction *junction)
initializes the definitions and corresponding listbox
bool isValidOffset()
is current offset valid
bool isValidParameters()
are current parameter valid
FXTextField * myOffsetTextField
the TextField for modifying offset
int getNumberOfPrograms() const
get number of programs
SUMOTime getOffset() const
get current offset in string format
const std::string getCurrentTLSProgramID() const
get current program ID
void setParameters(const std::string ¶meters)
set new parameters
void clearTLSAttributes()
clear TLS attributes
FXComboBox * myProgramComboBox
the comboBox for selecting the tl-definition to edit
void setOffset(const SUMOTime &offset)
set new offset
std::string getParameters() const
get current parameters in string format
int getNumberOfTLSDefinitions() const
get number of definitions
FXButton * myButtonEditParameters
button for edit parameters
TLSAttributes(GNETLSEditorFrame *TLSEditorParent)
constructor
NBTrafficLightDefinition * getCurrentTLSDefinition() const
get current definition
FXTextField * myParametersTextField
the TextField for modifying parameters
~TLSAttributes()
destructor
FXTextField * myNameTextField
name text field
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
GNEFrameModules::OverlappedInspection * myOverlappedInspection
Overlapped Inspection.
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
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)
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 onCmdSetOffset(FXObject *, FXSelector, void *)
Called when the user changes the offset of a TLS.
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 onCmdSetParameters(FXObject *, FXSelector, void *)
Called when the user changes parameters of a TLS.
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.
long onCmdEditParameters(FXObject *, FXSelector, void *ptr)
Called when user press edit parameters button.
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 end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void abortAllChangeGroups()
reverts and discards ALL active chained change groups
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
class used to group all variables related with objects under cursor after a click over view
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.
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
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::set< std::string > & getSeenIDs()
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.
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.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string ¶msString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
A point in 2D or 3D with translation and scaling methods.
void append(const PositionVector &v, double sameThreshold=2.0)
double length() const
Returns the length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
PositionVector reverse() const
reverse position vector
static const RGBColor BLACK
static const RGBColor RED
named colors
void addAdditionalGLObject(GUIGlObject *o, const double exaggeration=1)
Adds an additional object (detector/shape/trigger) for visualisation.
void removeAdditionalGLObject(GUIGlObject *o, const double exaggeration=1)
Removes an additional object (detector/shape/trigger) from being visualised.
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.
PositionVector viaShape
shape of via
PositionVector shape
shape of Connection