GUIEmitter Class Reference

#include <GUIEmitter.h>

Inheritance diagram for GUIEmitter:

MSEmitter GUIGlObject_AbstractAdd MSTrigger GUIGlObject Named

Detailed Description

A vehicle emitting device (gui version).

Definition at line 59 of file GUIEmitter.h.


Public Member Functions

virtual bool active () const throw ()
 Returns the information whether this object is still active.
bool childCheckEmit (MSEmitterChild *child)
void drawGLName (const Position2D &p, const std::string &id, SUMOReal nameScale) const
size_t getActiveChildIndex () const
 Returns the index of the currently active child.
const std::string & getID () const throw ()
 Returns the id.
SUMOReal getUserFlow () const
 GUIEmitter (const std::string &id, MSNet &net, MSLane *destLanes, SUMOReal pos, const std::string &file) throw ()
 Constructor.
GUIManipulatoropenManipulator (GUIMainWindow &app, GUISUMOAbstractView &parent)
void schedule (MSEmitterChild *child, MSVehicle *v, SUMOReal speed)
 Schedules a vehicle to emit.
void setActiveChild (MSEmitterChild *child)
 Sets the given child as the currently used one.
void setActiveChild (int index)
void setUserFlow (SUMOReal factor)
void toggleDrawRoutes ()
 ~GUIEmitter () 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.
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.
inherited from GUIGlObject
GUIGlObjectType getType () const throw ()
 Returns the type of the object as coded in GUIGlObjectType.

Static Public Member Functions

static void clearDictionary ()
 Clears the dictionary (the objects will not be deleted).
static GUIGlObject_AbstractAddget (const std::string &name)
 Returns a named object.
static std::vector< GLuint > getIDList ()
 Returns the list of gl-ids of all additional objects.
static const std::vector
< GUIGlObject_AbstractAdd * > & 
getObjectList ()
 Returns the list of all additional objects.

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.

Protected Attributes

MSEmitterChildmyActiveChild
 The currently active child.
MSLanemyDestLane
MSEmitterChildmyFileBasedEmitter
 The file-based child.
GUIGlObjectType myGlType
 The object's type.
std::string myID
 The name of the object.
MSNetmyNet
 The network the emitter is located in.
SUMOReal myPos
 The position of the emitter at the lane.
std::map< MSEmitterChild
*, std::pair< MSVehicle
*, SUMOReal > > 
myToEmit
 A map children->vehicles to emit.

Static Protected Attributes

static std::vector
< GUIGlObject_AbstractAdd * > 
myObjectList
 The list of all addtional objects currently loaded.
static std::map< std::string,
GUIGlObject_AbstractAdd * > 
myObjects
 Map from names of loaded additional objects to the objects themselves.

Private Member Functions

std::map< const MSEdge
*, SUMOReal > 
getEdgeProbs () const

Private Attributes

bool myDrawRoutes
Position2D myFGPosition
 The positions in full-geometry mode.
SUMOReal myFGRotation
 The rotations in full-geometry mode.
MSEmitterChildmyUserEmitChild
SUMOReal myUserFlow

Friends

class GUIGlObjectStorage
 Needed to set the id.

Data Structures

class  GUIEmitterChild_UserTriggeredChild
class  GUIEmitterPopupMenu
class  GUIManip_TriggeredEmitter

Constructor & Destructor Documentation

GUIEmitter::GUIEmitter ( const std::string &  id,
MSNet net,
MSLane destLanes,
SUMOReal  pos,
const std::string &  file 
) throw ()

Constructor.

Parameters:
[in] id The id of the emitter
[in] net The net the emitter belongs to
[in] destLane The lane the emitter is placed on
[in] pos Position of the emitter on the given lane
[in] file Name of the file to read the emission definitions from

Definition at line 297 of file GUIEmitter.cpp.

References Position2DVector::getBegin(), Position2DVector::getEnd(), myFGPosition, myFGRotation, MSEmitter::myFileBasedEmitter, myUserEmitChild, Position2DVector::positionAtLengthPosition(), and Position2DVector::rotationDegreeAtLengthPosition().

00300         : MSEmitter(id, net, destLanes, pos, file),
00301         GUIGlObject_AbstractAdd(GUIGlObjectStorage::gIDStorage,
00302                                 "emitter:" + id, GLO_TRIGGER), myUserFlow(-1), myDrawRoutes(false) {
00303     const Position2DVector &v = destLanes->getShape();
00304     if (pos<0) {
00305         pos = destLanes->getLength()+ pos;
00306     }
00307     myFGPosition = v.positionAtLengthPosition(pos);
00308     Line2D l(v.getBegin(), v.getEnd());
00309     myFGRotation = -v.rotationDegreeAtLengthPosition(pos);
00310 
00311     myUserEmitChild =
00312         new GUIEmitterChild_UserTriggeredChild(
00313         static_cast<MSEmitter_FileTriggeredChild&>(*myFileBasedEmitter),
00314         *this, net.getVehicleControl(), 0);
00315 }

GUIEmitter::~GUIEmitter (  )  throw ()

Destructor.

Definition at line 318 of file GUIEmitter.cpp.

00318 {}


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 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(), 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(), GUITrafficLightLogicWrapper::getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), 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(), GUITrafficLightLogicWrapper::getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUINet::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), 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(), GUITrafficLightLogicWrapper::getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUINet::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), 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(), GUITrafficLightLogicWrapper::getPopUpMenu(), GUIPolygon2D::getPopUpMenu(), GUIPointOfInterest::getPopUpMenu(), GUILaneWrapper::getPopUpMenu(), GUILaneSpeedTrigger::getPopUpMenu(), GUIJunctionWrapper::getPopUpMenu(), 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 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 }

bool MSEmitter::childCheckEmit ( MSEmitterChild child  )  [inherited]

Called by a MSEmitterChild (given as parameter) this method checks whether this child is the currently active one and whether a vehicle from this source can be emitted. Returns true if the child can continue with the next vehicle, false otherwise

Definition at line 312 of file MSEmitter.cpp.

References MSVehicleControl::addVehicle(), MSEdge::emit(), MSNet::getCurrentTimeStep(), MSVehicle::getDesiredDepart(), MSLane::getEdge(), MSVehicle::getID(), MSNet::getInstance(), MSVehicle::getMaxSpeed(), MSLane::getMaxSpeed(), MSNet::getVehicleControl(), MSLane::isEmissionSuccess(), MSEdge::isVaporizing(), MIN2(), MIN3(), MSEmitter::myActiveChild, MSEmitter::myDestLane, MSEmitter::myNet, MSEmitter::myPos, MSEmitter::myToEmit, MSVehicle::onDepart(), and SUMOReal.

Referenced by MSEmitter::MSEmitter_FileTriggeredChild::execute(), MSEmitter::MSEmitter_FileTriggeredChild::processNextEntryReaderTriggered(), and GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().

00312                                                {
00313     if (myToEmit.find(child)==myToEmit.end()) {
00314         // should not happen - a child is calling and should have a vehicle added
00315         throw 1;
00316     }
00317     if (child!=myActiveChild||myDestLane->getEdge().isVaporizing()) {
00318         // check whether this is due to vaporization
00319         if (myDestLane->getEdge().isVaporizing()) {
00320             myToEmit[child].first->setWasVaporized(true);
00321         }
00322         // remove the vehicle previously inserted by the child
00323         delete myToEmit[child].first;
00324         // erase the child information
00325         myToEmit.erase(myToEmit.find(child));
00326         // inform child to process the next one (the current was not used)
00327         return true;
00328     }
00329     // get the vehicle and the speed the child has read/generated
00330     MSVehicle *veh = myToEmit[child].first;
00331     if (veh->getDesiredDepart()>MSNet::getInstance()->getCurrentTimeStep()) {
00332         return false;
00333     }
00334     SUMOReal speed = myToEmit[child].second;
00335     // !!! add warning if speed to high or negative
00336     // check whether the speed shall be patched
00337     SUMOReal pos = myPos;
00338     if (speed<0) {
00339         speed = MIN2(myDestLane->getMaxSpeed(), veh->getMaxSpeed());
00340     } else {
00341         speed = MIN3(myDestLane->getMaxSpeed(), veh->getMaxSpeed(), speed);
00342     }
00343     // try to emit
00344 #ifdef HAVE_MESOSIM
00345     if (MSGlobals::gUseMesoSim) {
00346         if (myDestLane->getEdge().emit(*veh,  myNet.getCurrentTimeStep())) {
00347             veh->onDepart();
00348             // insert vehicle into the dictionary
00349             if (!myNet.getVehicleControl().addVehicle(veh->getID(), veh)) {
00350                 // !!!
00351                 throw 1;
00352             }
00353             // erase the child information
00354             myToEmit.erase(myToEmit.find(child));
00355             return true;
00356         }
00357     } else {
00358 #endif
00359         if (myDestLane->isEmissionSuccess(veh, speed, pos, true)) {
00360             veh->onDepart();
00361             // insert vehicle into the dictionary
00362             if (!myNet.getVehicleControl().addVehicle(veh->getID(), veh)) {
00363                 // !!!
00364                 throw 1;
00365             }
00366             // erase the child information
00367             myToEmit.erase(myToEmit.find(child));
00368             return true;
00369         }
00370 #ifdef HAVE_MESOSIM
00371     }
00372 #endif
00373     return false;
00374 }

