GUIEmitter.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A vehicle emitting device (gui version)
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef GUIEmitter_h
00020 #define GUIEmitter_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <vector>
00033 #include <string>
00034 #include <utils/common/Command.h>
00035 #include <microsim/trigger/MSEmitter.h>
00036 #include <utils/gui/globjects/GUIGlObject.h>
00037 #include <utils/gui/globjects/GUIGlObject_AbstractAdd.h>
00038 #include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
00039 #include <utils/geom/Position2D.h>
00040 #include <gui/GUIManipulator.h>
00041 #include <utils/foxtools/FXRealSpinDial.h>
00042 
00043 
00044 // ===========================================================================
00045 // class declarations
00046 // ===========================================================================
00047 class MSNet;
00048 class MSLane;
00049 class GUIManipulator;
00050 
00051 
00052 // ===========================================================================
00053 // class definitions
00054 // ===========================================================================
00059 class GUIEmitter : public MSEmitter, public GUIGlObject_AbstractAdd {
00060 public:
00069     GUIEmitter(const std::string &id, MSNet &net,
00070                MSLane* destLanes, SUMOReal pos,
00071                const std::string &file) throw();
00072 
00073 
00075     ~GUIEmitter() throw();
00076 
00077 
00078 
00080 
00081 
00089     GUIGLObjectPopupMenu *getPopUpMenu(GUIMainWindow &app,
00090                                        GUISUMOAbstractView &parent) throw();
00091 
00092 
00100     GUIParameterTableWindow *getParameterWindow(GUIMainWindow &app,
00101             GUISUMOAbstractView &parent) throw();
00102 
00103 
00109     const std::string &getMicrosimID() const throw();
00110 
00111 
00117     Boundary getCenteringBoundary() const throw();
00118 
00119 
00124     void drawGL(const GUIVisualizationSettings &s) const throw();
00126 
00127 
00128 
00129 
00130     GUIManipulator *openManipulator(GUIMainWindow &app,
00131                                     GUISUMOAbstractView &parent);
00132 
00133     void setUserFlow(SUMOReal factor);
00134     SUMOReal getUserFlow() const;
00135 
00136     void setActiveChild(int index);
00137 
00138     void toggleDrawRoutes();
00139 
00140 protected:
00141     class GUIEmitterChild_UserTriggeredChild : public MSEmitter::MSEmitterChild {
00142     public:
00143         GUIEmitterChild_UserTriggeredChild(
00144             MSEmitter_FileTriggeredChild &s, MSEmitter &parent,
00145             MSVehicleControl &vc, SUMOReal flow) throw();
00146         virtual ~GUIEmitterChild_UserTriggeredChild() throw();
00147         SUMOTime wrappedExecute(SUMOTime currentTime) throw(ProcessError);
00148         SUMOReal getUserFlow() const;
00149 
00150     protected:
00151         SUMOReal myUserFlow;
00152         MSVehicle *myVehicle;
00153         MSEmitter_FileTriggeredChild &mySource;
00154 
00155     };
00156 
00157 public:
00158     class GUIEmitterPopupMenu : public GUIGLObjectPopupMenu {
00159         FXDECLARE(GUIEmitterPopupMenu)
00160     public:
00161 
00162         GUIEmitterPopupMenu(GUIMainWindow &app,
00163                             GUISUMOAbstractView &parent, GUIGlObject &o);
00164 
00165         ~GUIEmitterPopupMenu() throw();
00166 
00168         long onCmdOpenManip(FXObject*,FXSelector,void*);
00169 
00170         long onCmdDrawRoute(FXObject*,FXSelector,void*);
00171 
00172     protected:
00173         GUIEmitterPopupMenu() { }
00174 
00175     };
00176 
00177     class GUIManip_TriggeredEmitter : public GUIManipulator {
00178         FXDECLARE(GUIManip_TriggeredEmitter)
00179     public:
00180         enum {
00181             MID_USER_DEF = FXDialogBox::ID_LAST,
00182             MID_PRE_DEF,
00183             MID_OPTION,
00184             MID_CLOSE,
00185             ID_LAST
00186         };
00188         GUIManip_TriggeredEmitter(GUIMainWindow &app,
00189                                   const std::string &name, GUIEmitter &o,
00190                                   int xpos, int ypos);
00191 
00193         virtual ~GUIManip_TriggeredEmitter();
00194 
00195         long onCmdOverride(FXObject*,FXSelector,void*);
00196         long onCmdClose(FXObject*,FXSelector,void*);
00197         long onCmdUserDef(FXObject*,FXSelector,void*);
00198         long onUpdUserDef(FXObject*,FXSelector,void*);
00199         long onCmdChangeOption(FXObject*,FXSelector,void*);
00200 
00201     private:
00202         GUIMainWindow *myParent;
00203 
00204         FXint myChosenValue;
00205 
00206         FXDataTarget myChosenTarget;
00207 
00208         SUMOReal myFlowFactor;
00209 
00210         FXDataTarget myFlowFactorTarget;
00211 
00212         FXRealSpinDial *myFlowFactorDial;
00213 
00214         GUIEmitter *myObject;
00215 
00216     protected:
00217         GUIManip_TriggeredEmitter() { }
00218 
00219     };
00220 
00221 private:
00222     std::map<const MSEdge*, SUMOReal> getEdgeProbs() const;
00223 
00224 private:
00226     Position2D myFGPosition;
00227 
00229     SUMOReal myFGRotation;
00230 
00231     mutable SUMOReal myUserFlow;
00232 
00233     MSEmitterChild *myUserEmitChild;
00234 
00235     bool myDrawRoutes;
00236 
00237 };
00238 
00239 
00240 #endif
00241 
00242 /****************************************************************************/
00243 

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