Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUITLLogicPhasesTrackerWindow Class Reference

This window displays a phase diagram for a chosen tl-logic. More...

#include <GUITLLogicPhasesTrackerWindow.h>

Inheritance diagram for GUITLLogicPhasesTrackerWindow:
[legend]
Collaboration diagram for GUITLLogicPhasesTrackerWindow:
[legend]

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< MSPhaseDefinitionPhasesVector
 }
 
typedef std::vector< SUMOTimeDurationsVector
 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.
 
GUIMainWindowmyApplication
 The main application.
 
MSTrafficLightLogicmyTLLogic
 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
 
GUITLLogicPhasesTrackerPanelmyPanel
 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)
 
MFXComboBoxIconmyTimeMode
 The time mode.
 
MFXComboBoxIconmyGreenMode
 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
 

Detailed Description

This window displays a phase diagram for a chosen tl-logic.

Definition at line 61 of file GUITLLogicPhasesTrackerWindow.h.

Member Typedef Documentation

◆ AdditionalStatesVector

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.

◆ DurationsVector

Definition of a storage for durations.

Definition at line 130 of file GUITLLogicPhasesTrackerWindow.h.

◆ IndexVector

Definition of a storage for indices.

Definition at line 133 of file GUITLLogicPhasesTrackerWindow.h.

◆ PhasesVector

}

Definition of a storage for phases

Definition at line 127 of file GUITLLogicPhasesTrackerWindow.h.

Constructor & Destructor Documentation

◆ GUITLLogicPhasesTrackerWindow() [1/3]

GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerWindow ( GUIMainWindow app,
MSTrafficLightLogic logic,
GUITrafficLightLogicWrapper wrapper,
ValueSource< std::pair< SUMOTime, MSPhaseDefinition > > *  src 
)

Constructor to track current phases.

Parameters
[in]appThe main application window
[in]logicThe logic to track
[in]wrapperThe tracked logic's wrapper
[in]srcThe 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() [2/3]

GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerWindow ( GUIMainWindow app,
MSTrafficLightLogic logic,
GUITrafficLightLogicWrapper wrapper,
const MSSimpleTrafficLightLogic::Phases phases 
)

Constructor to show the complete phase diagram.

Parameters
[in]appThe main application window
[in]logicThe logic to show
[in]wrapperThe shown logic's wrapper
[in]phasesThe 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::~GUITLLogicPhasesTrackerWindow ( )

◆ GUITLLogicPhasesTrackerWindow() [3/3]

GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerWindow ( )
inlineprotected

protected constructor for FOX

Definition at line 314 of file GUITLLogicPhasesTrackerWindow.h.

Member Function Documentation

◆ addValue()

◆ computeHeight()

int GUITLLogicPhasesTrackerWindow::computeHeight ( )
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().

Here is the caller graph for this function:

◆ create()

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().

Here is the caller graph for this function:

◆ drawAdditionalStates()

void GUITLLogicPhasesTrackerWindow::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 
)
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().

Here is the caller graph for this function:

◆ drawNames()

void GUITLLogicPhasesTrackerWindow::drawNames ( const std::vector< std::string > &  names,
double  fontHeight,
double  fontWidth,
double  divHeight,
double  divWidth,
double &  h,
int  extraLines 
)
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().

Here is the caller graph for this function:

◆ drawValues()

◆ findTimeInCycle()

SUMOTime GUITLLogicPhasesTrackerWindow::findTimeInCycle ( SUMOTime  t)
private

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().

Here is the caller graph for this function:

◆ initToolBar()

void GUITLLogicPhasesTrackerWindow::initToolBar ( )
private

Definition at line 247 of file GUITLLogicPhasesTrackerWindow.cpp.

References MFXComboBoxIcon::appendIconItem(), GUIDesignComboBoxVisibleItems, GUIDesignToolBar, GUIDesignToolBarGrip, GUIDesignViewSettingsComboBox1, MID_SIMSTEP, myAmInTrackingMode, myBeginOffset, myConditionMode, myDetectorMode, myGreenMode, myIndexMode, myTimeMode, myToolBar, myToolBarDrag, and TL.

Referenced by GUITLLogicPhasesTrackerWindow(), and GUITLLogicPhasesTrackerWindow().

Here is the caller graph for this function:

◆ loadSettings()

