|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // A road/street connecting two junctions (gui-version) 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 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 <microsim/MSEdge.h> 00035 #include <utils/gui/globjects/GUIGlObject.h> 00036 #include "GUILaneWrapper.h" 00037 00038 00039 // =========================================================================== 00040 // class definitions 00041 // =========================================================================== 00048 class GUIEdge : public MSEdge, public GUIGlObject { 00049 public: 00055 GUIEdge(const std::string& id, unsigned int numericalID, const std::string& streetName) throw(); 00056 00057 00059 ~GUIEdge() throw(); 00060 00061 00064 void initGeometry() throw(); 00065 00066 00067 /* @brief Returns the gl-ids of all known edges 00068 * @param[in] includeInternal Whether to include ids of internal edges 00069 */ 00070 static std::vector<GUIGlID> getIDs(bool includeInternal); 00071 00073 Boundary getBoundary() const; 00074 00076 MSLane& getLane(size_t laneNo); 00077 00078 00079 00081 GUILaneWrapper& getLaneGeometry(size_t laneNo) const; 00082 00083 GUILaneWrapper& getLaneGeometry(const MSLane* lane) const; 00084 00088 static std::pair<SUMOReal, SUMOReal> getLaneOffsets(SUMOReal x1, SUMOReal y1, 00089 SUMOReal x2, SUMOReal y2, SUMOReal prev, SUMOReal wanted); 00090 00091 static void fill(std::vector<GUIEdge*> &netsWrappers); 00092 00093 00094 00096 00097 00105 virtual GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, 00106 GUISUMOAbstractView& parent) throw(); 00107 00108 00116 virtual GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, 00117 GUISUMOAbstractView& parent) throw(); 00118 00119 00125 Boundary getCenteringBoundary() const throw(); 00126 00127 00132 void drawGL(const GUIVisualizationSettings& s) const throw(); 00134 00135 00136 #ifdef HAVE_MESOSIM 00137 unsigned int getVehicleNo() const; 00138 SUMOReal getOccupancy() const; 00139 SUMOReal getMeanSpeed() const; 00140 SUMOReal getAllowedSpeed() const; 00141 SUMOReal getFlow() const; 00142 00144 void setColor(const GUIVisualizationSettings& s) const; 00145 00147 SUMOReal getColorValue(size_t activeScheme) const; 00148 00149 #endif 00150 00151 private: 00153 typedef std::vector<GUILaneWrapper*> LaneWrapperVector; 00154 00156 LaneWrapperVector myLaneGeoms; 00157 00162 class lane_wrapper_finder { 00163 public: 00165 explicit lane_wrapper_finder(const MSLane& lane) : myLane(lane) { } 00166 00168 bool operator()(const GUILaneWrapper* const wrapper) { 00169 return wrapper->forLane(myLane); 00170 } 00171 00172 private: 00173 lane_wrapper_finder& operator=(const lane_wrapper_finder&); // just to avoid a compiler warning 00174 private: 00176 const MSLane& myLane; 00177 00178 }; 00179 00180 private: 00182 GUIEdge(const GUIEdge& s); 00183 00185 GUIEdge& operator=(const GUIEdge& s); 00186 00187 00188 }; 00189 00190 00191 #endif 00192 00193 /****************************************************************************/ 00194