GUITrafficLightLogicWrapper Class Reference

#include <GUITrafficLightLogicWrapper.h>

Inheritance diagram for GUITrafficLightLogicWrapper:

GUIGlObject

Detailed Description

This class is responsible for the visualisation of tl-logics and the interaction with them.

Definition at line 53 of file GUITrafficLightLogicWrapper.h.


Public Member Functions

virtual bool active () const throw ()
 Returns the information whether this object is still active.
void begin2TrackPhases ()
 Builds a GUITLLogicPhasesTrackerWindow which will receive new phases.
int getLinkIndex (const MSLink *const link) const
 Returns the index of the given link within the according tls.
 GUITrafficLightLogicWrapper (GUIGlObjectStorage &idStorage, MSTLLogicControl &control, MSTrafficLightLogic &tll) throw ()
 Constructor.
void showPhases ()
 Builds a GUITLLogicPhasesTrackerWindow which displays the phase diagram.
void switchTLSLogic (int to)
 Builds a GUITLLogicPhasesTrackerWindow which displays the phase diagram.
 ~GUITrafficLightLogicWrapper () throw ()
 Destructor.
inherited from GUIGlObject
void drawGL (const GUIVisualizationSettings &s) const throw ()
 Draws the object.
Boundary getCenteringBoundary () const throw ()
 Returns the boundary to which the view shall be centered in order to show the object.
const std::string & getMicrosimID () const throw ()
 Returns the id of the object as known to microsim.
GUIParameterTableWindowgetParameterWindow (GUIMainWindow &app, GUISUMOAbstractView &parent) throw ()
 Returns an own parameter window.
GUIGLObjectPopupMenugetPopUpMenu (GUIMainWindow &app, GUISUMOAbstractView &parent) throw ()
 Returns an own popup-menu.
GUIGlObjectType getType () const throw ()
 Returns the type of the object as coded in GUIGlObjectType.
Atomar getter methods
const std::string & getFullName () const throw ()
 Returns the full name appearing in the tool tip.
GLuint getGlID () const throw ()
 Returns the numerical id of the object.

Protected Member Functions

helper methods for building popup-menus
void buildCenterPopupEntry (GUIGLObjectPopupMenu *ret, bool addSeparator=true) throw ()
 Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry (GUIGLObjectPopupMenu *ret, bool addSeparator=true) throw ()
 Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader (GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true) throw ()
 Builds the header.
void buildPositionCopyEntry (GUIGLObjectPopupMenu *ret, bool addSeparator=true) throw ()
 Builds an entry which allows to copy the cursor position.
void buildSelectionPopupEntry (GUIGLObjectPopupMenu *ret, bool addSeparator=true) throw ()
 Builds an entry which allows to (de)select the object.
void buildShowManipulatorPopupEntry (GUIGLObjectPopupMenu *ret, bool addSeparator=true) throw ()
 Builds an entry which allows to open the manipulator window.
void buildShowParamsPopupEntry (GUIGLObjectPopupMenu *ret, bool addSeparator=true) throw ()
 Builds an entry which allows to open the parameter window.

Private Attributes

GUIMainWindowmyApp
 The main application.
MSTrafficLightLogicmyTLLogic
 The wrapped tl-logic.
MSTLLogicControlmyTLLogicControl
 Reference to the according tls.

Friends

class GUIGlObjectStorage
 Needed to set the id.

Data Structures

class  GUITrafficLightLogicWrapperPopupMenu

Constructor & Destructor Documentation

GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapper ( GUIGlObjectStorage idStorage,
MSTLLogicControl control,
MSTrafficLightLogic tll 
) throw ()

Constructor.

Definition at line 124 of file GUITrafficLightLogicWrapper.cpp.

00127         : GUIGlObject(idStorage, "tl-logic:"+tll.getID()),
00128         myTLLogicControl(control), myTLLogic(tll) {}

GUITrafficLightLogicWrapper::~GUITrafficLightLogicWrapper (  )  throw ()

Destructor.

Definition at line 131 of file GUITrafficLightLogicWrapper.cpp.

00131 {}


Member Function Documentation

virtual bool GUIGlObject::active (  )  const throw () [inline, virtual, inherited]

Returns the information whether this object is still active.

Returns:
Whether this object is active (always true in this case)

Reimplemented in GUIVehicle.

Definition at line 171 of file GUIGlObject.h.

Referenced by GLObjectValuePassConnector< std::pair< int, MSPhaseDefinition > >::updateEachTimestep().

00171                                         {
00172         return true;
00173     }

void GUITrafficLightLogicWrapper::begin2TrackPhases (  ) 

void GUIGlObject::buildCenterPopupEntry ( GUIGLObjectPopupMenu ret,
bool  addSeparator = true 
) throw () [protected, inherited]

Builds an entry which allows to center to the object.

Parameters:
in,filled] ret The popup menu to add the entry to
[in] app The application, needed for callbacks
[in] addSeparator Whether a separator shall be added, too

Definition at line 86 of file GUIGlObject.cpp.

References GUIIconSubSys::getIcon(), ICON_RECENTERVIEW, and MID_CENTER.

Referenced by GUIVehicle::getPopUpMenu(), GUITriggeredRerouter::getPopUpMenu(), getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUINet::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), GUIEmitter::getPopUpMenu(), GUIEdge::getPopUpMenu(), GUIDetectorWrapper::getPopUpMenu(), and GUIBusStop::getPopUpMenu().

00087                                                               {
00088     new FXMenuCommand(ret, "Center", GUIIconSubSys::getIcon(ICON_RECENTERVIEW), ret, MID_CENTER);
00089     if (addSeparator) {
00090         new FXMenuSeparator(ret);
00091     }
00092 }

void GUIGlObject::buildNameCopyPopupEntry ( GUIGLObjectPopupMenu ret,
bool  addSeparator = true 
) throw () [protected, inherited]

Builds entries which allow to copy the name / typed name into the clipboard.

Parameters:
in,filled] ret The popup menu to add the entry to
[in] app The application, needed for callbacks
[in] addSeparator Whether a separator shall be added, too

Definition at line 96 of file GUIGlObject.cpp.

References MID_COPY_NAME, and MID_COPY_TYPED_NAME.

Referenced by GUIVehicle::getPopUpMenu(), GUITriggeredRerouter::getPopUpMenu(), getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), GUIEmitter::getPopUpMenu(), GUIEdge::getPopUpMenu(), GUIDetectorWrapper::getPopUpMenu(), and GUIBusStop::getPopUpMenu().

00097                                                                 {
00098     new FXMenuCommand(ret, "Copy name to clipboard", 0, ret, MID_COPY_NAME);
00099     new FXMenuCommand(ret, "Copy typed name to clipboard", 0, ret, MID_COPY_TYPED_NAME);
00100     if (addSeparator) {
00101         new FXMenuSeparator(ret);
00102     }
00103 }

void GUIGlObject::buildPopupHeader ( GUIGLObjectPopupMenu ret,
GUIMainWindow app,
bool  addSeparator = true 
) throw () [protected, inherited]

Builds the header.

Parameters:
in,filled] ret The popup menu to add the entry to
[in] app The application, needed for callbacks
[in] addSeparator Whether a separator shall be added, too

Definition at line 75 of file GUIGlObject.cpp.

References GUIGlObject::getFullName().

Referenced by GUIVehicle::getPopUpMenu(), GUITriggeredRerouter::getPopUpMenu(), getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUINet::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), GUIEmitter::getPopUpMenu(), GUIEdge::getPopUpMenu(), GUIDetectorWrapper::getPopUpMenu(), and GUIBusStop::getPopUpMenu().

00077                                                          {
00078     new MFXMenuHeader(ret, app.getBoldFont(), getFullName().c_str(), 0, 0, 0);
00079     if (addSeparator) {
00080         new FXMenuSeparator(ret);
00081     }
00082 }

void GUIGlObject::buildPositionCopyEntry ( GUIGLObjectPopupMenu ret,
bool  addSeparator = true 
) throw () [protected, inherited]

Builds an entry which allows to copy the cursor position.

Parameters:
in,filled] ret The popup menu to add the entry to
[in] app The application, needed for callbacks
[in] addSeparator Whether a separator shall be added, too

Definition at line 131 of file GUIGlObject.cpp.

References MID_COPY_CURSOR_POSITION.

Referenced by GUIVehicle::getPopUpMenu(), GUITriggeredRerouter::getPopUpMenu(), getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUINet::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), GUIEmitter::getPopUpMenu(), GUIEdge::getPopUpMenu(), GUIDetectorWrapper::getPopUpMenu(), and GUIBusStop::getPopUpMenu().

00132                                                                {
00133     new FXMenuCommand(ret, "Copy cursor position to clipboard", 0, ret, MID_COPY_CURSOR_POSITION);
00134     if (addSeparator) {
00135         new FXMenuSeparator(ret);
00136     }
00137 }

void GUIGlObject::buildSelectionPopupEntry ( GUIGLObjectPopupMenu ret,
bool  addSeparator = true 
) throw () [protected, inherited]

Builds an entry which allows to (de)select the object.

Parameters:
in,filled] ret The popup menu to add the entry to
[in] app The application, needed for callbacks
[in] addSeparator Whether a separator shall be added, too

Definition at line 107 of file GUIGlObject.cpp.

References GUIGlObject::getGlID(), GUIIconSubSys::getIcon(), GUIGlObject::getType(), gSelected, ICON_FLAG_MINUS, ICON_FLAG_PLUS, GUISelectedStorage::isSelected(), MID_ADDSELECT, and MID_REMOVESELECT.

Referenced by GUIVehicle::getPopUpMenu(), GUITriggeredRerouter::getPopUpMenu(), getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), GUIEmitter::getPopUpMenu(), GUIEdge::getPopUpMenu(), GUIDetectorWrapper::getPopUpMenu(), and GUIBusStop::getPopUpMenu().

00108                                                                  {
00109     if (gSelected.isSelected(getType(), getGlID())) {
00110         new FXMenuCommand(ret, "Remove From Selected", GUIIconSubSys::getIcon(ICON_FLAG_MINUS), ret, MID_REMOVESELECT);
00111     } else {
00112         new FXMenuCommand(ret, "Add To Selected", GUIIconSubSys::getIcon(ICON_FLAG_PLUS), ret, MID_ADDSELECT);
00113     }
00114     if (addSeparator) {
00115         new FXMenuSeparator(ret);
00116     }
00117 }

void GUIGlObject::buildShowManipulatorPopupEntry ( GUIGLObjectPopupMenu ret,
bool  addSeparator = true 
) throw () [protected, inherited]

Builds an entry which allows to open the manipulator window.

Parameters:
in,filled] ret The popup menu to add the entry to
[in] app The application, needed for callbacks
[in] addSeparator Whether a separator shall be added, too

Definition at line 141 of file GUIGlObject.cpp.

References GUIIconSubSys::getIcon(), ICON_MANIP, and MID_MANIP.

Referenced by GUITriggeredRerouter::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), and GUIEmitter::getPopUpMenu().

00142                                    {
00143     new FXMenuCommand(ret, "Open Manipulator...",
00144                       GUIIconSubSys::getIcon(ICON_MANIP), ret, MID_MANIP);
00145     if (addSeparator) {
00146         new FXMenuSeparator(ret);
00147     }
00148 }

void GUIGlObject::buildShowParamsPopupEntry ( GUIGLObjectPopupMenu ret,
bool  addSeparator = true 
) throw () [protected, inherited]

Builds an entry which allows to open the parameter window.

Parameters:
in,filled] ret The popup menu to add the entry to
[in] app The application, needed for callbacks
[in] addSeparator Whether a separator shall be added, too

Definition at line 121 of file GUIGlObject.cpp.

References GUIIconSubSys::getIcon(), ICON_APP_TABLE, and MID_SHOWPARS.

Referenced by GUIVehicle::getPopUpMenu(), GUINet::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIEdge::getPopUpMenu(), and GUIDetectorWrapper::getPopUpMenu().

00122                                                                   {
00123     new FXMenuCommand(ret, "Show Parameter", GUIIconSubSys::getIcon(ICON_APP_TABLE), ret, MID_SHOWPARS);
00124     if (addSeparator) {
00125         new FXMenuSeparator(ret);
00126     }
00127 }

void GUITrafficLightLogicWrapper::drawGL ( const GUIVisualizationSettings s  )  const throw () [virtual]

Draws the object.

Parameters:
[in] s The settings for the current view (may influence drawing)
See also:
GUIGlObject::drawGL

Implements GUIGlObject.

Definition at line 236 of file GUITrafficLightLogicWrapper.cpp.

00236                                                                                    {
00237 }

Boundary GUITrafficLightLogicWrapper::getCenteringBoundary (  )  const throw () [virtual]

Returns the boundary to which the view shall be centered in order to show the object.

Returns:
The boundary the object is within
See also:
GUIGlObject::getCenteringBoundary

Implements GUIGlObject.

Definition at line 203 of file GUITrafficLightLogicWrapper.cpp.

References Boundary::add(), MSTrafficLightLogic::getLanes(), Boundary::grow(), and myTLLogic.

00203                                                                 {
00204     Boundary ret;
00205     const MSTrafficLightLogic::LaneVectorVector &lanes = myTLLogic.getLanes();
00206     for (MSTrafficLightLogic::LaneVectorVector::const_iterator i=lanes.begin(); i!=lanes.end(); ++i) {
00207         const MSTrafficLightLogic::LaneVector &lanes2 = (*i);
00208         for (MSTrafficLightLogic::LaneVector::const_iterator j=lanes2.begin(); j!=lanes2.end(); ++j) {
00209             ret.add((*j)->getShape()[-1]);
00210         }
00211     }
00212     ret.grow(20);
00213     return ret;
00214 }

const std::string& GUIGlObject::getFullName (  )  const throw () [inline, inherited]

GLuint GUIGlObject::getGlID (  )  const throw () [inline, inherited]

int GUITrafficLightLogicWrapper::getLinkIndex ( const MSLink *const   link  )  const

Returns the index of the given link within the according tls.

Definition at line 230 of file GUITrafficLightLogicWrapper.cpp.

References MSTrafficLightLogic::getLinkIndex(), and myTLLogic.

00230                                                                          {
00231     return myTLLogic.getLinkIndex(link);
00232 }

const std::string & GUITrafficLightLogicWrapper::getMicrosimID (  )  const throw () [virtual]

Returns the id of the object as known to microsim.

Returns:
The id of the tls logic
See also:
GUIGlObject::getMicrosimID

Implements GUIGlObject.

Definition at line 197 of file GUITrafficLightLogicWrapper.cpp.

References MSTrafficLightLogic::getID(), and myTLLogic.

00197                                                          {
00198     return myTLLogic.getID();
00199 }

GUIParameterTableWindow * GUITrafficLightLogicWrapper::getParameterWindow ( GUIMainWindow app,
GUISUMOAbstractView parent 
) throw () [virtual]

Returns an own parameter window.

Parameters:
[in] app The application needed to build the parameter window
[in] parent The parent window needed to build the parameter window
Returns:
The built parameter window
See also:
GUIGlObject::getParameterWindow

Implements GUIGlObject.

Definition at line 190 of file GUITrafficLightLogicWrapper.cpp.

00191                                        {
00192     return 0;
00193 }

GUIGLObjectPopupMenu * GUITrafficLightLogicWrapper::getPopUpMenu ( GUIMainWindow app,
GUISUMOAbstractView parent 
) throw () [virtual]

Returns an own popup-menu.

Parameters:
[in] app The application needed to build the popup-menu
[in] parent The parent window needed to build the popup-menu
Returns:
The built popup-menu
See also:
GUIGlObject::getPopUpMenu

Implements GUIGlObject.

Definition at line 135 of file GUITrafficLightLogicWrapper.cpp.

References GUIGlObject::buildCenterPopupEntry(), GUIGlObject::buildNameCopyPopupEntry(), GUIGlObject::buildPopupHeader(), GUIGlObject::buildPositionCopyEntry(), GUIGlObject::buildSelectionPopupEntry(), MSTLLogicControl::get(), MSTLLogicControl::TLSLogicVariants::getAllLogics(), GUIIconSubSys::getIcon(), MSTrafficLightLogic::getID(), ICON_FLAG_MINUS, MSTLLogicControl::TLSLogicVariants::isActive(), MID_SHOWPHASES, MID_SWITCH, MID_SWITCH_OFF, MID_TRACKPHASES, myApp, myTLLogic, and myTLLogicControl.

