SUMO - Simulation of Urban MObility
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.dlr.de/
11 // Copyright (C) 2001-2017 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<double>& percentages,
51  int edgeid, double 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 
67  double getPosition() const {
68  return myPosition;
69  }
70 
71  double getMeanSpeed() const;
72 
73 public:
75  static bool dictionary(int id, const std::string& name,
76  const std::vector<int>& districts, const std::vector<double>& percentages,
77  int edgeid, double 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);
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  double getRealSpeed(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, double> DistrictPercentages;
122 
124  DistrictPercentages myPercentages;
125 
127  int myEdgeID;
128 
130  double myPosition;
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 
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: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.
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:63
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.