|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // An edge imported from Vissim together for a container for 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 NIVissimDistrictConnection_h 00020 #define NIVissimDistrictConnection_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 <map> 00033 #include <string> 00034 #include <utils/geom/Position.h> 00035 #include <utils/common/VectorHelper.h> 00036 00037 00038 class NBDistrictCont; 00039 class NBEdgeCont; 00040 00041 00042 // =========================================================================== 00043 // class definitions 00044 // =========================================================================== 00045 class NIVissimDistrictConnection { 00046 public: 00048 NIVissimDistrictConnection(int id, const std::string& name, 00049 const IntVector& districts, const DoubleVector& percentages, 00050 int edgeid, SUMOReal position, 00051 const std::vector<std::pair<int, int> > &assignedVehicles); 00052 00053 // Destructor 00054 ~NIVissimDistrictConnection(); 00055 00058 Position geomPosition() const; 00059 00061 int getID() const { 00062 return myID; 00063 } 00064 00066 SUMOReal getPosition() const { 00067 return myPosition; 00068 } 00069 00070 SUMOReal getMeanSpeed(/*NBDistribution &dc*/) const; 00071 00072 public: 00074 static bool dictionary(int id, const std::string& name, 00075 const IntVector& districts, const DoubleVector& percentages, 00076 int edgeid, SUMOReal position, 00077 const std::vector<std::pair<int, int> > &assignedVehicles); 00078 00080 static bool dictionary(int id, NIVissimDistrictConnection* o); 00081 00083 static NIVissimDistrictConnection* dictionary(int id); 00084 00086 static void dict_BuildDistrictNodes(NBDistrictCont& dc, 00087 NBNodeCont& nc); 00088 00090 static void dict_BuildDistricts(NBDistrictCont& dc, 00091 NBEdgeCont& ec, NBNodeCont& nc/*, NBDistribution &distc*/); 00092 00095 static NIVissimDistrictConnection* dict_findForEdge(int edgeid); 00096 00098 static void clearDict(); 00099 00100 static void dict_BuildDistrictConnections(); 00101 00102 static void dict_CheckEdgeEnds(); 00103 00104 00105 private: 00106 void checkEdgeEnd(); 00107 SUMOReal getRealSpeed(/*NBDistribution &dc, */int distNo) const; 00108 00109 private: 00111 int myID; 00112 00114 std::string myName; 00115 00117 IntVector myDistricts; 00118 00120 typedef std::map<int, SUMOReal> DistrictPercentages; 00121 00123 DistrictPercentages myPercentages; 00124 00126 int myEdgeID; 00127 00129 SUMOReal myPosition; 00130 00132 std::vector<std::pair<int, int> > myAssignedVehicles; 00133 00134 private: 00136 typedef std::map<int, NIVissimDistrictConnection*> DictType; 00137 00139 static DictType myDict; 00140 00142 static std::map<int, IntVector> myDistrictsConnections; 00143 00144 }; 00145 00146 00147 #endif 00148 00149 /****************************************************************************/ 00150