SUMO - Simulation of Urban MObility
NIVissimDistrictConnection.h
Go to the documentation of this file.
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 
00038 
00039 class NBDistrictCont;
00040 class NBEdgeCont;
00041 
00042 
00043 // ===========================================================================
00044 // class definitions
00045 // ===========================================================================
00046 class NIVissimDistrictConnection {
00047 public:
00049     NIVissimDistrictConnection(int id, const std::string& name,
00050                                const std::vector<int>& districts, const std::vector<SUMOReal>& percentages,
00051                                int edgeid, SUMOReal position,
00052                                const std::vector<std::pair<int, int> > &assignedVehicles);
00053 
00054     // Destructor
00055     ~NIVissimDistrictConnection();
00056 
00059     Position geomPosition() const;
00060 
00062     int getID() const {
00063         return myID;
00064     }
00065 
00067     SUMOReal getPosition() const {
00068         return myPosition;
00069     }
00070 
00071     SUMOReal getMeanSpeed(/*NBDistribution &dc*/) const;
00072 
00073 public:
00075     static bool dictionary(int id, const std::string& name,
00076                            const std::vector<int>& districts, const std::vector<SUMOReal>& percentages,
00077                            int edgeid, SUMOReal position,
00078                            const std::vector<std::pair<int, int> > &assignedVehicles);
00079 
00081     static bool dictionary(int id, NIVissimDistrictConnection* o);
00082 
00084     static NIVissimDistrictConnection* dictionary(int id);
00085 
00087     static void dict_BuildDistrictNodes(NBDistrictCont& dc,
00088                                         NBNodeCont& nc);
00089 
00091     static void dict_BuildDistricts(NBDistrictCont& dc,
00092                                     NBEdgeCont& ec, NBNodeCont& nc/*, NBDistribution &distc*/);
00093 
00096     static NIVissimDistrictConnection* dict_findForEdge(int edgeid);
00097 
00099     static void clearDict();
00100 
00101     static void dict_BuildDistrictConnections();
00102 
00103     static void dict_CheckEdgeEnds();
00104 
00105 
00106 private:
00107     void checkEdgeEnd();
00108     SUMOReal getRealSpeed(/*NBDistribution &dc, */int distNo) const;
00109 
00110 private:
00112     int myID;
00113 
00115     std::string myName;
00116 
00118     std::vector<int> myDistricts;
00119 
00121     typedef std::map<int, SUMOReal> DistrictPercentages;
00122 
00124     DistrictPercentages myPercentages;
00125 
00127     int myEdgeID;
00128 
00130     SUMOReal myPosition;
00131 
00133     std::vector<std::pair<int, int> > myAssignedVehicles;
00134 
00135 private:
00137     typedef std::map<int, NIVissimDistrictConnection*> DictType;
00138 
00140     static DictType myDict;
00141 
00143     static std::map<int, std::vector<int> > myDistrictsConnections;
00144 
00145 };
00146 
00147 
00148 #endif
00149 
00150 /****************************************************************************/
00151 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines