GUIEdge Class Reference

#include <GUIEdge.h>

Inheritance diagram for GUIEdge:

MSEdge GUIGlObject

Detailed Description

A road/street connecting two junctions (gui-version).

See also:
MSEdge

Definition at line 67 of file GUIEdge.h.


Static edge container

typedef std::map< std::string,
MSEdge * > 
DictType
 definition of the static dictionary type
static DictType myDict
 Static dictionary to associate string-ids with objects.
static std::vector< MSEdge * > myEdges
 Static list of edges.

Public Types

typedef std::map< const MSEdge
*, std::vector< MSLane * > * > 
AllowedLanesCont
 Suceeding edges (keys) and allowed lanes to reach these edges (values).
typedef std::map
< SUMOVehicleClass,
AllowedLanesCont
ClassedAllowedLanesCont
 Map from vehicle types to lanes that may be used to reach one of the next edges.
enum  EdgeBasicFunction {
  EDGEFUNCTION_UNKNOWN = -1, EDGEFUNCTION_NORMAL = 0, EDGEFUNCTION_CONNECTOR = 1, EDGEFUNCTION_INTERNAL = 2,
  EDGEFUNCTION_DISTRICT = 3
}
 Defines possible edge types. More...

Public Member Functions

virtual bool active () const throw ()
 Returns the information whether this object is still active.
virtual void changeLanes (SUMOTime t) throw ()
 Performs lane changing on this edge.
void closeBuilding ()
Boundary getBoundary () const
 Returns the street's geometry.
SUMOReal getCurrentTravelTime () const throw ()
 Computes and returns the current travel time for this edge.
MSLanegetLane (size_t laneNo)
 returns the enumerated lane (!!! why not private with a friend?)
GUILaneWrappergetLaneGeometry (const MSLane *lane) const
GUILaneWrappergetLaneGeometry (size_t laneNo) const
 returns the enumerated lane's geometry (!!! why not private with a friend?)
 GUIEdge (const std::string &id, unsigned int numericalID, GUIGlObjectStorage &idStorage) throw ()
 Constructor.
void initGeometry (GUIGlObjectStorage &idStorage) throw ()
 Builds lane wrappers for this edge's lanes.
void initialize (MSLane *departLane, std::vector< MSLane * > *lanes, EdgeBasicFunction function) throw ()
 Initialize the edge.
bool prohibits (const SUMOVehicle *const vehicle) const throw ()
 Returns whether the vehicle (class) is not allowed on the edge.
void rebuildAllowedLanes () throw ()
 ~GUIEdge () throw ()
 Destructor.
Access to succeeding/predecessing edges
void addFollower (MSEdge *edge) throw ()
 Returns the list of edges which may be reached from this edge.
const MSEdge *const getFollower (unsigned int n) const throw ()
 Returns the n-th of the following edges.
const std::vector< MSEdge * > & getIncomingEdges () const throw ()
 Returns the list of edges from which this edge may be reached.
unsigned int getNoFollowing () const throw ()
 Returns the number of edges that may be reached from this edge.
Access to the edge's lanes
const std::vector< MSLane * > * allowedLanes (SUMOVehicleClass vclass=SVC_UNKNOWN) const throw ()
 Get the allowed lanes for the given vehicle class.
const std::vector< MSLane * > * allowedLanes (const MSEdge &destination, SUMOVehicleClass vclass=SVC_UNKNOWN) const throw ()
 Get the allowed lanes to reach the destination-edge.
const std::vector< MSLane * > & getLanes () const throw ()
 Returns this edge's lanes.
MSLane *const leftLane (const MSLane *const lane) const throw ()
 Returns the lane left to the one given, 0 if the given lane is leftmost.
MSLane *const rightLane (const MSLane *const lane) const throw ()
 Returns the lane right to the one given, 0 if the given lane is rightmost.
Access to vaporizing interface
SUMOTime decVaporization (SUMOTime t) throw (ProcessError)
 Disables vaporization.
SUMOTime incVaporization (SUMOTime t) throw (ProcessError)
 Enables vaporization.
bool isVaporizing () const throw ()
 Returns whether vehicles on this edge shall be vaporized.
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.
virtual GUIParameterTableWindowgetParameterWindow (GUIMainWindow &app, GUISUMOAbstractView &parent) throw ()
 Returns an own parameter window.
virtual 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.
Methods releated to vehicle emission
bool emit (MSVehicle &v, SUMOTime time) const throw (ProcessError)
 Emits the given vehicle.
MSLanegetDepartLane (const MSVehicle &v) const throw ()
 Finds a depart lane for the given vehicle.
MSLanegetFreeLane (const SUMOVehicleClass vclass) const throw ()
 Finds the emptiest lane allowing the vehicle class.
SUMOTime getLastFailedEmissionTime () const throw ()
 Returns the last time a vehicle could not be inserted.
void setLastFailedEmissionTime (SUMOTime time) const throw ()
 Sets the last time a vehicle could not be inserted.
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.
Access to other edge attributes
const std::string & getID () const throw ()
 Returns the id of the edge.
unsigned int getNumericalID () const throw ()
 Returns the numerical id of the edge.
EdgeBasicFunction getPurpose () const throw ()
 Returns the edge type (EdgeBasicFunction).

Static Public Member Functions

static void clear () throw ()
 Clears the dictionary.
static MSEdgedictionary (size_t index) throw ()
 Returns the MSEdge at the index.
static MSEdgedictionary (const std::string &id) throw ()
 Returns the MSEdge associated to the key id if exists, otherwise returns 0.
static bool dictionary (const std::string &id, MSEdge *edge) throw ()
 Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary. Otherwise returns false.
static size_t dictSize () throw ()
 Returns the number of edges.
static void fill (std::vector< GUIEdge * > &netsWrappers)
static std::vector< GLuint > getIDs ()
static std::pair< SUMOReal,
SUMOReal > 
getLaneOffsets (SUMOReal x1, SUMOReal y1, SUMOReal x2, SUMOReal y2, SUMOReal prev, SUMOReal wanted)
static void insertIDs (std::vector< std::string > &into) throw ()
 Inserts IDs of all known edges into the given vector.
Static parser helper
static void parseEdgesList (const std::vector< std::string > &desc, std::vector< const MSEdge * > &into, const std::string &rid) throw (ProcessError)
 Parses the given string vector assuming it edge ids.
static void parseEdgesList (const std::string &desc, std::vector< const MSEdge * > &into, const std::string &rid) throw (ProcessError)
 Parses the given string assuming it contains a list of edge ids divided by spaces.

Protected Member Functions

const std::vector< MSLane * > * allowedLanes (const MSEdge *destination, SUMOVehicleClass vclass=SVC_UNKNOWN) const throw ()
 Get the allowed lanes to reach the destination-edge.
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.

Protected Attributes

MSLanemyDepartLane
 Lane from which vehicles will depart, usually the rightmost.
EdgeBasicFunction myFunction
 the purpose of the edge
std::string myID
 Unique ID.
MSLaneChangermyLaneChanger
 This member will do the lane-change.
std::vector< MSLane * > * myLanes
 Container for the edge's lane; should be sorted: (right-hand-traffic) the more left the lane, the higher the container-index.
SUMOTime myLastFailedEmissionTime
 The time of last emission failure.
unsigned int myNumericalID
 This edge's numerical id.
std::vector< MSEdge * > myPredeccesors
 The preceeding edges.
std::vector< MSEdge * > mySuccessors
 The succeeding edges.
int myVaporizationRequests
 Vaporizer counter.
Storages for allowed lanes (depending on vehicle classes)
AllowedLanesCont myAllowed
 Associative container from destination-edge to allowed-lanes.
ClassedAllowedLanesCont myClassedAllowed
 From vehicle class to lanes allowed to be used by it.