00136                                              {
00137     myApp = &app;
00138     GUIGLObjectPopupMenu *ret = new GUITrafficLightLogicWrapperPopupMenu(app, parent, *this);
00139     buildPopupHeader(ret, app);
00140     buildCenterPopupEntry(ret);
00141     //
00142     const MSTLLogicControl::TLSLogicVariants &vars = myTLLogicControl.get(myTLLogic.getID());
00143     std::vector<MSTrafficLightLogic*> logics = vars.getAllLogics();
00144     if (logics.size()>1) {
00145         std::vector<MSTrafficLightLogic*>::const_iterator i;
00146         size_t index = 0;
00147         for (i=logics.begin(); i!=logics.end(); ++i, ++index) {
00148             if (!vars.isActive(*i)) {
00149                 new FXMenuCommand(ret, ("Switch to '" + (*i)->getSubID() + "'").c_str(),
00150                                   GUIIconSubSys::getIcon(ICON_FLAG_MINUS), ret, (FXSelector)(MID_SWITCH+index));
00151             }
00152         }
00153         new FXMenuSeparator(ret);
00154     }
00155     new FXMenuCommand(ret, "Switch off", GUIIconSubSys::getIcon(ICON_FLAG_MINUS), ret, MID_SWITCH_OFF);
00156     new FXMenuCommand(ret, "Track Phases", 0, ret, MID_TRACKPHASES);
00157     new FXMenuCommand(ret, "Show Phases", 0, ret, MID_SHOWPHASES);
00158     new FXMenuSeparator(ret);
00159     //
00160     buildNameCopyPopupEntry(ret);
00161     buildSelectionPopupEntry(ret);
00162     buildPositionCopyEntry(ret, false);
00163     return ret;
00164 }

GUIGlObjectType GUITrafficLightLogicWrapper::getType (  )  const throw () [inline, virtual]

Returns the type of the object as coded in GUIGlObjectType.

Returns:
GLO_TLLOGIC (is a tls logic)
See also:
GUIGlObject::getType

GUIGlObjectType

Implements GUIGlObject.

Definition at line 103 of file GUITrafficLightLogicWrapper.h.

References GLO_TLLOGIC.

00103                                             {
00104         return GLO_TLLOGIC;
00105     }

void GUITrafficLightLogicWrapper::showPhases (  ) 

Builds a GUITLLogicPhasesTrackerWindow which displays the phase diagram.

Definition at line 179 of file GUITrafficLightLogicWrapper.cpp.

References GUITLLogicPhasesTrackerWindow::create(), GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerWindow(), myApp, myTLLogic, and GUITLLogicPhasesTrackerWindow::setBeginTime().

Referenced by GUITrafficLightLogicWrapper::GUITrafficLightLogicWrapperPopupMenu::onCmdShowPhases().

00179                                         {
00180     GUITLLogicPhasesTrackerWindow *window =
00181         new GUITLLogicPhasesTrackerWindow(*myApp, myTLLogic, *this,
00182                                           static_cast<MSSimpleTrafficLightLogic&>(myTLLogic).getPhases());
00183     window->setBeginTime(0);
00184     window->create();
00185     window->show();
00186 }

void GUITrafficLightLogicWrapper::switchTLSLogic ( int  to  ) 


Friends And Related Function Documentation

friend class GUIGlObjectStorage [friend, inherited]

Needed to set the id.

Reimplemented in GUI_E2_ZS_CollectorOverLanes::MyWrapper.

Definition at line 111 of file GUIGlObject.h.


Field Documentation

The main application.

Definition at line 176 of file GUITrafficLightLogicWrapper.h.

Referenced by begin2TrackPhases(), getPopUpMenu(), and showPhases().

Reference to the according tls.

Definition at line 170 of file GUITrafficLightLogicWrapper.h.

Referenced by getPopUpMenu(), and switchTLSLogic().


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

Generated on Wed May 5 00:06:45 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6