SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NIVissimDistrictConnection.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // An edge imported from Vissim together for a container for
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef NIVissimDistrictConnection_h
22 #define NIVissimDistrictConnection_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <map>
35 #include <string>
36 #include <utils/geom/Position.h>
37 
38 
39 class NBDistrictCont;
40 class NBEdgeCont;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
47 public:
49  NIVissimDistrictConnection(int id, const std::string& name,
50  const std::vector<int>& districts, const std::vector<SUMOReal>& percentages,
51  int edgeid, SUMOReal position,
52  const std::vector<std::pair<int, int> >& assignedVehicles);
53 
54  // Destructor
56 
59  Position geomPosition() const;
60 
62  int getID() const {
63  return myID;
64  }
65 
68  return myPosition;
69  }
70 
71  SUMOReal getMeanSpeed(/*NBDistribution &dc*/) const;
72 
73 public:
75  static bool dictionary(int id, const std::string& name,
76  const std::vector<int>& districts, const std::vector<SUMOReal>& percentages,
77  int edgeid, SUMOReal position,
78  const std::vector<std::pair<int, int> >& assignedVehicles);
79 
81  static bool dictionary(int id, NIVissimDistrictConnection* o);
82 
84  static NIVissimDistrictConnection* dictionary(int id);
85 
88  NBNodeCont& nc);
89 
91  static void dict_BuildDistricts(NBDistrictCont& dc,
92  NBEdgeCont& ec, NBNodeCont& nc/*, NBDistribution &distc*/);
93 
96  static NIVissimDistrictConnection* dict_findForEdge(int edgeid);
97 
99  static void clearDict();
100 
101  static void dict_BuildDistrictConnections();
102 
103  static void dict_CheckEdgeEnds();
104 
105 
106 private:
107  void checkEdgeEnd();
108  SUMOReal getRealSpeed(/*NBDistribution &dc, */int distNo) const;
109 
110 private:
112  int myID;
113 
115  std::string myName;
116 
118  std::vector<int> myDistricts;
119 
121  typedef std::map<int, SUMOReal> DistrictPercentages;
122 
125 
127  int myEdgeID;
128 
131 
133  std::vector<std::pair<int, int> > myAssignedVehicles;
134 
135 private:
137  typedef std::map<int, NIVissimDistrictConnection*> DictType;
138 
140  static DictType myDict;
141 
143  static std::map<int, std::vector<int> > myDistrictsConnections;
144 
145 };
146 
147 
148 #endif
149 
150 /****************************************************************************/
151 
static void dict_BuildDistricts(NBDistrictCont &dc, NBEdgeCont &ec, NBNodeCont &nc)
Builds the districts.
static std::map< int, std::vector< int > > myDistrictsConnections
Map from ditricts to connections.
Position geomPosition() const
Returns the position The position yields from the edge geometry and the place the connection is plaed...
SUMOReal getRealSpeed(int distNo) const
A container for districts.
std::map< int, SUMOReal > DistrictPercentages
Definition of a map of how many vehicles should leave to a certain district.
static NIVissimDistrictConnection * dict_findForEdge(int edgeid)
Returns the connection to a district placed at the given node Yep, there onyl should be one...
DistrictPercentages myPercentages
A map how many vehicles (key, amount) should leave to a district (key)
int getID() const
Returns the id of the connection.
int myID
The id of the connections.
std::vector< std::pair< int, int > > myAssignedVehicles
The vehicles using this connection.
int myEdgeID
The id of the connected edge.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
std::vector< int > myDistricts
The connected districts.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
static DictType myDict
District connection dictionary.
SUMOReal getPosition() const
Returns the position of the connection at the edge.
static bool dictionary(int id, const std::string &name, const std::vector< int > &districts, const std::vector< SUMOReal > &percentages, int edgeid, SUMOReal position, const std::vector< std::pair< int, int > > &assignedVehicles)
Inserts the connection into the dictionary after building it.
static void clearDict()
Clears the dictionary.
#define SUMOReal
Definition: config.h:221
std::string myName
The name of the connections.
NIVissimDistrictConnection(int id, const std::string &name, const std::vector< int > &districts, const std::vector< SUMOReal > &percentages, int edgeid, SUMOReal position, const std::vector< std::pair< int, int > > &assignedVehicles)
Contructor.
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:63
std::map< int, NIVissimDistrictConnection * > DictType
Definition of a dictionary of district connections.
SUMOReal myPosition
The position on the edge.
static void dict_BuildDistrictNodes(NBDistrictCont &dc, NBNodeCont &nc)
Builds the nodes that belong to a district.