Eclipse SUMO - Simulation of Urban MObility
|
This window displays a phase diagram for a chosen tl-logic. More...
#include <GUITLLogicPhasesTrackerWindow.h>
Data Structures | |
class | GUITLLogicPhasesTrackerPanel |
The canvas for the visualisation of phases. More... | |
Public Member Functions | |
void | addValue (std::pair< SUMOTime, MSPhaseDefinition > def) |
Adds a further phase definition. | |
void | create () |
Creates the window (FOX-Toolkit) | |
GUITLLogicPhasesTrackerWindow (GUIMainWindow &app, MSTrafficLightLogic &logic, GUITrafficLightLogicWrapper &wrapper, const MSSimpleTrafficLightLogic::Phases &phases) | |
Constructor to show the complete phase diagram. | |
GUITLLogicPhasesTrackerWindow (GUIMainWindow &app, MSTrafficLightLogic &logic, GUITrafficLightLogicWrapper &wrapper, ValueSource< std::pair< SUMOTime, MSPhaseDefinition > > *src) | |
Constructor to track current phases. | |
void | setBeginTime (SUMOTime time) |
Sets the time the display shall be shown as beginning at. | |
~GUITLLogicPhasesTrackerWindow () | |
Destructor. | |
FOX-callbacks | |
{ | |
typedef std::vector< MSPhaseDefinition > | PhasesVector |
} | |
typedef std::vector< SUMOTime > | DurationsVector |
Definition of a storage for durations. | |
typedef std::vector< int > | IndexVector |
Definition of a storage for indices. | |
typedef std::vector< std::vector< double > > | AdditionalStatesVector |
Definition of a storage for detector and condition states. | |
GUIMainWindow * | myApplication |
The main application. | |
MSTrafficLightLogic * | myTLLogic |
The logic to display. | |
PhasesVector | myPhases |
The list of phases. | |
DurationsVector | myDurations |
The list of phase durations. | |
DurationsVector | myTimeInCycle |
The time within the cycle for the current phase. | |
IndexVector | myPhaseIndex |
The index of the current phase. | |
AdditionalStatesVector | myDetectorStates |
The state of all used detectors of the current phase. | |
AdditionalStatesVector | myConditionStates |
DurationsVector | myDetectorDurations |
The list of detector state durations. | |
DurationsVector | myConditionDurations |
GUITLLogicPhasesTrackerPanel * | myPanel |
The panel to draw on. | |
FXMutex | myLock |
A lock to avoid addition of new values while drawing. | |
std::vector< std::string > | myLinkNames |
The names of links. | |
std::vector< std::string > | myDetectorNames |
std::vector< std::string > | myConditionNames |
int | myFirstPhase2Show |
The index of the first phase that fits into the window. | |
int | myFirstDet2Show |
int | myFirstCond2Show |
SUMOTime | myFirstPhaseOffset |
The offset to draw the first phase (left offset) | |
SUMOTime | myFirstDetOffset |
SUMOTime | myFirstCondOffset |
SUMOTime | myFirstTime2Show |
The time the diagram begins at. | |
SUMOTime | myBeginTime |
The first time a phase was added at. | |
SUMOTime | myLastTime |
The last time a phase was added at. | |
GLObjectValuePassConnector< std::pair< SUMOTime, MSPhaseDefinition > > * | myConnector |
The connector for retrieval of further phases. | |
bool | myAmInTrackingMode |
Information whether the tracking mode is on. | |
FXToolBarShell * | myToolBarDrag |
The tool bar drag (tracking mode) | |
FXToolBar * | myToolBar |
The tool bar (tracking mode) | |
FXRealSpinner * | myBeginOffset |
The offset changer (tracking mode) | |
MFXComboBoxIcon * | myTimeMode |
The time mode. | |
MFXComboBoxIcon * | myGreenMode |
Whether green durations are printed. | |
FXCheckButton * | myIndexMode |
Whether phase names shall be printed instead of indices. | |
FXCheckButton * | myDetectorMode |
Whether detector states are drawn. | |
FXCheckButton * | myConditionMode |
Whether detector states are drawn. | |
static int | myLastY |
y-Position of previously opened window | |
long | onConfigure (FXObject *sender, FXSelector sel, void *ptr) |
called on size change | |
long | onPaint (FXObject *sender, FXSelector sel, void *ptr) |
called if the widget shall be repainted | |
long | onSimStep (FXObject *sender, FXSelector sel, void *ptr) |
called on a simulation step | |
void | drawValues (GUITLLogicPhasesTrackerPanel &caller) |
Draws all values. | |
void | initToolBar () |
void | saveSettings () |
void | loadSettings () |
int | computeHeight () |
compute required windowHeight | |
void | drawNames (const std::vector< std::string > &names, double fontHeight, double fontWidth, double divHeight, double divWidth, double &h, int extraLines) |
draw row title | |
void | drawAdditionalStates (GUITLLogicPhasesTrackerPanel &caller, const AdditionalStatesVector &states, const DurationsVector &durations, SUMOTime firstOffset, int first2Show, double hStart, double panelWidth, double leftOffset, double barWidth, double stateHeight, double h20, double &h) |
draw detector and condition states | |
SUMOTime | findTimeInCycle (SUMOTime t) |
find time in cycle based on myTimeInCycle | |
GUITLLogicPhasesTrackerWindow () | |
protected constructor for FOX | |
This window displays a phase diagram for a chosen tl-logic.
Definition at line 61 of file GUITLLogicPhasesTrackerWindow.h.
typedef std::vector<std::vector<double > > GUITLLogicPhasesTrackerWindow::AdditionalStatesVector |
Definition of a storage for detector and condition states.
Definition at line 136 of file GUITLLogicPhasesTrackerWindow.h.
typedef std::vector<SUMOTime> GUITLLogicPhasesTrackerWindow::DurationsVector |
Definition of a storage for durations.
Definition at line 130 of file GUITLLogicPhasesTrackerWindow.h.
typedef std::vector<int> GUITLLogicPhasesTrackerWindow::IndexVector |
Definition of a storage for indices.
Definition at line 133 of file GUITLLogicPhasesTrackerWindow.h.
typedef std::vector<MSPhaseDefinition> GUITLLogicPhasesTrackerWindow::PhasesVector |
}
Definition of a storage for phases
Definition at line 127 of file GUITLLogicPhasesTrackerWindow.h.
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerWindow | ( | GUIMainWindow & | app, |
MSTrafficLightLogic & | logic, | ||
GUITrafficLightLogicWrapper & | wrapper, | ||
ValueSource< std::pair< SUMOTime, MSPhaseDefinition > > * | src | ||
) |
Constructor to track current phases.
[in] | app | The main application window |
[in] | logic | The logic to track |
[in] | wrapper | The tracked logic's wrapper |
[in] | src | The value source to track |
Definition at line 160 of file GUITLLogicPhasesTrackerWindow.cpp.
References APP_TLSTRACKER, computeHeight(), MSTrafficLightLogic::getConditions(), MSTrafficLightLogic::getDetectorStates(), GUIIconSubSys::getIcon(), MSTrafficLightLogic::getLinks(), initToolBar(), loadSettings(), myApplication, myConditionNames, myConnector, myDetectorNames, myLinkNames, myPanel, and myTLLogic.
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerWindow | ( | GUIMainWindow & | app, |
MSTrafficLightLogic & | logic, | ||
GUITrafficLightLogicWrapper & | wrapper, | ||
const MSSimpleTrafficLightLogic::Phases & | phases | ||
) |
Constructor to show the complete phase diagram.
[in] | app | The main application window |
[in] | logic | The logic to show |
[in] | wrapper | The shown logic's wrapper |
[in] | phases | The phases to show |
Definition at line 200 of file GUITLLogicPhasesTrackerWindow.cpp.
References GUIMainWindow::addChild(), APP_TLSTRACKER, computeHeight(), GUIIconSubSys::getIcon(), Named::getID(), MSTrafficLightLogic::getLinks(), MSTrafficLightLogic::getProgramID(), initToolBar(), myApplication, myConnector, myLinkNames, myPanel, and myTLLogic.
GUITLLogicPhasesTrackerWindow::~GUITLLogicPhasesTrackerWindow | ( | ) |
Destructor.
Definition at line 232 of file GUITLLogicPhasesTrackerWindow.cpp.
References myAmInTrackingMode, myApplication, myConnector, myLastY, myLock, myToolBarDrag, GUIMainWindow::removeChild(), and saveSettings().
|
inlineprotected |
protected constructor for FOX
Definition at line 314 of file GUITLLogicPhasesTrackerWindow.h.
|
virtual |
Adds a further phase definition.
[in] | def | The definition to add |
Implements ValueRetriever< std::pair< SUMOTime, MSPhaseDefinition > >.
Definition at line 905 of file GUITLLogicPhasesTrackerWindow.cpp.
References DELTA_T, MSTrafficLightLogic::getConditions(), MSTrafficLightLogic::getCurrentPhaseIndex(), MSTrafficLightLogic::getDetectorStates(), MSTrafficLightLogic::mapTimeInCycle(), myBeginTime, myConditionDurations, myConditionStates, myDetectorDurations, myDetectorStates, myDurations, myLastTime, myLock, myPhaseIndex, myPhases, myTimeInCycle, and myTLLogic.
|
private |
compute required windowHeight
Definition at line 298 of file GUITLLogicPhasesTrackerWindow.cpp.
References MSTrafficLightLogic::getConditions(), MSTrafficLightLogic::getDetectorStates(), MSTrafficLightLogic::getLinks(), myAmInTrackingMode, myConditionMode, myDetectorMode, and myTLLogic.
Referenced by GUITLLogicPhasesTrackerWindow(), GUITLLogicPhasesTrackerWindow(), and onSimStep().
void GUITLLogicPhasesTrackerWindow::create | ( | ) |
Creates the window (FOX-Toolkit)
Definition at line 290 of file GUITLLogicPhasesTrackerWindow.cpp.
References myToolBarDrag.
Referenced by GUITrafficLightLogicWrapper::begin2TrackPhases(), and GUITrafficLightLogicWrapper::showPhases().
|
private |
draw detector and condition states
Definition at line 824 of file GUITLLogicPhasesTrackerWindow.cpp.
References GLHelper::drawText(), FONS_ALIGN_LEFT, FONS_ALIGN_MIDDLE, GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::getMousePos(), myBeginTime, myLastTime, toString(), Position::x(), Position::y(), and RGBColor::YELLOW.
Referenced by drawValues().
|
private |
draw row title
Definition at line 795 of file GUITLLogicPhasesTrackerWindow.cpp.
References GLHelper::drawText(), FONS_ALIGN_BOTTOM, FONS_ALIGN_LEFT, and RGBColor::WHITE.
Referenced by drawValues().
void GUITLLogicPhasesTrackerWindow::drawValues | ( | GUITLLogicPhasesTrackerPanel & | caller | ) |
Draws all values.
[in] | The | target panel |
Definition at line 314 of file GUITLLogicPhasesTrackerWindow.cpp.
References RGBColor::BLACK, drawAdditionalStates(), drawNames(), GLHelper::drawText(), findTimeInCycle(), FONS_ALIGN_BOTTOM, FONS_ALIGN_LEFT, FONS_ALIGN_MIDDLE, MFXComboBoxIcon::getCurrentItem(), GUIVisualizationSettings::getLinkColor(), MSTrafficLightLogic::getLinks(), MSSimpleTrafficLightLogic::getPhases(), GLHelper::getTextWidth(), LINKSTATE_TL_GREEN_MAJOR, LINKSTATE_TL_GREEN_MINOR, LINKSTATE_TL_RED, LINKSTATE_TL_REDYELLOW, MAX2(), myAmInTrackingMode, myBeginOffset, myBeginTime, myConditionDurations, myConditionMode, myConditionNames, myConditionStates, myDetectorDurations, myDetectorMode, myDetectorNames, myDetectorStates, myDurations, myFirstCond2Show, myFirstCondOffset, myFirstDet2Show, myFirstDetOffset, myFirstPhase2Show, myFirstPhaseOffset, myFirstTime2Show, myGreenMode, myIndexMode, myLastTime, myLinkNames, myLock, myPhaseIndex, myPhases, myTimeInCycle, myTimeMode, myTLLogic, StringUtils::padFront(), GLHelper::setColor(), STEPS2TIME, TIME2STEPS, TL, toString(), RGBColor::WHITE, and WRITE_ERROR.
find time in cycle based on myTimeInCycle
Definition at line 882 of file GUITLLogicPhasesTrackerWindow.cpp.
References MSTrafficLightLogic::mapTimeInCycle(), myDurations, myLastTime, myPhases, myTimeInCycle, and myTLLogic.
Referenced by drawValues().
|
private |
Definition at line 247 of file GUITLLogicPhasesTrackerWindow.cpp.
References MFXComboBoxIcon::appendIconItem(), GUIDesignComboBoxVisibleItemsMedium, GUIDesignToolBar, GUIDesignToolBarGrip, GUIDesignViewSettingsComboBox1, MID_SIMSTEP, myAmInTrackingMode, myBeginOffset, myConditionMode, myDetectorMode, myGreenMode, myIndexMode, myTimeMode, myToolBar, myToolBarDrag, and TL.
Referenced by GUITLLogicPhasesTrackerWindow(), and GUITLLogicPhasesTrackerWindow().
|
private |
Definition at line 995 of file GUITLLogicPhasesTrackerWindow.cpp.
References MFXComboBoxIcon::getCurrentItem(), MAX2(), MIN2(), myBeginOffset, myConditionMode, myDetectorMode, myGreenMode, myIndexMode, myLastY, myTimeMode, and MFXComboBoxIcon::setCurrentItem().
Referenced by GUITLLogicPhasesTrackerWindow().
long GUITLLogicPhasesTrackerWindow::onConfigure | ( | FXObject * | sender, |
FXSelector | sel, | ||
void * | ptr | ||
) |
called on size change
Definition at line 951 of file GUITLLogicPhasesTrackerWindow.cpp.
References myPanel, and GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::onConfigure().
Referenced by FXDEFMAP().
long GUITLLogicPhasesTrackerWindow::onPaint | ( | FXObject * | sender, |
FXSelector | sel, | ||
void * | ptr | ||
) |
called if the widget shall be repainted
Definition at line 958 of file GUITLLogicPhasesTrackerWindow.cpp.
References myPanel, and GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::onPaint().
Referenced by FXDEFMAP(), and GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::onMouseMove().
long GUITLLogicPhasesTrackerWindow::onSimStep | ( | FXObject * | sender, |
FXSelector | sel, | ||
void * | ptr | ||
) |
called on a simulation step
Definition at line 965 of file GUITLLogicPhasesTrackerWindow.cpp.
References computeHeight(), myConditionMode, and myDetectorMode.
Referenced by FXDEFMAP().
|
private |
Definition at line 981 of file GUITLLogicPhasesTrackerWindow.cpp.
References MFXComboBoxIcon::getCurrentItem(), myBeginOffset, myConditionMode, myDetectorMode, myGreenMode, myIndexMode, and myTimeMode.
Referenced by ~GUITLLogicPhasesTrackerWindow().
void GUITLLogicPhasesTrackerWindow::setBeginTime | ( | SUMOTime | time | ) |
Sets the time the display shall be shown as beginning at.
[in] | time | The time to start to show the phases from |
Definition at line 975 of file GUITLLogicPhasesTrackerWindow.cpp.
References myBeginTime.
Referenced by GUITrafficLightLogicWrapper::showPhases().
|
private |
Information whether the tracking mode is on.
Definition at line 261 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by computeHeight(), drawValues(), initToolBar(), and ~GUITLLogicPhasesTrackerWindow().
|
private |
The main application.
Definition at line 200 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by GUITLLogicPhasesTrackerWindow(), GUITLLogicPhasesTrackerWindow(), and ~GUITLLogicPhasesTrackerWindow().
|
private |
The offset changer (tracking mode)
Definition at line 270 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues(), initToolBar(), loadSettings(), and saveSettings().
|
private |
The first time a phase was added at.
Definition at line 252 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by addValue(), drawAdditionalStates(), drawValues(), and setBeginTime().
|
private |
Definition at line 223 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by addValue(), and drawValues().
|
private |
Whether detector states are drawn.
Definition at line 285 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by computeHeight(), drawValues(), initToolBar(), loadSettings(), onSimStep(), and saveSettings().
|
private |
Definition at line 236 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues(), and GUITLLogicPhasesTrackerWindow().
|
private |
Definition at line 219 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by addValue(), and drawValues().
|
private |
The connector for retrieval of further phases.
Definition at line 258 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by GUITLLogicPhasesTrackerWindow(), GUITLLogicPhasesTrackerWindow(), and ~GUITLLogicPhasesTrackerWindow().
|
private |
The list of detector state durations.
Definition at line 222 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by addValue(), and drawValues().
|
private |
Whether detector states are drawn.
Definition at line 282 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by computeHeight(), drawValues(), initToolBar(), loadSettings(), onSimStep(), and saveSettings().
|
private |
Definition at line 235 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues(), and GUITLLogicPhasesTrackerWindow().
|
private |
The state of all used detectors of the current phase.
Definition at line 218 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by addValue(), and drawValues().
|
private |
The list of phase durations.
Definition at line 209 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by addValue(), drawValues(), and findTimeInCycle().
|
private |
Definition at line 241 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues().
|
private |
Definition at line 246 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues().
|
private |
Definition at line 240 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues().
|
private |
Definition at line 245 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues().
|
private |
The index of the first phase that fits into the window.
Definition at line 239 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues().
|
private |
The offset to draw the first phase (left offset)
Definition at line 244 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues().
|
private |
The time the diagram begins at.
Definition at line 249 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues().
|
private |
Whether green durations are printed.
Definition at line 276 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues(), initToolBar(), loadSettings(), and saveSettings().
|
private |
Whether phase names shall be printed instead of indices.
Definition at line 279 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues(), initToolBar(), loadSettings(), and saveSettings().
|
private |
The last time a phase was added at.
Definition at line 255 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by addValue(), drawAdditionalStates(), drawValues(), and findTimeInCycle().
|
staticprivate |
y-Position of previously opened window
Definition at line 288 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by loadSettings(), and ~GUITLLogicPhasesTrackerWindow().
|
private |
The names of links.
This holds an enumeration only - used to avoid time consuming string representation of ints
Definition at line 234 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues(), GUITLLogicPhasesTrackerWindow(), and GUITLLogicPhasesTrackerWindow().
|
private |
A lock to avoid addition of new values while drawing.
Definition at line 229 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by addValue(), drawValues(), and ~GUITLLogicPhasesTrackerWindow().
|
private |
The panel to draw on.
Definition at line 226 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by GUITLLogicPhasesTrackerWindow(), GUITLLogicPhasesTrackerWindow(), onConfigure(), and onPaint().
|
private |
The index of the current phase.
Definition at line 215 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by addValue(), and drawValues().
|
private |
The list of phases.
Definition at line 206 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by addValue(), drawValues(), and findTimeInCycle().
|
private |
The time within the cycle for the current phase.
Definition at line 212 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by addValue(), drawValues(), and findTimeInCycle().
|
private |
The time mode.
Definition at line 273 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by drawValues(), initToolBar(), loadSettings(), and saveSettings().
|
private |
The logic to display.
Definition at line 203 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by addValue(), computeHeight(), drawValues(), findTimeInCycle(), GUITLLogicPhasesTrackerWindow(), and GUITLLogicPhasesTrackerWindow().
|
private |
The tool bar (tracking mode)
Definition at line 267 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by initToolBar().
|
private |
The tool bar drag (tracking mode)
Definition at line 264 of file GUITLLogicPhasesTrackerWindow.h.
Referenced by create(), initToolBar(), and ~GUITLLogicPhasesTrackerWindow().