|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00008 // An edge imported from Vissim together for a container for 00009 /****************************************************************************/ 00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00012 /****************************************************************************/ 00013 // 00014 // This file is part of SUMO. 00015 // SUMO is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 #ifndef NIVissimDistrictConnection_h 00022 #define NIVissimDistrictConnection_h 00023 00024 00025 // =========================================================================== 00026 // included modules 00027 // =========================================================================== 00028 #ifdef _MSC_VER 00029 #include <windows_config.h> 00030 #else 00031 #include <config.h> 00032 #endif 00033 00034 #include <map> 00035 #include <string> 00036 #include <utils/geom/Position.h> 00037 #include <utils/common/VectorHelper.h> 00038 00039 00040 class NBDistrictCont; 00041 class NBEdgeCont; 00042 00043 00044 // =========================================================================== 00045 // class definitions 00046 // =========================================================================== 00047 class NIVissimDistrictConnection { 00048 public: 00050 NIVissimDistrictConnection(int id, const std::string& name, 00051 const IntVector& districts, const DoubleVector& percentages, 00052 int edgeid, SUMOReal position, 00053 const std::vector<std::pair<int, int> > &assignedVehicles); 00054 00055 // Destructor 00056 ~NIVissimDistrictConnection(); 00057 00060 Position geomPosition() const; 00061 00063 int getID() const { 00064 return myID; 00065 } 00066 00068 SUMOReal getPosition() const { 00069 return myPosition; 00070 } 00071 00072 SUMOReal getMeanSpeed(/*NBDistribution &dc*/) const; 00073 00074 public: 00076 static bool dictionary(int id, const std::string& name, 00077 const IntVector& districts, const DoubleVector& percentages, 00078 int edgeid, SUMOReal position, 00079 const std::vector<std::pair<int, int> > &assignedVehicles); 00080 00082 static bool dictionary(int id, NIVissimDistrictConnection* o); 00083 00085 static NIVissimDistrictConnection* dictionary(int id); 00086 00088 static void dict_BuildDistrictNodes(NBDistrictCont& dc, 00089 NBNodeCont& nc); 00090 00092 static void dict_BuildDistricts(NBDistrictCont& dc, 00093 NBEdgeCont& ec, NBNodeCont& nc/*, NBDistribution &distc*/); 00094 00097 static NIVissimDistrictConnection* dict_findForEdge(int edgeid); 00098 00100 static void clearDict(); 00101 00102 static void dict_BuildDistrictConnections(); 00103 00104 static void dict_CheckEdgeEnds(); 00105 00106 00107 private: 00108 void checkEdgeEnd(); 00109 SUMOReal getRealSpeed(/*NBDistribution &dc, */int distNo) const; 00110 00111 private: 00113 int myID; 00114 00116 std::string myName; 00117 00119 IntVector myDistricts; 00120 00122 typedef std::map<int, SUMOReal> DistrictPercentages; 00123 00125 DistrictPercentages myPercentages; 00126 00128 int myEdgeID; 00129 00131 SUMOReal myPosition; 00132 00134 std::vector<std::pair<int, int> > myAssignedVehicles; 00135 00136 private: 00138 typedef std::map<int, NIVissimDistrictConnection*> DictType; 00139 00141 static DictType myDict; 00142 00144 static std::map<int, IntVector> myDistrictsConnections; 00145 00146 }; 00147 00148 00149 #endif 00150 00151 /****************************************************************************/ 00152