![]() |
SUMO - Simulation of Urban MObility
|
#include <GNETLSEditor.h>
Public Member Functions | |
bool | controlsEdge (GNEEdge &edge) const |
whether the given edge is controlled by the currently edited tlDef More... | |
void | editJunction (GNEJunction *junction) |
edits the traffic light for the given junction More... | |
FXFont * | getHeaderFont () |
GNETLSEditor (FXComposite *parent, GNEViewNet *updateTarget, GNEUndoList *undoList) | |
Constructor. More... | |
void | handleChange (GNEInternalLane *lane) |
update phase definition for the current traffic light and phase More... | |
void | handleMultiChange (GNELane *lane, FXObject *obj, FXSelector sel, void *data) |
update phase definition for the current traffic light and phase More... | |
~GNETLSEditor () | |
Destructor. More... | |
FOX-callbacks | |
long | onCmdOK (FXObject *, FXSelector, void *) |
Called when the user presses the OK-Button saves any modifications. More... | |
long | onCmdCancel (FXObject *, FXSelector, void *) |
Called when the user presses the Cancel-button discards any modifications. More... | |
long | onCmdToggle (FXObject *, FXSelector, void *) |
Called when the user presses the Corresponding-button. More... | |
long | onCmdGuess (FXObject *, FXSelector, void *) |
long | onCmdDefCreate (FXObject *, FXSelector, void *) |
long | onCmdDefDelete (FXObject *, FXSelector, void *) |
long | onCmdDefOffset (FXObject *, FXSelector, void *) |
long | onCmdDefSwitch (FXObject *, FXSelector, void *) |
long | onCmdDefRename (FXObject *, FXSelector, void *) |
long | onCmdDefSubRename (FXObject *, FXSelector, void *) |
long | onCmdDefAddOff (FXObject *, FXSelector, void *) |
long | onCmdPhaseSwitch (FXObject *, FXSelector, void *) |
long | onCmdPhaseCreate (FXObject *, FXSelector, void *) |
long | onCmdPhaseDelete (FXObject *, FXSelector, void *) |
long | onCmdPhaseEdit (FXObject *, FXSelector, void *) |
long | onCmdMakeRILSAConforming (FXObject *, FXSelector, void *) |
long | onUpdDefSwitch (FXObject *, FXSelector, void *) |
long | onUpdNeedsDef (FXObject *, FXSelector, void *) |
long | onUpdNeedsDefAndPhase (FXObject *, FXSelector, void *) |
long | onUpdDefCreate (FXObject *, FXSelector, void *) |
long | onUpdModified (FXObject *, FXSelector, void *) |
Protected Member Functions | |
GNETLSEditor () | |
FOX needs this. More... | |
Private Types | |
typedef std::map< int, std::vector< GNEInternalLane * > > | TLIndexMap |
the internal lanes belonging the the current junction indexed by their tl-index More... | |
Private Member Functions | |
void | buildIinternalLanes (NBTrafficLightDefinition *tlDef) |
void | cleanup () |
cleans up previous lanes More... | |
const std::vector< NBTrafficLightLogic::PhaseDefinition > & | getPhases () |
the phase of the current traffic light More... | |
void | initDefinitions () |
void | initPhaseTable (unsigned int index=0) |
void | updateCycleDuration () |
recomputes cycle duration and updates label More... | |
void | updateDescription () const |
Static Private Member Functions | |
static SUMOTime | getSUMOTime (const FXString &string) |
converts to SUMOTime More... | |
Private Attributes | |
FXVerticalFrame * | myContentFrame |
the panel to hold all member widgets More... | |
GNEJunction * | myCurrentJunction |
the junction of the tls is being modified More... | |
FXLabel * | myCycleDuration |
FXListBox * | myDefBox |
the listbox for selecting the tl-definition to edit More... | |
std::vector< NBTrafficLightDefinition * > | myDefinitions |
the list of Definitions for the current junction More... | |
FXLabel * | myDescription |
the label that shows the current editing state More... | |
NBLoadedSUMOTLDef * | myEditedDef |
the traffic light definition being edited More... | |
bool | myHaveModifications |
whether the current tls was modified More... | |
FXFont * | myHeaderFont |
Font for the widget. More... | |
TLIndexMap | myInternalLanes |
FXTextField * | myOffset |
the control for modifying offset More... | |
unsigned int | myPhaseIndex |
index of the phase being shown More... | |
FXTable * | myPhaseTable |
table for selecting and rearranging phases and for changing duration More... | |
FXFont * | myTableFont |
font for the phase table More... | |
GNEUndoList * | myUndoList |
the undolist with wich to register changes More... | |
GNEViewNet * | myUpdateTarget |
Static Private Attributes | |
static const int | WIDTH = 140 |
the width of the widget More... | |
The Widget for modifying selections of network-elements
Definition at line 57 of file GNETLSEditor.h.
|
private |
the internal lanes belonging the the current junction indexed by their tl-index
Definition at line 158 of file GNETLSEditor.h.
GNETLSEditor::GNETLSEditor | ( | FXComposite * | parent, |
GNEViewNet * | updateTarget, | ||
GNEUndoList * | undoList | ||
) |
Constructor.
[in] | parent | The parent window |
Definition at line 102 of file GNETLSEditor.cpp.
References MID_CANCEL, MID_GNE_DEF_CREATE, MID_GNE_DEF_DELETE, MID_GNE_DEF_OFFSET, MID_GNE_DEF_SWITCH, MID_GNE_PHASE_CREATE, MID_GNE_PHASE_DELETE, MID_GNE_PHASE_TABLE, and MID_OK.
GNETLSEditor::~GNETLSEditor | ( | ) |
Destructor.
Definition at line 186 of file GNETLSEditor.cpp.
References cleanup(), myHeaderFont, and myTableFont.
|
inlineprotected |
FOX needs this.
Definition at line 130 of file GNETLSEditor.h.
|
private |
Definition at line 492 of file GNETLSEditor.cpp.
References SUMORTree::addAdditionalGLObject(), NBNode::computeInternalLaneShape(), NBTrafficLightDefinition::getControlledLinks(), NBNode::getCrossings(), Named::getID(), GNEJunction::getNBNode(), GNEViewNet::getNet(), GNENet::getVisualisationSpeedUp(), NBNode::Crossing::id, myCurrentJunction, myInternalLanes, myUpdateTarget, SUMORTree::removeAdditionalGLObject(), NBNode::Crossing::shape, NBNode::Crossing::tlLinkNo, and toString().
Referenced by cleanup(), and onCmdDefSwitch().
|
private |
cleans up previous lanes
Definition at line 471 of file GNETLSEditor.cpp.
References buildIinternalLanes(), initPhaseTable(), myCurrentJunction, myCycleDuration, myDefBox, myDefinitions, myEditedDef, myHaveModifications, myOffset, GNEJunction::selectTLS(), and updateDescription().
Referenced by onCmdCancel(), onCmdOK(), and ~GNETLSEditor().
bool GNETLSEditor::controlsEdge | ( | GNEEdge & | edge | ) | const |
whether the given edge is controlled by the currently edited tlDef
Definition at line 651 of file GNETLSEditor.cpp.
References NBTrafficLightDefinition::getControlledLinks(), GUIGlObject::getMicrosimID(), and myEditedDef.
Referenced by getHeaderFont(), and GNELane::getPopUpMenu().
void GNETLSEditor::editJunction | ( | GNEJunction * | junction | ) |
edits the traffic light for the given junction
[in] | junction | The junction of which the traffic light shall be edited |
Definition at line 194 of file GNETLSEditor.cpp.
References initDefinitions(), myCurrentJunction, myHaveModifications, myUndoList, myUpdateTarget, onCmdCancel(), GNEUndoList::p_begin(), GNEJunction::selectTLS(), and GNEViewNet::setStatusBarText().
Referenced by getHeaderFont(), onCmdDefCreate(), and GNEViewNet::onLeftBtnPress().
|
inline |
Definition at line 72 of file GNETLSEditor.h.
References controlsEdge(), editJunction(), handleChange(), handleMultiChange(), myHeaderFont, onCmdCancel(), onCmdDefAddOff(), onCmdDefCreate(), onCmdDefDelete(), onCmdDefOffset(), onCmdDefRename(), onCmdDefSubRename(), onCmdDefSwitch(), onCmdGuess(), onCmdMakeRILSAConforming(), onCmdOK(), onCmdPhaseCreate(), onCmdPhaseDelete(), onCmdPhaseEdit(), onCmdPhaseSwitch(), onCmdToggle(), onUpdDefCreate(), onUpdDefSwitch(), onUpdModified(), onUpdNeedsDef(), and onUpdNeedsDefAndPhase().
|
private |
the phase of the current traffic light
Definition at line 583 of file GNETLSEditor.cpp.
References NBLoadedSUMOTLDef::getLogic(), NBTrafficLightLogic::getPhases(), and myEditedDef.
Referenced by handleChange(), initPhaseTable(), onCmdPhaseEdit(), onCmdPhaseSwitch(), and updateCycleDuration().
|
staticprivate |
converts to SUMOTime
Definition at line 665 of file GNETLSEditor.cpp.
References TIME2STEPS.
Referenced by onCmdDefOffset(), onCmdPhaseCreate(), and onCmdPhaseEdit().
void GNETLSEditor::handleChange | ( | GNEInternalLane * | lane | ) |
update phase definition for the current traffic light and phase
Definition at line 589 of file GNETLSEditor.cpp.
References GNEViewNet::changeAllPhases(), GNEInternalLane::getLinkState(), NBLoadedSUMOTLDef::getLogic(), getPhases(), GNEInternalLane::getTLIndex(), initPhaseTable(), myEditedDef, myHaveModifications, myPhaseTable, myUpdateTarget, and NBTrafficLightLogic::setPhaseState().
Referenced by getHeaderFont(), and GNEInternalLane::onDefault().
void GNETLSEditor::handleMultiChange | ( | GNELane * | lane, |
FXObject * | obj, | ||
FXSelector | sel, | ||
void * | data | ||
) |
update phase definition for the current traffic light and phase
Definition at line 605 of file GNETLSEditor.cpp.
References NBTrafficLightDefinition::getControlledLinks(), NBConnection::getFrom(), NBConnection::getFromLane(), GUIGlObject::getGlID(), NBEdge::getLaneID(), GNEEdge::getLanes(), GUIGlObject::getMicrosimID(), GNEViewNet::getNet(), GNELane::getParentEdge(), NBConnection::getTLIndex(), GLO_EDGE, GLO_LANE, gSelected, GUISelectedStorage::isSelected(), myEditedDef, myHaveModifications, myInternalLanes, myUpdateTarget, GNENet::retrieveEdges(), and GNENet::retrieveLanes().
Referenced by getHeaderFont(), and GNELane::onDefault().
|
private |
Definition at line 530 of file GNETLSEditor.cpp.
References NBNode::getControllingTLS(), GNEJunction::getNBNode(), myCurrentJunction, myDefBox, myDefinitions, onCmdDefSwitch(), and updateDescription().
Referenced by editJunction().
|
private |
Definition at line 552 of file GNETLSEditor.cpp.
References getPhases(), MIN2(), myDefinitions, myPhaseTable, STEPS2TIME, toString(), and WIDTH.
Referenced by cleanup(), handleChange(), onCmdDefSwitch(), onCmdPhaseCreate(), and onCmdPhaseDelete().
long GNETLSEditor::onCmdCancel | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Called when the user presses the Cancel-button discards any modifications.
Definition at line 208 of file GNETLSEditor.cpp.
References cleanup(), myCurrentJunction, myUndoList, myUpdateTarget, and GNEUndoList::p_abort().
Referenced by GNEViewNet::abortOperation(), editJunction(), getHeaderFont(), onCmdDefCreate(), onCmdDefDelete(), onCmdDefSwitch(), and onCmdOK().
long GNETLSEditor::onCmdDefAddOff | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Definition at line 356 of file GNETLSEditor.cpp.
Referenced by getHeaderFont().
long GNETLSEditor::onCmdDefCreate | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Definition at line 238 of file GNETLSEditor.cpp.
References editJunction(), GNEJunction::getAttribute(), myCurrentJunction, myUndoList, NODETYPE_TRAFFIC_LIGHT, onCmdCancel(), GNEJunction::setAttribute(), SUMO_ATTR_TYPE, and toString().
Referenced by getHeaderFont().
long GNETLSEditor::onCmdDefDelete | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Definition at line 252 of file GNETLSEditor.cpp.
References myCurrentJunction, myDefBox, myDefinitions, myUndoList, NODETYPE_PRIORITY, onCmdCancel(), GNEJunction::setAttribute(), SUMO_ATTR_TYPE, and toString().
Referenced by getHeaderFont().
long GNETLSEditor::onCmdDefOffset | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Definition at line 336 of file GNETLSEditor.cpp.
References getSUMOTime(), myEditedDef, myHaveModifications, myOffset, and NBLoadedSUMOTLDef::setOffset().
Referenced by getHeaderFont().
long GNETLSEditor::onCmdDefRename | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Definition at line 344 of file GNETLSEditor.cpp.
Referenced by getHeaderFont().
long GNETLSEditor::onCmdDefSubRename | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Definition at line 350 of file GNETLSEditor.cpp.
Referenced by getHeaderFont().
long GNETLSEditor::onCmdDefSwitch | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Definition at line 267 of file GNETLSEditor.cpp.
References buildIinternalLanes(), GNENet::computeJunction(), NBLoadedSUMOTLDef::getLogic(), NBTrafficLightLogicCont::getLogic(), GNEViewNet::getNet(), NBTrafficLightLogic::getOffset(), GNENet::getTLLogicCont(), initPhaseTable(), myCurrentJunction, myDefBox, myDefinitions, myEditedDef, myOffset, myUpdateTarget, onCmdCancel(), GNEViewNet::setStatusBarText(), STEPS2TIME, toString(), and updateCycleDuration().
Referenced by getHeaderFont(), and initDefinitions().
long GNETLSEditor::onCmdGuess | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Definition at line 362 of file GNETLSEditor.cpp.
Referenced by getHeaderFont().
long GNETLSEditor::onCmdMakeRILSAConforming | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Referenced by getHeaderFont().
long GNETLSEditor::onCmdOK | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Called when the user presses the OK-Button saves any modifications.
Definition at line 219 of file GNETLSEditor.cpp.
References cleanup(), myCurrentJunction, myDefBox, myDefinitions, myEditedDef, myHaveModifications, myUndoList, myUpdateTarget, onCmdCancel(), and GNEUndoList::p_end().
Referenced by getHeaderFont(), and GNEViewNet::hotkeyEnter().
long GNETLSEditor::onCmdPhaseCreate | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Definition at line 389 of file GNETLSEditor.cpp.
References NBTrafficLightLogic::addStep(), NBLoadedSUMOTLDef::getLogic(), NBTrafficLightLogic::getNumLinks(), getSUMOTime(), initPhaseTable(), MAX2(), myEditedDef, myHaveModifications, and myPhaseTable.
Referenced by getHeaderFont().
long GNETLSEditor::onCmdPhaseDelete | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Definition at line 407 of file GNETLSEditor.cpp.
References NBTrafficLightLogic::deletePhase(), NBLoadedSUMOTLDef::getLogic(), initPhaseTable(), myEditedDef, myHaveModifications, and myPhaseTable.
Referenced by getHeaderFont().
long GNETLSEditor::onCmdPhaseEdit | ( | FXObject * | , |
FXSelector | , | ||
void * | ptr | ||
) |
Definition at line 417 of file GNETLSEditor.cpp.
References NBTrafficLightLogic::addStep(), NBTrafficLightLogic::deletePhase(), NBLoadedSUMOTLDef::getLogic(), getPhases(), getSUMOTime(), myEditedDef, myHaveModifications, myPhaseTable, onCmdPhaseSwitch(), NBTrafficLightLogic::setPhaseDuration(), STEPS2TIME, toString(), and updateCycleDuration().
Referenced by getHeaderFont().
long GNETLSEditor::onCmdPhaseSwitch | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Definition at line 368 of file GNETLSEditor.cpp.
References getPhases(), myInternalLanes, myPhaseTable, myUpdateTarget, and NBTrafficLightLogic::PhaseDefinition::state.
Referenced by getHeaderFont(), and onCmdPhaseEdit().
long GNETLSEditor::onCmdToggle | ( | FXObject * | , |
FXSelector | , | ||
void * | |||
) |
Called when the user presses the Corresponding-button.
Referenced by getHeaderFont().
long GNETLSEditor::onUpdDefCreate | ( | FXObject * | o, |
FXSelector | , | ||
void * | |||
) |
Definition at line 319 of file GNETLSEditor.cpp.
References myCurrentJunction, and myHaveModifications.
Referenced by getHeaderFont().
long GNETLSEditor::onUpdDefSwitch | ( | FXObject * | o, |
FXSelector | , | ||
void * | |||
) |
Definition at line 294 of file GNETLSEditor.cpp.
References myDefinitions, and myHaveModifications.
Referenced by getHeaderFont().
long GNETLSEditor::onUpdModified | ( | FXObject * | o, |
FXSelector | , | ||
void * | |||
) |
Definition at line 327 of file GNETLSEditor.cpp.
References myHaveModifications.
Referenced by getHeaderFont().
long GNETLSEditor::onUpdNeedsDef | ( | FXObject * | o, |
FXSelector | , | ||
void * | |||
) |
Definition at line 302 of file GNETLSEditor.cpp.
References myDefinitions.
Referenced by getHeaderFont().
long GNETLSEditor::onUpdNeedsDefAndPhase | ( | FXObject * | o, |
FXSelector | , | ||
void * | |||
) |
Definition at line 310 of file GNETLSEditor.cpp.
References myDefinitions, and myPhaseTable.
Referenced by getHeaderFont().
|
private |
recomputes cycle duration and updates label
Definition at line 672 of file GNETLSEditor.cpp.
References getPhases(), myCycleDuration, STEPS2TIME, and toString().
Referenced by onCmdDefSwitch(), and onCmdPhaseEdit().
|
private |
Definition at line 454 of file GNETLSEditor.cpp.
References Named::getID(), GNEJunction::getNBNode(), NBNode::isTLControlled(), myCurrentJunction, myDescription, and myHaveModifications.
Referenced by cleanup(), and initDefinitions().
|
private |
the panel to hold all member widgets
Definition at line 134 of file GNETLSEditor.h.
|
private |
the junction of the tls is being modified
Definition at line 146 of file GNETLSEditor.h.
Referenced by buildIinternalLanes(), cleanup(), editJunction(), initDefinitions(), onCmdCancel(), onCmdDefCreate(), onCmdDefDelete(), onCmdDefSwitch(), onCmdOK(), onUpdDefCreate(), and updateDescription().
|
private |
Definition at line 173 of file GNETLSEditor.h.
Referenced by cleanup(), and updateCycleDuration().
|
private |
the listbox for selecting the tl-definition to edit
Definition at line 168 of file GNETLSEditor.h.
Referenced by cleanup(), initDefinitions(), onCmdDefDelete(), onCmdDefSwitch(), and onCmdOK().
|
private |
the list of Definitions for the current junction
Definition at line 162 of file GNETLSEditor.h.
Referenced by cleanup(), initDefinitions(), initPhaseTable(), onCmdDefDelete(), onCmdDefSwitch(), onCmdOK(), onUpdDefSwitch(), onUpdNeedsDef(), and onUpdNeedsDefAndPhase().
|
private |
the label that shows the current editing state
Definition at line 143 of file GNETLSEditor.h.
Referenced by updateDescription().
|
private |
the traffic light definition being edited
Definition at line 165 of file GNETLSEditor.h.
Referenced by cleanup(), controlsEdge(), getPhases(), handleChange(), handleMultiChange(), onCmdDefOffset(), onCmdDefSwitch(), onCmdOK(), onCmdPhaseCreate(), onCmdPhaseDelete(), and onCmdPhaseEdit().
|
private |
whether the current tls was modified
Definition at line 155 of file GNETLSEditor.h.
Referenced by cleanup(), editJunction(), handleChange(), handleMultiChange(), onCmdDefOffset(), onCmdOK(), onCmdPhaseCreate(), onCmdPhaseDelete(), onCmdPhaseEdit(), onUpdDefCreate(), onUpdDefSwitch(), onUpdModified(), and updateDescription().
|
private |
Font for the widget.
Definition at line 137 of file GNETLSEditor.h.
Referenced by getHeaderFont(), and ~GNETLSEditor().
|
private |
Definition at line 159 of file GNETLSEditor.h.
Referenced by buildIinternalLanes(), handleMultiChange(), and onCmdPhaseSwitch().
|
private |
the control for modifying offset
Definition at line 171 of file GNETLSEditor.h.
Referenced by cleanup(), onCmdDefOffset(), and onCmdDefSwitch().
|
private |
index of the phase being shown
Definition at line 179 of file GNETLSEditor.h.
|
private |
table for selecting and rearranging phases and for changing duration
Definition at line 176 of file GNETLSEditor.h.
Referenced by handleChange(), initPhaseTable(), onCmdPhaseCreate(), onCmdPhaseDelete(), onCmdPhaseEdit(), onCmdPhaseSwitch(), and onUpdNeedsDefAndPhase().
|
private |
font for the phase table
Definition at line 140 of file GNETLSEditor.h.
Referenced by ~GNETLSEditor().
|
private |
the undolist with wich to register changes
Definition at line 149 of file GNETLSEditor.h.
Referenced by editJunction(), onCmdCancel(), onCmdDefCreate(), onCmdDefDelete(), and onCmdOK().
|
private |
Definition at line 152 of file GNETLSEditor.h.
Referenced by buildIinternalLanes(), editJunction(), handleChange(), handleMultiChange(), onCmdCancel(), onCmdDefSwitch(), onCmdOK(), and onCmdPhaseSwitch().
|
staticprivate |
the width of the widget
Definition at line 182 of file GNETLSEditor.h.
Referenced by initPhaseTable().