bool myHaveClassConstraints
 Whether any class constraints exist for this edge.

Private Types

typedef std::vector
< GUILaneWrapper * > 
LaneWrapperVector
 Definition of the lane's positions vector.

Private Member Functions

 GUIEdge (const GUIEdge &s)
 invalidated copy constructor
GUIEdgeoperator= (const GUIEdge &s)
 invalidated assignment operator

Private Attributes

LaneWrapperVector myLaneGeoms
 List of the edge's lanes geometrical information.

Friends

class GUIGlObjectStorage
 Needed to set the id.

Data Structures

class  lane_wrapper_finder
 A class to find the matching lane wrapper. More...

Member Typedef Documentation

typedef std::map< const MSEdge*, std::vector<MSLane*>* > MSEdge::AllowedLanesCont [inherited]

Suceeding edges (keys) and allowed lanes to reach these edges (values).

Definition at line 86 of file MSEdge.h.

Map from vehicle types to lanes that may be used to reach one of the next edges.

Definition at line 89 of file MSEdge.h.

typedef std::map< std::string, MSEdge* > MSEdge::DictType [protected, inherited]

definition of the static dictionary type

Definition at line 499 of file MSEdge.h.

typedef std::vector<GUILaneWrapper*> GUIEdge::LaneWrapperVector [private]

Definition of the lane's positions vector.

Definition at line 193 of file GUIEdge.h.


Member Enumeration Documentation

enum MSEdge::EdgeBasicFunction [inherited]

Defines possible edge types.

For different purposes, it is necessary to know whether the edge is a normal street or something special.

Enumerator:
EDGEFUNCTION_UNKNOWN  The purpose of the edge is not known.
EDGEFUNCTION_NORMAL  The edge is a normal street.
EDGEFUNCTION_CONNECTOR  The edge is a macroscopic connector (source/sink).
EDGEFUNCTION_INTERNAL  The edge is an internal edge.
EDGEFUNCTION_DISTRICT  The edge is a district edge.

Definition at line 71 of file MSEdge.h.

00071                            {
00073         EDGEFUNCTION_UNKNOWN = -1,
00075         EDGEFUNCTION_NORMAL = 0,
00077         EDGEFUNCTION_CONNECTOR = 1,
00079         EDGEFUNCTION_INTERNAL = 2,
00081         EDGEFUNCTION_DISTRICT = 3
00082     };


Constructor & Destructor Documentation

GUIEdge::GUIEdge ( const std::string &  id,
unsigned int  numericalID,
GUIGlObjectStorage idStorage 
) throw ()

Constructor.

Parameters:
[in] id The id of the edge
[in] numericalID The numerical id (index) of the edge
[in] idStorage The gl-objects storage to retrieve the gl-id for this edge from
See also:
MSEdge

Definition at line 65 of file GUIEdge.cpp.

00067         : MSEdge(id, numericalID),
00068         GUIGlObject(idStorage, "edge:" + id) {}

GUIEdge::~GUIEdge (  )  throw ()

Destructor.

Definition at line 71 of file GUIEdge.cpp.

References myLaneGeoms.

00071                           {
00072     for (LaneWrapperVector::iterator i=myLaneGeoms.begin(); i!=myLaneGeoms.end(); ++i) {
00073         delete(*i);
00074     }
00075 }

GUIEdge::GUIEdge ( const GUIEdge s  )  [private]

invalidated copy constructor


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 MSEdge::addFollower ( MSEdge edge  )  throw () [inline, inherited]

Returns the list of edges which may be reached from this edge.

Returns:
Edges reachable from this edge

Definition at line 213 of file MSEdge.h.

References MSEdge::mySuccessors.

Referenced by NLHandler::addDistrict(), and NLHandler::addDistrictEdge().

00213                                            {
00214         mySuccessors.push_back(edge);
00215     }

const std::vector< MSLane * > * MSEdge::allowedLanes ( const MSEdge destination,
SUMOVehicleClass  vclass = SVC_UNKNOWN 
) const throw () [protected, inherited]

Get the allowed lanes to reach the destination-edge.

If there is no such edge, get 0. Then you are on the wrong edge.

Parameters:
[in] destination The edge to reach
[in] vclass The vehicle class for which this information shall be returned
Returns:
The lanes that may be used to reach the given edge, 0 if no such lanes exist

Definition at line 199 of file MSEdge.cpp.

References MSEdge::myAllowed, MSEdge::myClassedAllowed, MSEdge::myHaveClassConstraints, and SVC_UNKNOWN.

00199                                                                                      {
00200     if (myHaveClassConstraints&&vclass!=SVC_UNKNOWN) {
00201         ClassedAllowedLanesCont::const_iterator i = myClassedAllowed.find(vclass);
00202         if (i!=myClassedAllowed.end()) {
00203             const AllowedLanesCont &c = (*i).second;
00204             AllowedLanesCont::const_iterator j = (*i).second.find(destination);
00205             if (j==c.end()) {
00206                 // Destination-edge not found.
00207                 return 0;
00208             }
00209             return (*j).second;
00210         }
00211     }
00212     AllowedLanesCont::const_iterator it = myAllowed.find(destination);
00213     if (it!=myAllowed.end()) {
00214         return it->second;
00215     } else {
00216         // Destination-edge not found.
00217         return 0;
00218     }
00219 }

const std::vector< MSLane * > * MSEdge::allowedLanes ( SUMOVehicleClass  vclass = SVC_UNKNOWN  )  const throw () [inherited]

Get the allowed lanes for the given vehicle class.

If there is no such edge, get 0. Then you are on the wrong edge.

Parameters:
[in] vclass The vehicle class for which this information shall be returned
Returns:
The lanes that may be used by the given vclass

Definition at line 193 of file MSEdge.cpp.

References MSEdge::allowedLanes().

00193                                                           {
00194     return allowedLanes(0, vclass);
00195 }

const std::vector< MSLane * > * MSEdge::allowedLanes ( const MSEdge destination,
SUMOVehicleClass  vclass = SVC_UNKNOWN 
) const throw () [inherited]

Get the allowed lanes to reach the destination-edge.

If there is no such edge, get 0. Then you are on the wrong edge.

Parameters:
[in] destination The edge to reach
[in] vclass The vehicle class for which this information shall be returned
Returns:
The lanes that may be used to reach the given edge, 0 if no such lanes exist

Definition at line 187 of file MSEdge.cpp.

Referenced by MSEdge::allowedLanes(), MSEdge::getDepartLane(), MSEdge::getFreeLane(), MS_E2_ZS_CollectorOverLanes::getLanePredeccessorLanes(), and MSLane::succLinkSec().

00187                                                                                      {
00188     return allowedLanes(&destination, vclass);
00189 }

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(), GUITrafficLightLogicWrapper::getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUINet::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), GUIEmitter::getPopUpMenu(), 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(), GUITrafficLightLogicWrapper::getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), GUIEmitter::getPopUpMenu(), 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(), GUITrafficLightLogicWrapper::getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUINet::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), GUIEmitter::getPopUpMenu(), 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(), GUITrafficLightLogicWrapper::getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUINet::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), GUIEmitter::getPopUpMenu(), 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(), GUITrafficLightLogicWrapper::getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), GUIEmitter::getPopUpMenu(), 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(), 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 MSEdge::changeLanes ( SUMOTime  t  )  throw () [virtual, inherited]

Performs lane changing on this edge.

Definition at line 327 of file MSEdge.cpp.

References MSEdge::EDGEFUNCTION_INTERNAL, MSLaneChanger::laneChange(), MSEdge::myFunction, and MSEdge::myLaneChanger.

Referenced by MSEdgeControl::changeLanes().

00327                                       {
00328     if (myFunction==EDGEFUNCTION_INTERNAL) {
00329         return;
00330     }
00331     assert(myLaneChanger != 0);
00332     myLaneChanger->laneChange(t);
00333 }

void MSEdge::clear (  )  throw () [static, inherited]

Clears the dictionary.

Definition at line 442 of file MSEdge.cpp.

References MSEdge::myDict.

Referenced by MSNet::clearAll().

00442                       {
00443     for (DictType::iterator i=myDict.begin(); i!=myDict.end(); ++i) {
00444         delete(*i).second;
00445     }
00446     myDict.clear();
00447 }

void MSEdge::closeBuilding (  )  [inherited]

Todo:
Has to be called after all edges were built and all connections were set...; Still, is not very nice

Definition at line 94 of file MSEdge.cpp.

References MSLane::getEdge(), MSEdge::myAllowed, MSEdge::myLanes, MSEdge::myPredeccesors, MSEdge::mySuccessors, and MSEdge::rebuildAllowedLanes().

00094                       {
00095     myAllowed[0] = new std::vector<MSLane*>();
00096     for (std::vector<MSLane*>::iterator i=myLanes->begin(); i!=myLanes->end(); ++i) {
00097         myAllowed[0]->push_back(*i);
00098         const MSLinkCont &lc = (*i)->getLinkCont();
00099         for (MSLinkCont::const_iterator j=lc.begin(); j!=lc.end(); ++j) {
00100             MSLane *toL = (*j)->getLane();
00101             if (toL!=0) {
00102                 MSEdge &to = toL->getEdge();
00103                 //
00104                 if (std::find(mySuccessors.begin(), mySuccessors.end(), &to)==mySuccessors.end()) {
00105                     mySuccessors.push_back(&to);
00106                 }
00107                 if (std::find(to.myPredeccesors.begin(), to.myPredeccesors.end(), this)==to.myPredeccesors.end()) {
00108                     to.myPredeccesors.push_back(this);
00109                 }
00110                 //
00111                 if (myAllowed.find(&to)==myAllowed.end()) {
00112                     myAllowed[&to] = new std::vector<MSLane*>();
00113                 }
00114                 myAllowed[&to]->push_back(*i);
00115             }
00116         }
00117     }
00118     std::sort(mySuccessors.begin(), mySuccessors.end(), by_id_sorter());
00119     rebuildAllowedLanes();
00120 }

SUMOTime MSEdge::decVaporization ( SUMOTime  t  )  throw (ProcessError) [inherited]

Disables vaporization.

The internal vaporization counter is decreased what disables the vaporization if it was only once enabled. Called from the event handler.

Parameters:
[in] t The current time (unused)
Returns:
Time to next call (always 0)
Exceptions:
ProcessError not thrown by this method, just derived

Definition at line 231 of file MSEdge.cpp.

References MSEdge::myVaporizationRequests.

Referenced by NLTriggerBuilder::buildVaporizer().

00231                                                     {
00232     --myVaporizationRequests;
00233     return 0;
00234 }

MSEdge * MSEdge::dictionary ( size_t  index  )  throw () [static, inherited]

Returns the MSEdge at the index.

Definition at line 429 of file MSEdge.cpp.

References MSEdge::myEdges.

00429                                     {
00430     assert(myEdges.size()>id);
00431     return myEdges[id];
00432 }

MSEdge * MSEdge::dictionary ( const std::string &  id  )  throw () [static, inherited]

Returns the MSEdge associated to the key id if exists, otherwise returns 0.

Definition at line 418 of file MSEdge.cpp.

References MSEdge::myDict.

00418                                               {
00419     DictType::iterator it = myDict.find(id);
00420     if (it == myDict.end()) {
00421         // id not in myDict.
00422         return 0;
00423     }
00424     return it->second;
00425 }

bool MSEdge::dictionary ( const std::string &  id,
MSEdge edge 
) throw () [static, inherited]

Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary. Otherwise returns false.

Definition at line 402 of file MSEdge.cpp.

References MSEdge::myDict, and MSEdge::myEdges.

Referenced by NLHandler::addDistrict(), NLHandler::addDistrictEdge(), NLBuilder::EdgeFloatTimeLineRetriever_EdgeTravelTime::addEdgeWeight(), NLBuilder::EdgeFloatTimeLineRetriever_EdgeEffort::addEdgeWeight(), MSVehicleTransfer::addVeh(), NLEdgeControlBuilder::beginEdgeParsing(), NLDetectorBuilder::buildRouteProbe(), NLTriggerBuilder::buildVaporizer(), MSDevice_Routing::buildVehicleDevices(), MSVehicleTransfer::checkEmissions(), traci::TraCIServer::commandChangeRoute(), traci::TraCIServer::commandChangeTarget(), traci::TraCIServer::commandDistanceRequest(), traci::TraCIServer::commandStopNode(), traci::TraCIServer::convertCartesianToRoadMap(), traci::TraCIServer::convertRoadMapToCartesian(), GUINet::getEdgeBoundary(), traci::TraCIServer::handleRoadMapDomain(), traci::TraCIServer::handleVehicleDomain(), GUISelectionLoader::loadSelection(), MSTriggeredRerouter::myStartElement(), MSRouteHandler::myStartElement(), NLTriggerBuilder::parseAndBuildRerouter(), MSEdge::parseEdgesList(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_Edge::processSet(), and MSVehicle::reroute().

00402                                                            {
00403     DictType::iterator it = myDict.find(id);
00404     if (it == myDict.end()) {
00405         // id not in myDict.
00406         myDict[id] = ptr;
00407         while (myEdges.size()<ptr->getNumericalID()+1) {
00408             myEdges.push_back(0);
00409         }
00410         myEdges[ptr->getNumericalID()] = ptr;
00411         return true;
00412     }
00413     return false;
00414 }

size_t MSEdge::dictSize (  )  throw () [static, inherited]

void GUIEdge::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 209 of file GUIEdge.cpp.

References Position2D::add(), GLHelper::drawBoxLines(), MSEdge::EDGEFUNCTION_CONNECTOR, MSEdge::EDGEFUNCTION_INTERNAL, MSEdge::EDGEFUNCTION_NORMAL, getMicrosimID(), GUILaneWrapper::getShape(), Position2DVector::length(), Position2D::mul(), MSEdge::myFunction, myLaneGeoms, pfdkGetStringWidth(), pfDrawString(), pfSetPosition(), pfSetScale(), Position2DVector::positionAtLengthPosition(), Position2DVector::rotationDegreeAtLengthPosition(), SUMO_const_halfLaneAndOffset, SUMOReal, Position2D::x(), and Position2D::y().

00209                                                                {
00210     if (s.hideConnectors&&myFunction==MSEdge::EDGEFUNCTION_CONNECTOR) {
00211         return;
00212     }
00213     // draw the lanes
00214     for (LaneWrapperVector::const_iterator i=myLaneGeoms.begin(); i!=myLaneGeoms.end(); ++i) {
00215 #ifdef HAVE_MESOSIM
00216         if (MSGlobals::gUseMesoSim) {
00217             s.edgeColorer.setGlColor(*this);
00218         }
00219 #endif
00220         (*i)->drawGL(s);
00221     }
00222     // check whether lane boundaries shall be drawn
00223     if (s.scale>1.&&s.laneShowBorders&&myFunction!=MSEdge::EDGEFUNCTION_INTERNAL) {
00224         glTranslated(0, 0, .01);
00225         for (LaneWrapperVector::const_iterator i=myLaneGeoms.begin()+1; i!=myLaneGeoms.end(); ++i) {
00226             (*i)->drawBordersGL(s);
00227         }
00228         glTranslated(0, 0, -.01);
00229         // draw white boundings
00230         glTranslated(0, 0, .02);
00231         glColor3d(1,1,1);
00232         for (LaneWrapperVector::const_iterator i=myLaneGeoms.begin(); i!=myLaneGeoms.end(); ++i) {
00233             GLHelper::drawBoxLines((*i)->getShape(), (*i)->getShapeRotations(), (*i)->getShapeLengths(), SUMO_const_halfLaneAndOffset);
00234         }
00235         glTranslated(0, 0, -.02);
00236     }
00237 #ifdef HAVE_MESOSIM
00238     if (MSGlobals::gUseMesoSim) {
00239         size_t idx = 0;
00240         for (LaneWrapperVector::const_iterator l=myLaneGeoms.begin(); l!=myLaneGeoms.end(); ++l,++idx) {
00241             const Position2DVector& shape = (*l)->getShape();
00242             const DoubleVector& shapeRotations = (*l)->getShapeRotations();
00243             const DoubleVector& shapeLengths = (*l)->getShapeLengths();
00244             const Position2D &laneBeg = shape[0];
00245 
00246             glColor3d(1,1,0);
00247             glPushMatrix();
00248             glTranslated(laneBeg.x(), laneBeg.y(), 0);
00249             glRotated(shapeRotations[0], 0, 0, 1);
00250             // go through the vehicles
00251             int shapePos = 0;
00252             SUMOReal positionOffset = 0;
00253             SUMOReal position = 0;
00254             for (MESegment *segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment!=0; segment = segment->getNextSegment()) {
00255                 const std::vector<size_t> numCars = segment->getQueSizes();
00256                 const SUMOReal length = segment->getLength();
00257                 if (idx < numCars.size()) {
00258                     const SUMOReal avgCarSize = segment->getOccupancy() / segment->getCarNumber();
00259                     for (size_t i = 0; i < numCars[idx]; i++) {
00260                         SUMOReal vehiclePosition = position + length - i * avgCarSize;
00261                         SUMOReal xOff = 0.f;
00262                         while (vehiclePosition < position) {
00263                             vehiclePosition += length;
00264                             xOff += 0.5f;
00265                         }
00266                         while (shapePos<(int)shapeRotations.size()-1 && vehiclePosition>positionOffset+shapeLengths[shapePos]) {
00267                             glPopMatrix();
00268                             positionOffset += shapeLengths[shapePos];
00269                             shapePos++;
00270                             glPushMatrix();
00271                             glTranslated(shape[shapePos].x(), shape[shapePos].y(), 0);
00272                             glRotated(shapeRotations[shapePos], 0, 0, 1);
00273                         }
00274                         glPushMatrix();
00275                         glTranslated(xOff, -(vehiclePosition-positionOffset), 0);
00276                         glPushMatrix();
00277                         glScaled(1, avgCarSize, 1);
00278                         glBegin(GL_TRIANGLES);
00279                         glVertex2d(0, 0);
00280                         glVertex2d(0-1.25, 1);
00281                         glVertex2d(0+1.25, 1);
00282                         glEnd();
00283                         glPopMatrix();
00284                         glPopMatrix();
00285                     }
00286                 }
00287                 position += length;
00288             }
00289             glPopMatrix();
00290         }
00291     }
00292 #endif
00293     // (optionally) draw the name
00294     if ((s.drawEdgeName && myFunction == EDGEFUNCTION_NORMAL) || (s.drawInternalEdgeName && myFunction != EDGEFUNCTION_NORMAL)) {
00295         float nameSize = s.edgeNameSize;
00296         if (myFunction == EDGEFUNCTION_NORMAL) {
00297             glColor3d(s.edgeNameColor.red(), s.edgeNameColor.green(), s.edgeNameColor.blue());
00298         } else {
00299             glColor3d(s.internalEdgeNameColor.red(), s.internalEdgeNameColor.green(), s.internalEdgeNameColor.blue());
00300             nameSize = s.internalEdgeNameSize;
00301         }
00302         GUILaneWrapper *lane1 = myLaneGeoms[0];
00303         GUILaneWrapper *lane2 = myLaneGeoms[myLaneGeoms.size()-1];
00304         glPushMatrix();
00305         glTranslated(0, 0, -.06);
00306         Position2D p = lane1->getShape().positionAtLengthPosition(lane1->getShape().length()/(SUMOReal) 2.);
00307         p.add(lane2->getShape().positionAtLengthPosition(lane2->getShape().length()/(SUMOReal) 2.));
00308         p.mul(.5);
00309         glTranslated(p.x(), p.y(), 0);
00310         glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
00311         pfSetPosition(0, 0);
00312         pfSetScale(nameSize / s.scale);
00313         SUMOReal w = pfdkGetStringWidth(getMicrosimID().c_str());
00314         glRotated(180, 1, 0, 0);
00315         SUMOReal angle = lane1->getShape().rotationDegreeAtLengthPosition(lane1->getShape().length()/(SUMOReal) 2.);
00316         angle += 90;
00317         if (angle>90&&angle<270) {
00318             angle -= 180;
00319         }
00320         glRotated(angle, 0, 0, 1);
00321         glTranslated(-w/2., .2*nameSize / s.scale, 0);
00322         pfDrawString(getMicrosimID().c_str());
00323         glTranslated(0, 0, .06);
00324         glPopMatrix();
00325     }
00326 }

bool MSEdge::emit ( MSVehicle v,
SUMOTime  time 
) const throw (ProcessError) [inherited]

Emits the given vehicle.

The procedure for choosing the proper lane is determined, first. In dependance to this, the proper emission lane is chosen.

Emission itself is done by calling the chose lane's "emit" method.

Parameters:
[in] v The vehicle to emit
[in] time The current simulation time
Returns:
Whether the vehicle could be emitted
See also:
MSLane::emit

Definition at line 280 of file MSEdge.cpp.

References DEPART_POS_FREE, DEPART_POS_GIVEN, DEPART_POS_RANDOM, DEPART_POS_RANDOM_FREE, SUMOVehicleParameter::departPos, SUMOVehicleParameter::departPosProcedure, MSLane::emit(), MSEdge::getDepartLane(), MSEdge::getLanes(), MSEdge::isVaporizing(), RandHelper::rand(), and SUMOReal.

Referenced by MSEmitter::childCheckEmit(), MSCalibrator::childCheckEmit(), and MSEmitControl::tryEmit().

00280                                                                   {
00281     // when vaporizing, no vehicles are emitted...
00282     if (isVaporizing()) {
00283         return false;
00284     }
00285     const SUMOVehicleParameter &pars = v.getParameter();
00286 #ifdef HAVE_MESOSIM
00287     if (MSGlobals::gUseMesoSim) {
00288         SUMOReal pos = 0.0;
00289         switch (pars.departPosProcedure) {
00290         case DEPART_POS_GIVEN:
00291             if (pars.departPos >= 0.) {
00292                 pos = pars.departPos;
00293             } else {
00294                 pos = pars.departPos + getLanes()[0]->getLength();
00295             }
00296             break;
00297         case DEPART_POS_RANDOM:
00298         case DEPART_POS_RANDOM_FREE:
00299             pos = RandHelper::rand(getLanes()[0]->getLength());
00300             break;
00301         default:
00302             break;
00303         }
00304         bool result = false;
00305         bool insertToNet = false;
00306         MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this, pos);
00307         if (pars.departPosProcedure == DEPART_POS_FREE) {
00308             while (segment != 0 && !result) {
00309                 result = segment->initialise(&v, time, insertToNet);
00310                 segment = segment->getNextSegment();
00311             }
00312         } else {
00313             result = segment->initialise(&v, time, insertToNet);
00314         }
00315         if (insertToNet) {
00316             MSGlobals::gMesoNet->addCar(&v);
00317         }
00318         return result;
00319     }
00320 #endif
00321     MSLane* emitLane = getDepartLane(v);
00322     return emitLane != 0 && /*emitLane->getVehLenSum() + v.getLength() < emitLane->getLength() && */emitLane->emit(v);
00323 }

