Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // An edge imported from Vissim together for a container for
17 /****************************************************************************/
18 #ifndef NIVissimDistrictConnection_h
19 #define NIVissimDistrictConnection_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <map>
28 #include <string>
29 #include <utils/geom/Position.h>
30 
31 
32 class NBDistrictCont;
33 class NBEdgeCont;
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
40 public:
42  NIVissimDistrictConnection(int id, const std::string& name,
43  const std::vector<int>& districts, const std::vector<double>& percentages,
44  int edgeid, double position,
45  const std::vector<std::pair<int, int> >& assignedVehicles);
46 
47  // Destructor
49 
52  Position geomPosition() const;
53 
55  int getID() const {
56  return myID;
57  }
58 
60  double getPosition() const {
61  return myPosition;
62  }
63 
64  double getMeanSpeed() const;
65 
66 public:
68  static bool dictionary(int id, const std::string& name,
69  const std::vector<int>& districts, const std::vector<double>& percentages,
70  int edgeid, double position,
71  const std::vector<std::pair<int, int> >& assignedVehicles);
72 
74  static bool dictionary(int id, NIVissimDistrictConnection* o);
75 
77  static NIVissimDistrictConnection* dictionary(int id);
78 
81  NBNodeCont& nc);
82 
84  static void dict_BuildDistricts(NBDistrictCont& dc,
85  NBEdgeCont& ec, NBNodeCont& nc);
86 
89  static NIVissimDistrictConnection* dict_findForEdge(int edgeid);
90 
92  static void clearDict();
93 
94  static void dict_BuildDistrictConnections();
95 
96  static void dict_CheckEdgeEnds();
97 
98 
99 private:
100  void checkEdgeEnd();
101  double getRealSpeed(int distNo) const;
102 
103 private:
105  int myID;
106 
108  std::string myName;
109 
111  std::vector<int> myDistricts;
112 
114  typedef std::map<int, double> DistrictPercentages;
115 
117  DistrictPercentages myPercentages;
118 
120  int myEdgeID;
121 
123  double myPosition;
124 
126  std::vector<std::pair<int, int> > myAssignedVehicles;
127 
128 private:
130  typedef std::map<int, NIVissimDistrictConnection*> DictType;
131 
133  static DictType myDict;
134 
136  static std::map<int, std::vector<int> > myDistrictsConnections;
137 
138 };
139 
140 
141 #endif
142 
143 /****************************************************************************/
144 
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.
A container for districts.
Position geomPosition() const
Returns the position The position yields from the edge geometry and the place the connection is plaed...
int getID() const
Returns the id of the connection.
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 myID
The id of the connections.
double getPosition() const
Returns the position of the connection at the edge.
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:39
std::vector< int > myDistricts
The connected districts.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
static DictType myDict
District connection dictionary.
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:60
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.