void GUIGlObject_AbstractAdd::clearDictionary (  )  [static, inherited]

Clears the dictionary (the objects will not be deleted).

!! delete (*i).second;

Definition at line 82 of file GUIGlObject_AbstractAdd.cpp.

References GUIGlObject_AbstractAdd::myObjectList, and GUIGlObject_AbstractAdd::myObjects.

Referenced by GUINet::~GUINet().

00082                                          {
00083     std::map<std::string, GUIGlObject_AbstractAdd*>::iterator i;
00084     for (i=myObjects.begin(); i!=myObjects.end(); i++) {
00086     }
00087     myObjects.clear();
00088     myObjectList.clear();
00089 }

void GUIEmitter::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 409 of file GUIEmitter.cpp.

References GLHelper::drawBoxLines(), GUIGlObject_AbstractAdd::drawGLName(), getCenteringBoundary(), getEdgeProbs(), GUIGlObject::getGlID(), GUIEdge::getLaneGeometry(), getMicrosimID(), GUILaneWrapper::getShape(), GUILaneWrapper::getShapeLengths(), GUILaneWrapper::getShapeRotations(), myDrawRoutes, myFGPosition, myFGRotation, Position2D::x(), and Position2D::y().

00409                                                                   {
00410     // (optional) set id
00411     if (s.needsGlID) {
00412         glPushName(getGlID());
00413     }
00414     glPushMatrix();
00415     glTranslated(myFGPosition.x(), myFGPosition.y(), 0);
00416     glScaled(s.addExaggeration, s.addExaggeration, 1);
00417     glRotated(myFGRotation, 0, 0, 1);
00418 
00419     glColor3d(1, 0, 0);
00420     // base
00421     glTranslated(0, 0, -.03);
00422     glBegin(GL_TRIANGLES);
00423     glVertex2d(0-1.5, 0);
00424     glVertex2d(0-1.5, 8);
00425     glVertex2d(0+1.5, 8);
00426     glVertex2d(0+1.5, 0);
00427     glVertex2d(0-1.5, 0);
00428     glVertex2d(0+1.5, 8);
00429     glEnd();
00430 
00431     // arrows
00432     glTranslated(0, 0, -.01);
00433     glBegin(GL_TRIANGLES);
00434     glColor3d(1, 1, 0);
00435     glVertex2d(0, 1-.5);
00436     glVertex2d(0-1.25, 1+2-.5);
00437     glVertex2d(0+1.25, 1+2-.5);
00438 
00439     glVertex2d(0, 3-.5);
00440     glVertex2d(0-1.25, 3+2-.5);
00441     glVertex2d(0+1.25, 3+2-.5);
00442 
00443     glVertex2d(0, 5-.5);
00444     glVertex2d(0-1.25, 5+2-.5);
00445     glVertex2d(0+1.25, 5+2-.5);
00446 
00447     glEnd();
00448     glTranslated(0, 0, .04);
00449     glPopMatrix();
00450 
00451     if (myDrawRoutes) {
00452         std::map<const MSEdge*, SUMOReal> e2prob = getEdgeProbs();
00453         for (std::map<const MSEdge*, SUMOReal>::iterator k=e2prob.begin(); k!=e2prob.end(); ++k) {
00454             double c = (*k).second;
00455             glColor3d(1.-c, 1.-c, 0);
00456             const MSEdge *e = (*k).first;
00457             const GUIEdge *ge = static_cast<const GUIEdge*>(e);
00458             const GUILaneWrapper &lane = ge->getLaneGeometry((size_t) 0);
00459             GLHelper::drawBoxLines(lane.getShape(), lane.getShapeRotations(), lane.getShapeLengths(), 0.5);
00460         }
00461     }
00462     // (optional) draw name
00463     if (s.drawAddName) {
00464         drawGLName(getCenteringBoundary().getCenter(), getMicrosimID(), s.addNameSize / s.scale);
00465     }
00466     // (optional) clear id
00467     if (s.needsGlID) {
00468         glPopName();
00469     }
00470 }

void GUIGlObject_AbstractAdd::drawGLName ( const Position2D p,
const std::string &  id,
SUMOReal  nameScale 
) const [inherited]

Definition at line 120 of file GUIGlObject_AbstractAdd.cpp.

References pfdkGetStringWidth(), pfDrawString(), pfSetPosition(), pfSetScale(), SUMOReal, Position2D::x(), and Position2D::y().

Referenced by GUILaneSpeedTrigger::drawGL(), GUIInductLoop::MyWrapper::drawGL(), drawGL(), GUIE3Collector::MyWrapper::drawGL(), GUIBusStop::drawGL(), and GUI_E2_ZS_Collector::MyWrapper::drawGL().

00120                                                                                                       {
00121     glPolygonOffset(0, -6);
00122     glPushMatrix();
00123     glTranslated(p.x(), p.y(), 0);
00124     glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
00125     pfSetPosition(0, 0);
00126     pfSetScale(nameScale);
00127     SUMOReal w = pfdkGetStringWidth(id.c_str());
00128     glRotated(180, 1, 0, 0);
00129     glTranslated(-w/2., 0.4, 0);
00130     pfDrawString(id.c_str());
00131     glPopMatrix();
00132 }

GUIGlObject_AbstractAdd * GUIGlObject_AbstractAdd::get ( const std::string &  name  )  [static, inherited]

Returns a named object.

Definition at line 93 of file GUIGlObject_AbstractAdd.cpp.

References GUIGlObject_AbstractAdd::myObjects.

00093                                                   {
00094     std::map<std::string, GUIGlObject_AbstractAdd*>::iterator i =
00095         myObjects.find(name);
00096     if (i==myObjects.end()) {
00097         return 0;
00098     }
00099     return (*i).second;
00100 }

size_t MSEmitter::getActiveChildIndex (  )  const [inherited]

Returns the index of the currently active child.

Definition at line 386 of file MSEmitter.cpp.

References MSEmitter::myActiveChild, and MSEmitter::myFileBasedEmitter.

Referenced by GUIEmitter::GUIManip_TriggeredEmitter::GUIManip_TriggeredEmitter().

00386                                      {
00387     return
00388         myFileBasedEmitter==myActiveChild ? 0 : 1;
00389 }

Boundary GUIEmitter::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 474 of file GUIEmitter.cpp.

References Boundary::grow(), myFGPosition, Position2D::x(), and Position2D::y().

Referenced by drawGL().

00474                                                {
00475     Boundary b(myFGPosition.x(), myFGPosition.y(), myFGPosition.x(), myFGPosition.y());
00476     b.grow(20);
00477     return b;
00478 }

std::map< const MSEdge *, SUMOReal > GUIEmitter::getEdgeProbs (  )  const [private]

Definition at line 386 of file GUIEmitter.cpp.

References MSRoute::begin(), MSRoute::end(), RandomDistributor< T >::getProbs(), MSEmitter::MSEmitterChild::getRouteDist(), RandomDistributor< T >::getVals(), MSEmitter::myFileBasedEmitter, and SUMOReal.

Referenced by drawGL().

00386                                {
00387     std::map<const MSEdge*, SUMOReal> ret;
00388     const std::vector<const MSRoute*> &routes = myFileBasedEmitter->getRouteDist().getVals();
00389     const std::vector<SUMOReal> &probs = myFileBasedEmitter->getRouteDist().getProbs();
00390     size_t j;
00391 
00392     for (j=0; j<routes.size(); ++j) {
00393         SUMOReal prob = probs[j];
00394         const MSRoute *r = routes[j];
00395         MSRouteIterator i = r->begin();
00396         for (; i!=r->end(); ++i) {
00397             const MSEdge *e = *i;
00398             if (ret.find(e)==ret.end()) {
00399                 ret[e] = 0;
00400             }
00401             ret[e] = ret[e] + prob;
00402         }
00403     }
00404     return ret;
00405 }

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

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

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

Returns the id.

Returns:
The stored id

Definition at line 59 of file Named.h.

References Named::myID.

Referenced by RORouteDef_Alternatives::addAlternative(), MSRouteProbe::addRoute(), MSEmitter::MSEmitter_FileTriggeredChild::buildAndScheduleFlowVehicle(), MSCalibrator::MSCalibrator_FileTriggeredChild::buildAndScheduleFlowVehicle(), RORouteDef_Complete::buildCurrentRoute(), ODDistrictHandler::closeDistrict(), NBTrafficLightDefinition::collectLinks(), NBTrafficLightDefinition::compute(), GUIPointOfInterest::drawGL(), MSInductLoop::enterDetectorByMove(), MSVTypeProbe::execute(), MSNet::getBusStopID(), GUITriggeredRerouter::getMicrosimID(), GUIPointOfInterest::getMicrosimID(), GUILaneSpeedTrigger::getMicrosimID(), GUIInductLoop::MyWrapper::getMicrosimID(), getMicrosimID(), GUIBusStop::getMicrosimID(), GUI_E2_ZS_Collector::MyWrapper::getMicrosimID(), traci::TraCIServer::handlePoiDomain(), RORDLoader_SUMOBase::myCharacters(), NBOwnTLDef::myCompute(), NBLoadedTLDef::myCompute(), MSTriggeredRerouter::myStartElement(), MSLaneSpeedTrigger::myStartElement(), MSEmitter::MSEmitter_FileTriggeredChild::myStartElement(), MSCalibrator::MSCalibrator_FileTriggeredChild::myStartElement(), NBLoadedTLDef::SignalGroup::patchTYellow(), TraCIServerAPI_Vehicle::processGet(), MSVehicle::replaceRoute(), MSVehicle::saveState(), NBOwnTLDef::setTLControllingInformation(), NBLoadedTLDef::setTLControllingInformation(), RORDLoader_SUMOBase::startRoute(), GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute(), NBTrafficLightLogic::writeXML(), MSRouteProbe::writeXMLOutput(), MSInductLoop::writeXMLOutput(), MSE2Collector::writeXMLOutput(), and MSVehicle::~MSVehicle().

00059                                            {
00060         return myID;
00061     }

std::vector< GLuint > GUIGlObject_AbstractAdd::getIDList (  )  [static, inherited]

Returns the list of gl-ids of all additional objects.

Definition at line 110 of file GUIGlObject_AbstractAdd.cpp.

References GUIGlObject_AbstractAdd::myObjectList.

Referenced by FXIMPLEMENT().

00110                                    {
00111     std::vector<GLuint> ret;
00112     for (std::vector<GUIGlObject_AbstractAdd*>::iterator i=myObjectList.begin(); i!=myObjectList.end(); ++i) {
00113         ret.push_back((*i)->getGlID());
00114     }
00115     return ret;
00116 }

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

Returns the id of the object as known to microsim.

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

Implements GUIGlObject.

Definition at line 374 of file GUIEmitter.cpp.

References Named::getID().

Referenced by drawGL().

00374                                         {
00375     return getID();
00376 }

const std::vector< GUIGlObject_AbstractAdd * > & GUIGlObject_AbstractAdd::getObjectList (  )  [static, inherited]

Returns the list of all additional objects.

Definition at line 104 of file GUIGlObject_AbstractAdd.cpp.

References GUIGlObject_AbstractAdd::myObjectList.

Referenced by GUINet::initGUIStructures().

00104                                        {
00105     return myObjectList;
00106 }

GUIParameterTableWindow * GUIEmitter::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 367 of file GUIEmitter.cpp.

00368                                                               {
00369     return 0;
00370 }

GUIGLObjectPopupMenu * GUIEmitter::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 345 of file GUIEmitter.cpp.

References GUIGlObject::buildCenterPopupEntry(), GUIGlObject::buildNameCopyPopupEntry(), GUIGlObject::buildPopupHeader(), GUIGlObject::buildPositionCopyEntry(), GUIGlObject::buildSelectionPopupEntry(), GUIGlObject::buildShowManipulatorPopupEntry(), GUIIconSubSys::getIcon(), ICON_MANIP, MID_DRAWROUTE, and myDrawRoutes.

00346                                                               {
00347     GUIGLObjectPopupMenu *ret = new GUIEmitterPopupMenu(app, parent, *this);
00348     buildPopupHeader(ret, app);
00349     buildCenterPopupEntry(ret);
00350     //
00351     buildShowManipulatorPopupEntry(ret, false);
00352     if (!myDrawRoutes) {
00353         new FXMenuCommand(ret, "Show Routes...", GUIIconSubSys::getIcon(ICON_MANIP), ret, MID_DRAWROUTE);
00354     } else {
00355         new FXMenuCommand(ret, "Hide Routes...", GUIIconSubSys::getIcon(ICON_MANIP), ret, MID_DRAWROUTE);
00356     }
00357     new FXMenuSeparator(ret);
00358     //
00359     buildNameCopyPopupEntry(ret);
00360     buildSelectionPopupEntry(ret);
00361     buildPositionCopyEntry(ret, false);
00362     return ret;
00363 }

GUIGlObjectType GUIGlObject_AbstractAdd::getType (  )  const throw () [virtual, inherited]

Returns the type of the object as coded in GUIGlObjectType.

Returns:
The type of the object
See also:
GUIGlObjectType

Implements GUIGlObject.

Reimplemented in GUIDetectorWrapper.

Definition at line 76 of file GUIGlObject_AbstractAdd.cpp.

References GUIGlObject_AbstractAdd::myGlType.

00076                                                {
00077     return myGlType;
00078 }

SUMOReal GUIEmitter::getUserFlow (  )  const

Definition at line 336 of file GUIEmitter.cpp.

References MSEmitter::myFileBasedEmitter, and myUserFlow.

Referenced by GUIEmitter::GUIManip_TriggeredEmitter::GUIManip_TriggeredEmitter().

00336                               {
00337     if (myUserFlow<0&&static_cast<MSEmitter_FileTriggeredChild*>(myFileBasedEmitter)->getLoadedFlow()>0) {
00338         myUserFlow = static_cast<MSEmitter_FileTriggeredChild*>(myFileBasedEmitter)->getLoadedFlow();
00339     }
00340     return myUserFlow;
00341 }

GUIManipulator * GUIEmitter::openManipulator ( GUIMainWindow app,
GUISUMOAbstractView parent 
)

Definition at line 482 of file GUIEmitter.cpp.

References GUIGlObject::getFullName().

Referenced by GUIEmitter::GUIEmitterPopupMenu::onCmdOpenManip().

00483                                                    {
00484     GUIManip_TriggeredEmitter *gui =
00485         new GUIManip_TriggeredEmitter(app, getFullName(), *this, 0, 0);
00486     gui->create();
00487     gui->show();
00488     return gui;
00489 }

void MSEmitter::schedule ( MSEmitterChild child,
MSVehicle v,
SUMOReal  speed 
) [inherited]

void MSEmitter::setActiveChild ( MSEmitterChild child  )  [inherited]

Sets the given child as the currently used one.

Definition at line 393 of file MSEmitter.cpp.

References MSEmitter::myActiveChild.

00393                                            {
00394     myActiveChild = c;
00395 }

void GUIEmitter::setActiveChild ( int  index  ) 

Definition at line 493 of file GUIEmitter.cpp.

References MSEmitter::myActiveChild, MSEmitter::myFileBasedEmitter, and myUserEmitChild.

Referenced by GUIEmitter::GUIManip_TriggeredEmitter::onCmdChangeOption(), and GUIEmitter::GUIManip_TriggeredEmitter::onCmdUserDef().

00493                                     {
00494     switch (index) {
00495     case 0:
00496         myActiveChild = myFileBasedEmitter;
00497         break;
00498     case 1:
00499         myActiveChild = myUserEmitChild;
00500         break;
00501     }
00502 }

void GUIEmitter::setUserFlow ( SUMOReal  factor  ) 

Definition at line 322 of file GUIEmitter.cpp.

References MSNet::getVehicleControl(), MSEmitter::myFileBasedEmitter, MSEmitter::myNet, myUserEmitChild, and myUserFlow.

Referenced by GUIEmitter::GUIManip_TriggeredEmitter::onCmdChangeOption(), and GUIEmitter::GUIManip_TriggeredEmitter::onCmdUserDef().

00322                                        {
00323     // !!! the commands should be adapted to current flow imediatly
00324     myUserFlow = factor;
00325     if (myUserFlow>0) {
00326         delete myUserEmitChild;
00327         myUserEmitChild =
00328             new GUIEmitterChild_UserTriggeredChild(
00329             static_cast<MSEmitter_FileTriggeredChild&>(*myFileBasedEmitter),
00330             *this, myNet.getVehicleControl(), factor);
00331     }
00332 }

void GUIEmitter::toggleDrawRoutes (  ) 

Definition at line 380 of file GUIEmitter.cpp.

References myDrawRoutes.

Referenced by GUIEmitter::GUIEmitterPopupMenu::onCmdDrawRoute().

00380                              {
00381     myDrawRoutes = !myDrawRoutes;
00382 }


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

MSEmitterChild* MSEmitter::myActiveChild [protected, inherited]

MSLane* MSEmitter::myDestLane [protected, inherited]

the lane the emitter is placed on

Definition at line 275 of file MSEmitter.h.

Referenced by MSEmitter::childCheckEmit().

Definition at line 235 of file GUIEmitter.h.

Referenced by drawGL(), getPopUpMenu(), and toggleDrawRoutes().

The positions in full-geometry mode.

Definition at line 226 of file GUIEmitter.h.

Referenced by drawGL(), getCenteringBoundary(), and GUIEmitter().

SUMOReal GUIEmitter::myFGRotation [private]

The rotations in full-geometry mode.

Definition at line 229 of file GUIEmitter.h.

Referenced by drawGL(), and GUIEmitter().

The object's type.

Definition at line 85 of file GUIGlObject_AbstractAdd.h.

Referenced by GUIGlObject_AbstractAdd::getType().

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

MSNet& MSEmitter::myNet [protected, inherited]

The network the emitter is located in.

Definition at line 272 of file MSEmitter.h.

Referenced by MSEmitter::childCheckEmit(), and setUserFlow().

std::vector< GUIGlObject_AbstractAdd * > GUIGlObject_AbstractAdd::myObjectList [static, protected, inherited]

The list of all addtional objects currently loaded.

Definition at line 92 of file GUIGlObject_AbstractAdd.h.

Referenced by GUIGlObject_AbstractAdd::clearDictionary(), GUIGlObject_AbstractAdd::getIDList(), and GUIGlObject_AbstractAdd::getObjectList().

std::map< std::string, GUIGlObject_AbstractAdd * > GUIGlObject_AbstractAdd::myObjects [static, protected, inherited]

Map from names of loaded additional objects to the objects themselves.

Definition at line 89 of file GUIGlObject_AbstractAdd.h.

Referenced by GUIGlObject_AbstractAdd::clearDictionary(), and GUIGlObject_AbstractAdd::get().

SUMOReal MSEmitter::myPos [protected, inherited]

The position of the emitter at the lane.

Definition at line 278 of file MSEmitter.h.

Referenced by MSEmitter::childCheckEmit(), and MSEmitter::MSEmitter().

std::map<MSEmitterChild*, std::pair<MSVehicle*, SUMOReal> > MSEmitter::myToEmit [protected, inherited]

A map children->vehicles to emit.

Definition at line 284 of file MSEmitter.h.

Referenced by MSEmitter::childCheckEmit(), MSEmitter::schedule(), and MSEmitter::~MSEmitter().

Definition at line 233 of file GUIEmitter.h.

Referenced by GUIEmitter(), setActiveChild(), and setUserFlow().

SUMOReal GUIEmitter::myUserFlow [mutable, private]

Definition at line 231 of file GUIEmitter.h.

Referenced by getUserFlow(), and setUserFlow().


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