void GUIEdge::fill ( std::vector< GUIEdge * > &  netsWrappers  )  [static]

Definition at line 141 of file GUIEdge.cpp.

References MSEdge::dictSize(), MSEdge::EDGEFUNCTION_DISTRICT, MSEdge::myDict, and size.

Referenced by GUINet::initGUIStructures().

00141                                                {
00142     size_t size = MSEdge::dictSize();
00143     netsWrappers.reserve(size);
00144     for (DictType::iterator i=myDict.begin(); i!=myDict.end(); ++i) {
00145         if (i->second->getPurpose() != MSEdge::EDGEFUNCTION_DISTRICT) {
00146             netsWrappers.push_back(static_cast<GUIEdge*>((*i).second));
00147         }
00148     }
00149 }

Boundary GUIEdge::getBoundary (  )  const

Returns the street's geometry.

Definition at line 127 of file GUIEdge.cpp.

References Boundary::add(), Boundary::grow(), myLaneGeoms, and Position2DVector::size().

Referenced by getCenteringBoundary(), and GUINet::getEdgeBoundary().

00127                            {
00128     Boundary ret;
00129     for (LaneWrapperVector::const_iterator i=myLaneGeoms.begin(); i!=myLaneGeoms.end(); ++i) {
00130         const Position2DVector &g = (*i)->getShape();
00131         for (unsigned int j=0; j<g.size(); j++) {
00132             ret.add(g[j]);
00133         }
00134     }
00135     ret.grow(10);
00136     return ret;
00137 }

Boundary GUIEdge::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 201 of file GUIEdge.cpp.

References getBoundary(), and Boundary::grow().

00201                                             {
00202     Boundary b = getBoundary();
00203     b.grow(20);
00204     return b;
00205 }

SUMOReal MSEdge::getCurrentTravelTime (  )  const throw () [inherited]

Computes and returns the current travel time for this edge.

The mean travel time of all lanes is summed and divided by the number of lanes. If the result is zero, 1000000. (a very large number) is returned, otherwise the edge's length divided by this speed.

Returns:
The current effort (travel time) to pass the edge

Definition at line 357 of file MSEdge.cpp.

References MSEdge::myLanes, and SUMOReal.

Referenced by TraCIServerAPI_Edge::processGet().

00357                                            {
00358     SUMOReal v = 0;
00359 #ifdef HAVE_MESOSIM
00360     if (MSGlobals::gUseMesoSim) {
00361         MESegment *first = MSGlobals::gMesoNet->getSegmentForEdge(*this);
00362         unsigned segments = 0;
00363         do {
00364             v += first->getMeanSpeed();
00365             first = first->getNextSegment();
00366             segments++;
00367         } while (first!=0);
00368         v /= (SUMOReal) segments;
00369     } else {
00370 #endif
00371         for (std::vector<MSLane*>::iterator i=myLanes->begin(); i!=myLanes->end(); ++i) {
00372             v += (*i)->getMeanSpeed();
00373         }
00374         v /= (SUMOReal) myLanes->size();
00375 #ifdef HAVE_MESOSIM
00376     }
00377 #endif
00378     if (v!=0) {
00379         return (*myLanes)[0]->getLength() / v;
00380     } else {
00381         return 1000000.;
00382     }
00383 }

MSLane * MSEdge::getDepartLane ( const MSVehicle v  )  const throw () [inherited]

Finds a depart lane for the given vehicle.

Depending on the depart lane procedure a depart lane is chosen. Repeated calls with the same vehicle may return different results if the procedure is "random" or "free". In case no appropriate lane was found, 0 is returned.

Parameters:
[in] v The vehicle to get the depart lane for
Returns:
a possible depart lane
See also:
MSLane::emit

Definition at line 255 of file MSEdge.cpp.

References MSEdge::allowedLanes(), MSLane::allowsVehicleClass(), DEPART_LANE_DEFAULT, DEPART_LANE_DEPARTLANE, DEPART_LANE_FREE, DEPART_LANE_GIVEN, DEPART_LANE_RANDOM, SUMOVehicleParameter::departLane, SUMOVehicleParameter::departLaneProcedure, MSEdge::getFreeLane(), RandHelper::getRandomFrom(), MSEdge::myDepartLane, and MSEdge::myLanes.

Referenced by MSEdge::emit().

00255                                                       {
00256     const SUMOVehicleParameter &pars = v.getParameter();
00257     switch (pars.departLaneProcedure) {
00258     case DEPART_LANE_GIVEN:
00259         if ((int) myLanes->size() <= pars.departLane || !(*myLanes)[pars.departLane]->allowsVehicleClass(v.getVehicleType().getVehicleClass())) {
00260             return 0;
00261         }
00262         return (*myLanes)[pars.departLane];
00263     case DEPART_LANE_RANDOM:
00264         return RandHelper::getRandomFrom(*allowedLanes(v.getVehicleType().getVehicleClass()));
00265     case DEPART_LANE_FREE:
00266         return getFreeLane(v.getVehicleType().getVehicleClass());
00267     case DEPART_LANE_DEPARTLANE:
00268     case DEPART_LANE_DEFAULT:
00269     default:
00270         break;
00271     }
00272     if (!myDepartLane->allowsVehicleClass(v.getVehicleType().getVehicleClass())) {
00273         return 0;
00274     }
00275     return myDepartLane;
00276 }

const MSEdge* const MSEdge::getFollower ( unsigned int  n  )  const throw () [inline, inherited]

Returns the n-th of the following edges.

Parameters:
[in] n The index within following edges of the edge to return
Returns:
The n-th of the following edges

Definition at line 237 of file MSEdge.h.

References MSEdge::mySuccessors.

Referenced by MSRouteHandler::myStartElement().

00237                                                                    {
00238         return mySuccessors[n];
00239     }

MSLane * MSEdge::getFreeLane ( const SUMOVehicleClass  vclass  )  const throw () [inherited]

Finds the emptiest lane allowing the vehicle class.

The emptiest lane is the one with the fewest vehicles on. If there is more than one, the first according to its index in the lane container is chosen.

Parameters:
[in] vclass The vehicle class to look for
Returns:
the least occupied lane
See also:
MSLane::emit

Definition at line 238 of file MSEdge.cpp.

References MSEdge::allowedLanes(), and MSLane::getVehicleNumber().

Referenced by MSVehicleTransfer::checkEmissions(), and MSEdge::getDepartLane().

00238                                                                {
00239     const std::vector<MSLane*>* lanes = allowedLanes(vclass);
00240     MSLane* res = 0;
00241     if (lanes != 0) {
00242         unsigned int noCars = INT_MAX;
00243         for (std::vector<MSLane*>::const_iterator i=lanes->begin(); i!=lanes->end(); ++i) {
00244             if ((*i)->getVehicleNumber()<noCars) {
00245                 res = (*i);
00246                 noCars = (*i)->getVehicleNumber();
00247             }
00248         }
00249     }
00250     return res;
00251 }

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

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

const std::string& MSEdge::getID (  )  const throw () [inline, inherited]

std::vector< GLuint > GUIEdge::getIDs (  )  [static]

Returns the list of all known junctions as their ids

Definition at line 116 of file GUIEdge.cpp.

References MSEdge::myDict, and size.

Referenced by FXIMPLEMENT().

00116                 {
00117     std::vector<GLuint> ret;
00118     ret.reserve(MSEdge::myDict.size());
00119     for (MSEdge::DictType::iterator i=MSEdge::myDict.begin(); i!=MSEdge::myDict.end(); ++i) {
00120         ret.push_back(static_cast<GUIEdge*>((*i).second)->getGlID());
00121     }
00122     return ret;
00123 }

const std::vector<MSEdge*>& MSEdge::getIncomingEdges (  )  const throw () [inline, inherited]

Returns the list of edges from which this edge may be reached.

Returns:
Edges from which this edge may be reached

Definition at line 221 of file MSEdge.h.

References MSEdge::myPredeccesors.

00221                                                                {
00222         return myPredeccesors;
00223     }

MSLane & GUIEdge::getLane ( size_t  laneNo  ) 

returns the enumerated lane (!!! why not private with a friend?)

Definition at line 93 of file GUIEdge.cpp.

References size.

00093                               {
00094     assert(laneNo<myLanes->size());
00095     return *((*myLanes)[laneNo]);
00096 }

GUILaneWrapper & GUIEdge::getLaneGeometry ( const MSLane lane  )  const

Definition at line 107 of file GUIEdge.cpp.

References myLaneGeoms.

00107                                                  {
00108     LaneWrapperVector::const_iterator i=
00109         find_if(myLaneGeoms.begin(), myLaneGeoms.end(), lane_wrapper_finder(*lane));
00110     assert(i!=myLaneGeoms.end());
00111     return *(*i);
00112 }

GUILaneWrapper & GUIEdge::getLaneGeometry ( size_t  laneNo  )  const

returns the enumerated lane's geometry (!!! why not private with a friend?)

Definition at line 100 of file GUIEdge.cpp.

References myLaneGeoms, and size.

Referenced by GUIViewTraffic::draw(), GUITriggeredRerouter::drawGL(), GUIEmitter::drawGL(), GUITriggeredRerouter::GUITriggeredRerouter(), GUINet::initDetectors(), and GUI_E2_ZS_CollectorOverLanes::MyWrapper::MyWrapper().

00100                                             {
00101     assert(laneNo<myLanes->size());
00102     return *(myLaneGeoms[laneNo]);
00103 }

static std::pair<SUMOReal, SUMOReal> GUIEdge::getLaneOffsets ( SUMOReal  x1,
SUMOReal  y1,
SUMOReal  x2,
SUMOReal  y2,
SUMOReal  prev,
SUMOReal  wanted 
) [static]

returns the position on the line given by the coordinates where "prev" is the length of the line and "wanted" the distance from the begin !!! should be within another class

const std::vector<MSLane*>& MSEdge::getLanes (  )  const throw () [inline, inherited]

SUMOTime MSEdge::getLastFailedEmissionTime (  )  const throw () [inline, inherited]

Returns the last time a vehicle could not be inserted.

Returns:
The current value

Definition at line 341 of file MSEdge.h.

References MSEdge::myLastFailedEmissionTime.

Referenced by MSEmitControl::tryEmit().

00341                                                               {
00342         return myLastFailedEmissionTime;
00343     }

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

Returns the id of the object as known to microsim.

Returns:
The id of the edge
See also:
GUIGlObject::getMicrosimID

Implements GUIGlObject.

Definition at line 195 of file GUIEdge.cpp.

References MSEdge::getID().

Referenced by drawGL().

00195                                      {
00196     return getID();
00197 }

unsigned int MSEdge::getNoFollowing (  )  const throw () [inline, inherited]

Returns the number of edges that may be reached from this edge.

Returns:
The number of following edges

Definition at line 229 of file MSEdge.h.

References MSEdge::mySuccessors.

Referenced by MSRouteHandler::myStartElement().

00229                                                 {
00230         return (unsigned int) mySuccessors.size();
00231     }

unsigned int MSEdge::getNumericalID (  )  const throw () [inline, inherited]

Returns the numerical id of the edge.

Returns:
This edge's numerical id

Definition at line 200 of file MSEdge.h.

References MSEdge::myNumericalID.

Referenced by MSEdgeControl::changeLanes(), and traci::TraCIServer::handleRoadMapDomain().

00200                                                 {
00201         return myNumericalID;
00202     }

GUIParameterTableWindow * GUIEdge::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 171 of file GUIEdge.cpp.

References GUIParameterTableWindow::closeBuilding(), GUIParameterTableWindow::mkItem(), and MSEdge::myLanes.

00172                                                            {
00173     GUIParameterTableWindow *ret = 0;
00174 #ifdef HAVE_MESOSIM
00175     ret = new GUIParameterTableWindow(app, *this, 5);
00176     // add items
00177     ret->mkItem("length [m]", false, (*myLanes)[0]->getLength());
00178     ret->mkItem("allowed speed [m/s]", false, getAllowedSpeed());
00179     ret->mkItem("occupancy [%]", true,
00180                 new FunctionBinding<GUIEdge, SUMOReal>(this, &GUIEdge::getOccupancy));
00181     ret->mkItem("mean vehicle speed [m/s]", true,
00182                 new FunctionBinding<GUIEdge, SUMOReal>(this, &GUIEdge::getMeanSpeed));
00183     ret->mkItem("flow [veh/h/lane]", true,
00184                 new FunctionBinding<GUIEdge, SUMOReal>(this, &GUIEdge::getFlow));
00185     ret->mkItem("#vehicles", true,
00186                 new CastingFunctionBinding<GUIEdge, SUMOReal, unsigned int>(this, &GUIEdge::getVehicleNo));
00187     // close building
00188     ret->closeBuilding();
00189 #endif
00190     return ret;
00191 }

GUIGLObjectPopupMenu * GUIEdge::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 154 of file GUIEdge.cpp.

References GUIGlObject::buildCenterPopupEntry(), GUIGlObject::buildNameCopyPopupEntry(), GUIGlObject::buildPopupHeader(), GUIGlObject::buildPositionCopyEntry(), GUIGlObject::buildSelectionPopupEntry(), and GUIGlObject::buildShowParamsPopupEntry().

00154                                                                              {
00155     GUIGLObjectPopupMenu *ret = new GUIGLObjectPopupMenu(app, parent, *this);
00156     buildPopupHeader(ret, app);
00157     buildCenterPopupEntry(ret);
00158     buildNameCopyPopupEntry(ret);
00159     buildSelectionPopupEntry(ret);
00160 #ifdef HAVE_MESOSIM
00161     if (MSGlobals::gUseMesoSim) {
00162         buildShowParamsPopupEntry(ret);
00163     }
00164 #endif
00165     buildPositionCopyEntry(ret, false);
00166     return ret;
00167 }

EdgeBasicFunction MSEdge::getPurpose (  )  const throw () [inline, inherited]

Returns the edge type (EdgeBasicFunction).

Returns:
This edge's EdgeBasicFunction
See also:
EdgeBasicFunction

Definition at line 192 of file MSEdge.h.

References MSEdge::myFunction.

Referenced by MSLane::appropriate(), MSVehicle::checkRewindLinkLanes(), MSVehicle::enterLaneAtMove(), MSVehicle::getBestLanesContinuation(), GUILaneWrapper::getPurpose(), traci::TraCIServer::postProcessSimulationStep(), and MSVehicle::vsafeCriticalCont().

00192                                                  {
00193         return myFunction;
00194     }

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

Returns the type of the object as coded in GUIGlObjectType.

Returns:
GLO_EDGE (is an edge)
See also:
GUIGlObject::getType

GUIGlObjectType

Implements GUIGlObject.

Definition at line 155 of file GUIEdge.h.

References GLO_EDGE.

00155                                             {
00156         return GLO_EDGE;
00157     }

SUMOTime MSEdge::incVaporization ( SUMOTime  t  )  throw (ProcessError) [inherited]

Enables vaporization.

The internal vaporization counter is increased enabling the vaporization. Called from the event handler.

Parameters:
[in] t The current time (unused)
Returns:
Time to next call (always 0)
Exceptions:
ProcessError not thrown by this method, just derived

Definition at line 224 of file MSEdge.cpp.

References MSEdge::myVaporizationRequests.

Referenced by NLTriggerBuilder::buildVaporizer().

00224                                                     {
00225     ++myVaporizationRequests;
00226     return 0;
00227 }

void GUIEdge::initGeometry ( GUIGlObjectStorage idStorage  )  throw ()

Builds lane wrappers for this edge's lanes.

Parameters:
[in] idStorage The gl-objects storage to retrieve the gl-id for this edge's lanes from

Definition at line 79 of file GUIEdge.cpp.

References myLaneGeoms, and MSEdge::myLanes.

00079                                                            {
00080     // don't do this twice
00081     if (myLaneGeoms.size()>0) {
00082         return;
00083     }
00084     // build the lane wrapper
00085     myLaneGeoms.reserve(myLanes->size());
00086     for (std::vector<MSLane*>::const_iterator i=myLanes->begin(); i<myLanes->end(); ++i) {
00087         myLaneGeoms.push_back((*i)->buildLaneWrapper(idStorage));
00088     }
00089 }

void MSEdge::initialize ( MSLane departLane,
std::vector< MSLane * > *  lanes,
EdgeBasicFunction  function 
) throw () [inherited]

Initialize the edge.

Parameters:
[in] allowed Information which edges may be reached from which lanes
[in] departLane The default departure lane (may be 0)
[in] lanes List of this edge's lanes
[in] function A basic type of the edge

Definition at line 81 of file MSEdge.cpp.

References MSEdge::EDGEFUNCTION_DISTRICT, MSEdge::EDGEFUNCTION_INTERNAL, MSEdge::myDepartLane, MSEdge::myFunction, MSEdge::myLaneChanger, and MSEdge::myLanes.

Referenced by NLHandler::addDistrict(), and NLEdgeControlBuilder::closeEdge().

00082                                                                                   {
00083     assert(function == EDGEFUNCTION_DISTRICT || lanes!=0);
00084     myDepartLane = departLane;
00085     myLanes = lanes;
00086     myFunction = function;
00087     if (myLanes && myLanes->size() > 1 && function!=EDGEFUNCTION_INTERNAL) {
00088         myLaneChanger = new MSLaneChanger(myLanes);
00089     }
00090 }

void MSEdge::insertIDs ( std::vector< std::string > &  into  )  throw () [static, inherited]

Inserts IDs of all known edges into the given vector.

Definition at line 451 of file MSEdge.cpp.

References MSEdge::myDict.

Referenced by TraCIServerAPI_Edge::processGet().

00451                                                     {
00452     for (DictType::iterator i=myDict.begin(); i!=myDict.end(); ++i) {
00453         into.push_back((*i).first);
00454     }
00455 }

bool MSEdge::isVaporizing (  )  const throw () [inline, inherited]

Returns whether vehicles on this edge shall be vaporized.

Returns:
Whether no vehicle shall be on this edge

Definition at line 250 of file MSEdge.h.

References MSEdge::myVaporizationRequests.

Referenced by MSEmitter::childCheckEmit(), MSCalibrator::childCheckEmit(), MSEdge::emit(), and MSEmitControl::tryEmit().

00250                                       {
00251         return myVaporizationRequests>0;
00252     }

MSLane *const MSEdge::leftLane ( const MSLane *const   lane  )  const throw () [inherited]

Returns the lane left to the one given, 0 if the given lane is leftmost.

Parameters:
[in] lane The lane right to the one to be returned
Returns:
The lane left to the given, 0 if no such lane exists
Todo:
This method searches for the given in the container; probably, this could be done faster

Definition at line 167 of file MSEdge.cpp.

References MSEdge::myLanes.

Referenced by traci::TraCIServer::commandStopNode(), and MSLane::getLeftLane().

00167                                                         {
00168     std::vector<MSLane*>::iterator laneIt = find(myLanes->begin(), myLanes->end(), lane);
00169     if (laneIt==myLanes->end()||laneIt==myLanes->end()-1) {
00170         return 0;
00171     }
00172     return *(laneIt+1);
00173 }

GUIEdge& GUIEdge::operator= ( const GUIEdge s  )  [private]

invalidated assignment operator

void MSEdge::parseEdgesList ( const std::vector< std::string > &  desc,
std::vector< const MSEdge * > &  into,
const std::string &  rid 
) throw (ProcessError) [static, inherited]

Parses the given string vector assuming it edge ids.

Parameters:
[in] desc The string vector containing edge ids
[out] into The vector to fill
[in] rid The id of the route these description belongs to; used for error message generation
Exceptions:
ProcessError If one of the strings contained is not a known edge id

Definition at line 467 of file MSEdge.cpp.

References MSEdge::dictionary().

00468                                                                  {
00469     for (std::vector<std::string>::const_iterator i=desc.begin(); i!=desc.end(); ++i) {
00470         const MSEdge *edge = MSEdge::dictionary(*i);
00471         // check whether the edge exists
00472         if (edge==0) {
00473             throw ProcessError("The edge '" + *i + "' within route '" + rid + "' is not known."
00474                                + "\n The route can not be build.");
00475         }
00476         into.push_back(edge);
00477     }
00478 }

void MSEdge::parseEdgesList ( const std::string &  desc,
std::vector< const MSEdge * > &  into,
const std::string &  rid 
) throw (ProcessError) [static, inherited]

Parses the given string assuming it contains a list of edge ids divided by spaces.

Splits the string at spaces, uses polymorph method to generate edge vector.

Parameters:
[in] desc The string containing space-separated edge ids
[out] into The vector to fill
[in] rid The id of the route these description belongs to; used for error message generation
Exceptions:
ProcessError If one of the strings contained is not a known edge id

Definition at line 459 of file MSEdge.cpp.

References StringTokenizer::getVector().

Referenced by MSRouteHandler::myCharacters(), MSRouteHandler::myStartElement(), MSRouteHandler::openRoute(), and TraCIServerAPI_Vehicle::processSet().

00460                                                                  {
00461     StringTokenizer st(desc);
00462     parseEdgesList(st.getVector(), into, rid);
00463 }

bool MSEdge::prohibits ( const SUMOVehicle *const   vehicle  )  const throw () [inherited]

Returns whether the vehicle (class) is not allowed on the edge.

Definition at line 387 of file MSEdge.cpp.

References MSEdge::EDGEFUNCTION_DISTRICT, MSEdge::myFunction, MSEdge::myHaveClassConstraints, and MSEdge::myLanes.

00387                                                                  {
00388     if (myFunction == EDGEFUNCTION_DISTRICT || !myHaveClassConstraints) {
00389         return false;
00390     }
00391     SUMOVehicleClass vclass = vehicle->getVehicleType().getVehicleClass();
00392     for (std::vector<MSLane*>::iterator i=myLanes->begin(); i!=myLanes->end(); ++i) {
00393         if ((*i)->allowsVehicleClass(vclass)) {
00394             return false;
00395         }
00396     }
00397     return true;
00398 }

void MSEdge::rebuildAllowedLanes (  )  throw () [inherited]

Definition at line 124 of file MSEdge.cpp.

References MSEdge::myAllowed, MSEdge::myClassedAllowed, MSEdge::myHaveClassConstraints, and MSEdge::myLanes.

Referenced by MSEdge::closeBuilding(), TraCIServerAPI_Lane::processSet(), and TraCIServerAPI_Edge::processSet().

