SUMO - Simulation of Urban MObility
NIVissimDistrictConnection.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // An edge imported from Vissim together for a container for
19 /****************************************************************************/
20 #ifndef NIVissimDistrictConnection_h
21 #define NIVissimDistrictConnection_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <map>
34 #include <string>
35 #include <utils/geom/Position.h>
36 
37 
38 class NBDistrictCont;
39 class NBEdgeCont;
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
46 public:
48  NIVissimDistrictConnection(int id, const std::string& name,
49  const std::vector<int>& districts, const std::vector<double>& percentages,
50  int edgeid, double position,
51  const std::vector<std::pair<int, int> >& assignedVehicles);
52 
53  // Destructor
55 
58  Position geomPosition() const;
59 
61  int getID() const {
62  return myID;
63  }
64 
66  double getPosition() const {
67  return myPosition;
68  }
69 
70  double getMeanSpeed() const;
71 
72 public:
74  static bool dictionary(int id, const std::string& name,
75  const std::vector<int>& districts, const std::vector<double>& percentages,
76  int edgeid, double position,
77  const std::vector<std::pair<int, int> >& assignedVehicles);
78 
80  static bool dictionary(int id, NIVissimDistrictConnection* o);
81 
83  static NIVissimDistrictConnection* dictionary(int id);
84 
87  NBNodeCont& nc);
88 
90  static void dict_BuildDistricts(NBDistrictCont& dc,
91  NBEdgeCont& ec, NBNodeCont& nc);
92 
95  static NIVissimDistrictConnection* dict_findForEdge(int edgeid);
96 
98  static void clearDict();
99 
100  static void dict_BuildDistrictConnections();
101 
102  static void dict_CheckEdgeEnds();
103 
104 
105 private:
106  void checkEdgeEnd();
107  double getRealSpeed(int distNo) const;
108 
109 private:
111  int myID;
112 
114  std::string myName;
115 
117  std::vector<int> myDistricts;
118 
120  typedef std::map<int, double> DistrictPercentages;
121 
123  DistrictPercentages myPercentages;
124 
126  int myEdgeID;
127 
129  double myPosition;
130 
132  std::vector<std::pair<int, int> > myAssignedVehicles;
133 
134 private:
136  typedef std::map<int, NIVissimDistrictConnection*> DictType;
137 
139  static DictType myDict;
140 
142  static std::map<int, std::vector<int> > myDistrictsConnections;
143 
144 };
145 
146 
147 #endif
148 
149 /****************************************************************************/
150 
std::map< int, double > DistrictPercentages
Definition of a map of how many vehicles should leave to a certain district.
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...
double getRealSpeed(int distNo) const
A container for districts.
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:45
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.
double getPosition() const
Returns the position of the connection at the edge.
NIVissimDistrictConnection(int id, const std::string &name, const std::vector< int > &districts, const std::vector< double > &percentages, int edgeid, double position, const std::vector< std::pair< int, int > > &assignedVehicles)
Contructor.
static void clearDict()
Clears the dictionary.
double myPosition
The position on the edge.
std::string myName
The name of the connections.
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:66
std::map< int, NIVissimDistrictConnection * > DictType
Definition of a dictionary of district connections.
static void dict_BuildDistrictNodes(NBDistrictCont &dc, NBNodeCont &nc)
Builds the nodes that belong to a district.
static bool dictionary(int id, const std::string &name, const std::vector< int > &districts, const std::vector< double > &percentages, int edgeid, double position, const std::vector< std::pair< int, int > > &assignedVehicles)
Inserts the connection into the dictionary after building it.