GUIEdge.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A road/street connecting two junctions (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 GUIEdge_h
00020 #define GUIEdge_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/geom/Position2D.h>
00035 #include <utils/geom/Boundary.h>
00036 #include <microsim/MSLane.h>
00037 #include <microsim/MSEdge.h>
00038 #include <utils/gui/globjects/GUIGlObject.h>
00039 #include "GUILaneWrapper.h"
00040 #include <utils/gui/settings/GUIColorer.h>
00041 
00042 #ifdef WIN32
00043 #include <windows.h>
00044 #endif
00045 
00046 #include <GL/gl.h>
00047 
00048 
00049 // ===========================================================================
00050 // class declarations
00051 // ===========================================================================
00052 class MSJunction;
00053 class GUILane;
00054 class GUIBasicLane;
00055 class GUIGlObjectStorage;
00056 
00057 
00058 // ===========================================================================
00059 // class definitions
00060 // ===========================================================================
00067 class GUIEdge : public MSEdge, public GUIGlObject {
00068 public:
00075     GUIEdge(const std::string &id, unsigned int numericalID,
00076             GUIGlObjectStorage &idStorage) throw();
00077 
00078 
00080     ~GUIEdge() throw();
00081 
00082 
00087     void initGeometry(GUIGlObjectStorage &idStorage) throw();
00088 
00089 
00091     static std::vector<GLuint> getIDs();
00092 
00094     Boundary getBoundary() const;
00095 
00097     MSLane &getLane(size_t laneNo);
00098 
00099 
00100 
00102     GUILaneWrapper &getLaneGeometry(size_t laneNo) const;
00103 
00104     GUILaneWrapper &getLaneGeometry(const MSLane *lane) const;
00105 
00109     static std::pair<SUMOReal, SUMOReal> getLaneOffsets(SUMOReal x1, SUMOReal y1,
00110             SUMOReal x2, SUMOReal y2, SUMOReal prev, SUMOReal wanted);
00111 
00112     static void fill(std::vector<GUIEdge*> &netsWrappers);
00113 
00114 
00115 
00117 
00118 
00126     virtual GUIGLObjectPopupMenu *getPopUpMenu(GUIMainWindow &app,
00127             GUISUMOAbstractView &parent) throw();
00128 
00129 
00137     virtual GUIParameterTableWindow *getParameterWindow(GUIMainWindow &app,
00138             GUISUMOAbstractView &parent) throw();
00139 
00140 
00146     const std::string &getMicrosimID() const throw();
00147 
00148 
00155     GUIGlObjectType getType() const throw() {
00156         return GLO_EDGE;
00157     }
00158 
00159 
00165     Boundary getCenteringBoundary() const throw();
00166 
00167 
00172     void drawGL(const GUIVisualizationSettings &s) const throw();
00174 
00175 
00176 #ifdef HAVE_MESOSIM
00177     unsigned int getVehicleNo() const;
00178     SUMOReal getOccupancy() const;
00179     SUMOReal getMeanSpeed() const;
00180     SUMOReal getAllowedSpeed() const;
00181     SUMOReal getFlow() const;
00182 
00183     class Colorer : public GUIColorer<GUIEdge> {
00184     public:
00185         Colorer();
00186         SUMOReal getColorValue(const GUIEdge& edge) const;
00187     };
00188 
00189 #endif
00190 
00191 private:
00193     typedef std::vector<GUILaneWrapper*> LaneWrapperVector;
00194 
00196     LaneWrapperVector myLaneGeoms;
00197 
00202     class lane_wrapper_finder {
00203     public:
00205         explicit lane_wrapper_finder(const MSLane &lane) : myLane(lane) { }
00206 
00208         bool operator()(const GUILaneWrapper * const wrapper) {
00209             return wrapper->forLane(myLane);
00210         }
00211 
00212     private:
00214         const MSLane &myLane;
00215 
00216     };
00217 
00218 private:
00220     GUIEdge(const GUIEdge &s);
00221 
00223     GUIEdge &operator=(const GUIEdge &s);
00224 
00225 
00226 };
00227 
00228 
00229 #endif
00230 
00231 /****************************************************************************/
00232 

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