00124                                     {
00125     // build the classed allowed lanes
00126     myHaveClassConstraints = false;
00127     // build list of vehicle classes that are constrained
00128     // ... all others will be not regarded (allowed) ...
00129     std::set<SUMOVehicleClass> vclasses;
00130     for (std::vector<MSLane*>::const_iterator i2=myLanes->begin(); i2!=myLanes->end(); ++i2) {
00131         const std::vector<SUMOVehicleClass> &allowed = (*i2)->getAllowedClasses();
00132         for (std::vector<SUMOVehicleClass>::const_iterator j=allowed.begin(); j!=allowed.end(); j++) {
00133             vclasses.insert(*j);
00134         }
00135         const std::vector<SUMOVehicleClass> &disallowed = (*i2)->getNotAllowedClasses();
00136         for (std::vector<SUMOVehicleClass>::const_iterator j=disallowed.begin(); j!=disallowed.end(); j++) {
00137             vclasses.insert(*j);
00138         }
00139     }
00140     // go through these classes
00141     for (std::set<SUMOVehicleClass>::const_iterator j=vclasses.begin(); j!=vclasses.end(); ++j) {
00142         // go through connected edges
00143         for (AllowedLanesCont::iterator i1=myAllowed.begin(); i1!=myAllowed.end(); ++i1) {
00144             delete myClassedAllowed[*j][(*i1).first];
00145             myClassedAllowed[*j][(*i1).first] = new std::vector<MSLane*>();
00146             // go through lanes approaching current edge
00147             for (std::vector<MSLane*>::iterator i2=(*i1).second->begin(); i2!=(*i1).second->end(); ++i2) {
00148                 // allows the current vehicle class?
00149                 if ((*i2)->allowsVehicleClass(*j)) {
00150                     // -> may be used
00151                     myClassedAllowed[*j][(*i1).first]->push_back(*i2);
00152                 }
00153             }
00154             // assert that 0 is returned if no connection is allowed for a class
00155             if (myClassedAllowed[*j][(*i1).first]->size()==0) {
00156                 delete myClassedAllowed[*j][(*i1).first];
00157                 myClassedAllowed[*j][(*i1).first] = 0;
00158             }
00159         }
00160         myHaveClassConstraints = true;
00161     }
00162 }

MSLane *const MSEdge::rightLane ( const MSLane *const   lane  )  const throw () [inherited]

Returns the lane right to the one given, 0 if the given lane is rightmost.

Parameters:
[in] lane The lane left to the one to be returned
Returns:
The lane right to the given, 0 if no such lane exists
Todo:
This method searches for the given in the container; probably, this could be done faster

Definition at line 177 of file MSEdge.cpp.

References MSEdge::myLanes.

Referenced by traci::TraCIServer::commandStopNode(), and MSLane::getRightLane().

00177                                                          {
00178     std::vector<MSLane*>::iterator laneIt = find(myLanes->begin(), myLanes->end(), lane);
00179     if (laneIt==myLanes->end()||laneIt==myLanes->begin()) {
00180         return 0;
00181     }
00182     return *(laneIt-1);
00183 }

void MSEdge::setLastFailedEmissionTime ( SUMOTime  time  )  const throw () [inline, inherited]

Sets the last time a vehicle could not be inserted.

Parameters:
[in] time the new value

Definition at line 349 of file MSEdge.h.

References MSEdge::myLastFailedEmissionTime.

Referenced by MSEmitControl::tryEmit().

00349                                                                        {
00350         myLastFailedEmissionTime = time;
00351     }


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

AllowedLanesCont MSEdge::myAllowed [protected, inherited]

Associative container from destination-edge to allowed-lanes.

Definition at line 484 of file MSEdge.h.

Referenced by MSEdge::allowedLanes(), MSEdge::closeBuilding(), MSEdge::rebuildAllowedLanes(), and MSEdge::~MSEdge().

From vehicle class to lanes allowed to be used by it.

Definition at line 487 of file MSEdge.h.

Referenced by MSEdge::allowedLanes(), MSEdge::rebuildAllowedLanes(), and MSEdge::~MSEdge().

MSLane* MSEdge::myDepartLane [protected, inherited]

Lane from which vehicles will depart, usually the rightmost.

Definition at line 458 of file MSEdge.h.

Referenced by MSEdge::getDepartLane(), and MSEdge::initialize().

MSEdge::DictType MSEdge::myDict [static, protected, inherited]

Static dictionary to associate string-ids with objects.

Deprecated:
Move to MSEdgeControl, make non-static

Definition at line 504 of file MSEdge.h.

Referenced by MSEdge::clear(), MSEdge::dictionary(), MSEdge::dictSize(), fill(), getIDs(), and MSEdge::insertIDs().

std::vector< MSEdge * > MSEdge::myEdges [static, protected, inherited]

Static list of edges.

Deprecated:
Move to MSEdgeControl, make non-static

Definition at line 509 of file MSEdge.h.

Referenced by MSEdge::dictionary().

EdgeBasicFunction MSEdge::myFunction [protected, inherited]

the purpose of the edge

Definition at line 464 of file MSEdge.h.

Referenced by MSEdge::changeLanes(), drawGL(), MSEdge::getPurpose(), MSEdge::initialize(), and MSEdge::prohibits().

bool MSEdge::myHaveClassConstraints [protected, inherited]

Whether any class constraints exist for this edge.

Definition at line 490 of file MSEdge.h.

Referenced by MSEdge::allowedLanes(), MSEdge::prohibits(), and MSEdge::rebuildAllowedLanes().

std::string MSEdge::myID [protected, inherited]

Unique ID.

Definition at line 449 of file MSEdge.h.

Referenced by MSEdge::getID().

MSLaneChanger* MSEdge::myLaneChanger [protected, inherited]

This member will do the lane-change.

Definition at line 461 of file MSEdge.h.

Referenced by MSEdge::changeLanes(), MSEdge::initialize(), and MSEdge::~MSEdge().

List of the edge's lanes geometrical information.

Definition at line 196 of file GUIEdge.h.

Referenced by drawGL(), getBoundary(), getLaneGeometry(), initGeometry(), and ~GUIEdge().

std::vector<MSLane*>* MSEdge::myLanes [protected, inherited]

Container for the edge's lane; should be sorted: (right-hand-traffic) the more left the lane, the higher the container-index.

Definition at line 455 of file MSEdge.h.

Referenced by MSEdge::closeBuilding(), MSEdge::getCurrentTravelTime(), MSEdge::getDepartLane(), MSEdge::getLanes(), getParameterWindow(), initGeometry(), MSEdge::initialize(), MSEdge::leftLane(), MSEdge::prohibits(), MSEdge::rebuildAllowedLanes(), MSEdge::rightLane(), and MSEdge::~MSEdge().

SUMOTime MSEdge::myLastFailedEmissionTime [mutable, protected, inherited]

The time of last emission failure.

Definition at line 470 of file MSEdge.h.

Referenced by MSEdge::getLastFailedEmissionTime(), and MSEdge::setLastFailedEmissionTime().

unsigned int MSEdge::myNumericalID [protected, inherited]

This edge's numerical id.

Definition at line 452 of file MSEdge.h.

Referenced by MSEdge::getNumericalID().

std::vector<MSEdge*> MSEdge::myPredeccesors [protected, inherited]

The preceeding edges.

Definition at line 476 of file MSEdge.h.

Referenced by MSEdge::closeBuilding(), and MSEdge::getIncomingEdges().

std::vector<MSEdge*> MSEdge::mySuccessors [protected, inherited]

The succeeding edges.

Definition at line 473 of file MSEdge.h.

Referenced by MSEdge::addFollower(), MSEdge::closeBuilding(), MSEdge::getFollower(), and MSEdge::getNoFollowing().

int MSEdge::myVaporizationRequests [protected, inherited]

Vaporizer counter.

Definition at line 467 of file MSEdge.h.

Referenced by MSEdge::decVaporization(), MSEdge::incVaporization(), and MSEdge::isVaporizing().


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

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