void GUITLLogicPhasesTrackerWindow::loadSettings ( )
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().

Here is the caller graph for this function:

◆ onConfigure()

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().

Here is the caller graph for this function:

◆ onPaint()

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().

Here is the caller graph for this function:

◆ onSimStep()

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().

Here is the caller graph for this function:

◆ saveSettings()

void GUITLLogicPhasesTrackerWindow::saveSettings ( )
private

Definition at line 981 of file GUITLLogicPhasesTrackerWindow.cpp.

References MFXComboBoxIcon::getCurrentItem(), myBeginOffset, myConditionMode, myDetectorMode, myGreenMode, myIndexMode, and myTimeMode.

Referenced by ~GUITLLogicPhasesTrackerWindow().

Here is the caller graph for this function:

◆ setBeginTime()

void GUITLLogicPhasesTrackerWindow::setBeginTime ( SUMOTime  time)

Sets the time the display shall be shown as beginning at.

Parameters
[in]timeThe time to start to show the phases from

Definition at line 975 of file GUITLLogicPhasesTrackerWindow.cpp.

References myBeginTime.

Referenced by GUITrafficLightLogicWrapper::showPhases().

Here is the caller graph for this function:

Field Documentation

◆ myAmInTrackingMode

bool GUITLLogicPhasesTrackerWindow::myAmInTrackingMode
private

Information whether the tracking mode is on.

Definition at line 261 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by computeHeight(), drawValues(), initToolBar(), and ~GUITLLogicPhasesTrackerWindow().

◆ myApplication

GUIMainWindow* GUITLLogicPhasesTrackerWindow::myApplication
private

◆ myBeginOffset

FXRealSpinner* GUITLLogicPhasesTrackerWindow::myBeginOffset
private

The offset changer (tracking mode)

Definition at line 270 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by drawValues(), initToolBar(), loadSettings(), and saveSettings().

◆ myBeginTime

SUMOTime GUITLLogicPhasesTrackerWindow::myBeginTime
private

The first time a phase was added at.

Definition at line 252 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by addValue(), drawAdditionalStates(), drawValues(), and setBeginTime().

◆ myConditionDurations

DurationsVector GUITLLogicPhasesTrackerWindow::myConditionDurations
private

Definition at line 223 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by addValue(), and drawValues().

◆ myConditionMode

FXCheckButton* GUITLLogicPhasesTrackerWindow::myConditionMode
private

Whether detector states are drawn.

Definition at line 285 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by computeHeight(), drawValues(), initToolBar(), loadSettings(), onSimStep(), and saveSettings().

◆ myConditionNames

std::vector<std::string> GUITLLogicPhasesTrackerWindow::myConditionNames
private

Definition at line 236 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by drawValues(), and GUITLLogicPhasesTrackerWindow().

◆ myConditionStates

AdditionalStatesVector GUITLLogicPhasesTrackerWindow::myConditionStates
private

Definition at line 219 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by addValue(), and drawValues().

◆ myConnector

GLObjectValuePassConnector<std::pair<SUMOTime, MSPhaseDefinition> >* GUITLLogicPhasesTrackerWindow::myConnector
private

The connector for retrieval of further phases.

Definition at line 258 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by GUITLLogicPhasesTrackerWindow(), GUITLLogicPhasesTrackerWindow(), and ~GUITLLogicPhasesTrackerWindow().

◆ myDetectorDurations

DurationsVector GUITLLogicPhasesTrackerWindow::myDetectorDurations
private

The list of detector state durations.

Definition at line 222 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by addValue(), and drawValues().

◆ myDetectorMode

FXCheckButton* GUITLLogicPhasesTrackerWindow::myDetectorMode
private

Whether detector states are drawn.

Definition at line 282 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by computeHeight(), drawValues(), initToolBar(), loadSettings(), onSimStep(), and saveSettings().

◆ myDetectorNames

std::vector<std::string> GUITLLogicPhasesTrackerWindow::myDetectorNames
private

Definition at line 235 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by drawValues(), and GUITLLogicPhasesTrackerWindow().

◆ myDetectorStates

AdditionalStatesVector GUITLLogicPhasesTrackerWindow::myDetectorStates
private

The state of all used detectors of the current phase.

Definition at line 218 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by addValue(), and drawValues().

◆ myDurations

DurationsVector GUITLLogicPhasesTrackerWindow::myDurations
private

