SUMO - Simulation of Urban MObility
GUIEdge.h
Go to the documentation of this file.
00001 /****************************************************************************/
00010 // A road/street connecting two junctions (gui-version)
00011 /****************************************************************************/
00012 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00013 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00014 /****************************************************************************/
00015 //
00016 //   This file is part of SUMO.
00017 //   SUMO is free software: you can redistribute it and/or modify
00018 //   it under the terms of the GNU General Public License as published by
00019 //   the Free Software Foundation, either version 3 of the License, or
00020 //   (at your option) any later version.
00021 //
00022 /****************************************************************************/
00023 #ifndef GUIEdge_h
00024 #define GUIEdge_h
00025 
00026 
00027 // ===========================================================================
00028 // included modules
00029 // ===========================================================================
00030 #ifdef _MSC_VER
00031 #include <windows_config.h>
00032 #else
00033 #include <config.h>
00034 #endif
00035 
00036 #include <vector>
00037 #include <string>
00038 #include <microsim/MSEdge.h>
00039 #include <utils/gui/globjects/GUIGlObject.h>
00040 #include "GUILaneWrapper.h"
00041 
00042 
00043 // ===========================================================================
00044 // class definitions
00045 // ===========================================================================
00052 class GUIEdge : public MSEdge, public GUIGlObject {
00053 public:
00059     GUIEdge(const std::string& id, unsigned int numericalID, const std::string& streetName) ;
00060 
00061 
00063     ~GUIEdge() ;
00064 
00065 
00068     void initGeometry() ;
00069 
00070 
00071     /* @brief Returns the gl-ids of all known edges
00072      * @param[in] includeInternal Whether to include ids of internal edges
00073      */
00074     static std::vector<GUIGlID> getIDs(bool includeInternal);
00075 
00077     Boundary getBoundary() const;
00078 
00080     MSLane& getLane(size_t laneNo);
00081 
00082 
00083 
00085     GUILaneWrapper& getLaneGeometry(size_t laneNo) const;
00086 
00087     GUILaneWrapper& getLaneGeometry(const MSLane* lane) const;
00088 
00092     static std::pair<SUMOReal, SUMOReal> getLaneOffsets(SUMOReal x1, SUMOReal y1,
00093             SUMOReal x2, SUMOReal y2, SUMOReal prev, SUMOReal wanted);
00094 
00095     static void fill(std::vector<GUIEdge*> &netsWrappers);
00096 
00097 
00098 
00100 
00101 
00109     virtual GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app,
00110             GUISUMOAbstractView& parent) ;
00111 
00112 
00120     virtual GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app,
00121             GUISUMOAbstractView& parent) ;
00122 
00123 
00129     Boundary getCenteringBoundary() const ;
00130 
00131 
00136     void drawGL(const GUIVisualizationSettings& s) const ;
00138 
00139 
00140 #ifdef HAVE_MESOSIM
00141     unsigned int getVehicleNo() const;
00142     std::string getVehicleIDs() const;
00143     SUMOReal getOccupancy() const;
00144     SUMOReal getMeanSpeed() const;
00145     SUMOReal getAllowedSpeed() const;
00147     SUMOReal getFlow() const;
00149     SUMOReal getFlowAlternative() const;
00151     SUMOReal getRelativeSpeed() const;
00152 
00154     void setColor(const GUIVisualizationSettings& s) const;
00155 
00157     SUMOReal getColorValue(size_t activeScheme) const;
00158 
00159 #endif
00160 
00161 private:
00163     typedef std::vector<GUILaneWrapper*> LaneWrapperVector;
00164 
00166     LaneWrapperVector myLaneGeoms;
00167 
00172     class lane_wrapper_finder {
00173     public:
00175         explicit lane_wrapper_finder(const MSLane& lane) : myLane(lane) { }
00176 
00178         bool operator()(const GUILaneWrapper* const wrapper) {
00179             return wrapper->forLane(myLane);
00180         }
00181 
00182     private:
00183         lane_wrapper_finder& operator=(const lane_wrapper_finder&); // just to avoid a compiler warning
00184     private:
00186         const MSLane& myLane;
00187 
00188     };
00189 
00190 private:
00192     GUIEdge(const GUIEdge& s);
00193 
00195     GUIEdge& operator=(const GUIEdge& s);
00196 
00197 
00198 };
00199 
00200 
00201 #endif
00202 
00203 /****************************************************************************/
00204 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines