GUINet.h
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GUINet_h
00020 #define GUINet_h
00021
00022
00023
00024
00025
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031
00032 #include <string>
00033 #include <utility>
00034 #include <microsim/MSNet.h>
00035 #include <utils/geom/Boundary.h>
00036 #include <utils/geom/Position2D.h>
00037 #include <foreign/rtree/SUMORTree.h>
00038 #include <utils/geom/Position2DVector.h>
00039 #include <utils/gui/globjects/GUIGlObjectStorage.h>
00040 #include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
00041 #include <utils/gui/globjects/GUIGlObject.h>
00042
00043 #ifdef _WIN32
00044 #include <windows.h>
00045 #endif
00046
00047 #include <GL/gl.h>
00048
00049
00050
00051
00052
00053 class MSEdgeControl;
00054 class MSJunctionControl;
00055 class MSRouteLoaderControl;
00056 class MSTLLogicControl;
00057 class MSTrafficLightLogic;
00058 class MSLink;
00059 class GUIJunctionWrapper;
00060 class GUIDetectorWrapper;
00061 class GUITrafficLightLogicWrapper;
00062 class RGBColor;
00063 class GUIEdge;
00064 class OutputDevice;
00065 class GUIVehicle;
00066 class MSVehicleControl;
00067
00068
00069
00070
00071
00087 class GUINet : public MSNet, public GUIGlObject {
00088 public:
00096 GUINet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents,
00097 MSEventControl *endOfTimestepEvents, MSEventControl *emissionEvents) throw(ProcessError);
00098
00099
00101 ~GUINet() throw();
00102
00103
00104
00106
00107
00115 GUIGLObjectPopupMenu *getPopUpMenu(GUIMainWindow &app,
00116 GUISUMOAbstractView &parent) throw();
00117
00118
00126 GUIParameterTableWindow *getParameterWindow(
00127 GUIMainWindow &app, GUISUMOAbstractView &parent) throw();
00128
00129
00135 const std::string &getMicrosimID() const throw();
00136
00137
00144 GUIGlObjectType getType() const throw() {
00145 return GLO_NETWORK;
00146 }
00147
00153 Boundary getCenteringBoundary() const throw();
00154
00155
00160 void drawGL(const GUIVisualizationSettings &s) const throw();
00162
00163
00165 const Boundary &getBoundary() const;
00166
00168 Position2D getJunctionPosition(const std::string &name) const;
00169
00171 bool vehicleExists(const std::string &name) const;
00172
00174 Boundary getEdgeBoundary(const std::string &name) const;
00175
00177 void guiSimulationStep();
00178
00179
00182
00186 unsigned int getWholeDuration() const throw();
00187
00188
00192 unsigned int getSimDuration() const throw();
00193
00194
00196 SUMOReal getRTFactor() const;
00197
00199 SUMOReal getUPS() const;
00200
00202 SUMOReal getMeanRTFactor(int duration) const;
00203
00205 SUMOReal getMeanUPS() const;
00206
00207
00208
00209
00211 unsigned int getIdleDuration() const throw();
00212
00214 void setSimDuration(int val);
00215
00216
00217
00218
00220 void setIdleDuration(int val);
00221
00222
00223
00226 unsigned int getLinkTLID(MSLink *link) const;
00227
00230 int getLinkTLIndex(MSLink *link) const;
00231
00232
00234
00235
00237 std::vector<GLuint> getJunctionIDs() const;
00238
00240 std::vector<GLuint> getTLSIDs() const;
00241
00243 std::vector<GLuint> getShapeIDs() const;
00245
00246
00248 void initGUIStructures();
00249
00250
00251 friend class GUIViewTraffic;
00252
00253
00254 private:
00256 void initDetectors();
00257
00259 void initTLMap();
00260
00261 protected:
00263 SUMORTree *myGrid;
00264
00266 Boundary myBoundary;
00267
00269 std::vector<GUIEdge*> myEdgeWrapper;
00270
00272 std::vector<GUIJunctionWrapper*> myJunctionWrapper;
00273
00275 std::vector<MSTrafficLightLogic*> myTLLogicWrappers;
00276
00278 std::map<std::string, GUIDetectorWrapper*> myDetectorDict;
00279
00280
00282 typedef std::map<MSLink*, std::string> Links2LogicMap;
00284 Links2LogicMap myLinks2Logic;
00285
00286
00288 typedef std::map<MSTrafficLightLogic*, GUITrafficLightLogicWrapper*> Logics2WrapperMap;
00290 Logics2WrapperMap myLogics2Wrapper;
00291
00292
00294 unsigned int myLastSimDuration, myLastIdleDuration;
00295
00296 long myLastVehicleMovementCount, myOverallVehicleCount;
00297 long myOverallSimDuration;
00298
00299 };
00300
00301
00302 #endif
00303
00304
00305