The list of phase durations.

Definition at line 209 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by addValue(), drawValues(), and findTimeInCycle().

◆ myFirstCond2Show

int GUITLLogicPhasesTrackerWindow::myFirstCond2Show
private

Definition at line 241 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by drawValues().

◆ myFirstCondOffset

SUMOTime GUITLLogicPhasesTrackerWindow::myFirstCondOffset
private

Definition at line 246 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by drawValues().

◆ myFirstDet2Show

int GUITLLogicPhasesTrackerWindow::myFirstDet2Show
private

Definition at line 240 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by drawValues().

◆ myFirstDetOffset

SUMOTime GUITLLogicPhasesTrackerWindow::myFirstDetOffset
private

Definition at line 245 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by drawValues().

◆ myFirstPhase2Show

int GUITLLogicPhasesTrackerWindow::myFirstPhase2Show
private

The index of the first phase that fits into the window.

Definition at line 239 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by drawValues().

◆ myFirstPhaseOffset

SUMOTime GUITLLogicPhasesTrackerWindow::myFirstPhaseOffset
private

The offset to draw the first phase (left offset)

Definition at line 244 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by drawValues().

◆ myFirstTime2Show

SUMOTime GUITLLogicPhasesTrackerWindow::myFirstTime2Show
private

The time the diagram begins at.

Definition at line 249 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by drawValues().

◆ myGreenMode

MFXComboBoxIcon* GUITLLogicPhasesTrackerWindow::myGreenMode
private

Whether green durations are printed.

Definition at line 276 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by drawValues(), initToolBar(), loadSettings(), and saveSettings().

◆ myIndexMode

FXCheckButton* GUITLLogicPhasesTrackerWindow::myIndexMode
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().

◆ myLastTime

SUMOTime GUITLLogicPhasesTrackerWindow::myLastTime
private

The last time a phase was added at.

Definition at line 255 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by addValue(), drawAdditionalStates(), drawValues(), and findTimeInCycle().

◆ myLastY

int GUITLLogicPhasesTrackerWindow::myLastY
staticprivate

y-Position of previously opened window

Definition at line 288 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by loadSettings(), and ~GUITLLogicPhasesTrackerWindow().

◆ myLinkNames

std::vector<std::string> GUITLLogicPhasesTrackerWindow::myLinkNames
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().

◆ myLock

FXMutex GUITLLogicPhasesTrackerWindow::myLock
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().

◆ myPanel

GUITLLogicPhasesTrackerPanel* GUITLLogicPhasesTrackerWindow::myPanel
private

The panel to draw on.

Definition at line 226 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by GUITLLogicPhasesTrackerWindow(), GUITLLogicPhasesTrackerWindow(), onConfigure(), and onPaint().

◆ myPhaseIndex

IndexVector GUITLLogicPhasesTrackerWindow::myPhaseIndex
private

The index of the current phase.

Definition at line 215 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by addValue(), and drawValues().

◆ myPhases

PhasesVector GUITLLogicPhasesTrackerWindow::myPhases
private

The list of phases.

Definition at line 206 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by addValue(), drawValues(), and findTimeInCycle().

◆ myTimeInCycle

DurationsVector GUITLLogicPhasesTrackerWindow::myTimeInCycle
private

The time within the cycle for the current phase.

Definition at line 212 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by addValue(), drawValues(), and findTimeInCycle().

◆ myTimeMode

MFXComboBoxIcon* GUITLLogicPhasesTrackerWindow::myTimeMode
private

The time mode.

Definition at line 273 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by drawValues(), initToolBar(), loadSettings(), and saveSettings().

◆ myTLLogic

MSTrafficLightLogic* GUITLLogicPhasesTrackerWindow::myTLLogic
private

◆ myToolBar

FXToolBar* GUITLLogicPhasesTrackerWindow::myToolBar
private

The tool bar (tracking mode)

Definition at line 267 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by initToolBar().

◆ myToolBarDrag

FXToolBarShell* GUITLLogicPhasesTrackerWindow::myToolBarDrag
private

The tool bar drag (tracking mode)

Definition at line 264 of file GUITLLogicPhasesTrackerWindow.h.

Referenced by create(), initToolBar(), and ~GUITLLogicPhasesTrackerWindow().


The documentation for this class was generated from the following files: