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.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // An edge imported from Vissim together for a container for
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include <map>
25 #include <string>
26 #include <utils/geom/Position.h>
27 
28 
29 class NBDistrictCont;
30 class NBEdgeCont;
31 
32 
33 // ===========================================================================
34 // class definitions
35 // ===========================================================================
37 public:
39  NIVissimDistrictConnection(int id, const std::string& name,
40  const std::vector<int>& districts, const std::vector<double>& percentages,
41  int edgeid, double position,
42  const std::vector<std::pair<int, int> >& assignedVehicles);
43 
44  // Destructor
46 
49  Position geomPosition() const;
50 
52  int getID() const {
53  return myID;
54  }
55 
57  double getPosition() const {
58  return myPosition;
59  }
60 
61  double getMeanSpeed() const;
62 
63 public:
65  static bool dictionary(int id, const std::string& name,
66  const std::vector<int>& districts, const std::vector<double>& percentages,
67  int edgeid, double position,
68  const std::vector<std::pair<int, int> >& assignedVehicles);
69 
71  static bool dictionary(int id, NIVissimDistrictConnection* o);
72 
74  static NIVissimDistrictConnection* dictionary(int id);
75 
78  NBNodeCont& nc);
79 
81  static void dict_BuildDistricts(NBDistrictCont& dc,
82  NBEdgeCont& ec, NBNodeCont& nc);
83 
86  static NIVissimDistrictConnection* dict_findForEdge(int edgeid);
87 
89  static void clearDict();
90 
91  static void dict_BuildDistrictConnections();
92 
93  static void dict_CheckEdgeEnds();
94 
95 
96 private:
97  void checkEdgeEnd();
98  double getRealSpeed(int distNo) const;
99 
100 private:
102  int myID;
103 
105  std::string myName;
106 
108  std::vector<int> myDistricts;
109 
111  typedef std::map<int, double> DistrictPercentages;
112 
115 
117  int myEdgeID;
118 
120  double myPosition;
121 
123  std::vector<std::pair<int, int> > myAssignedVehicles;
124 
125 private:
127  typedef std::map<int, NIVissimDistrictConnection*> DictType;
128 
130  static DictType myDict;
131 
133  static std::map<int, std::vector<int> > myDistrictsConnections;
134 
135 };
A container for districts.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:59
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:57
static void dict_BuildDistricts(NBDistrictCont &dc, NBEdgeCont &ec, NBNodeCont &nc)
Builds the districts.
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.
DistrictPercentages myPercentages
A map how many vehicles (key, amount) should leave to a district (key)
std::vector< int > myDistricts
The connected districts.
static NIVissimDistrictConnection * dict_findForEdge(int edgeid)
Returns the connection to a district placed at the given node Yep, there onyl should be one,...
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...
std::vector< std::pair< int, int > > myAssignedVehicles
The vehicles using this connection.
double myPosition
The position on the edge.
std::map< int, double > DistrictPercentages
Definition of a map of how many vehicles should leave to a certain district.
static void dict_BuildDistrictNodes(NBDistrictCont &dc, NBNodeCont &nc)
Builds the nodes that belong to a district.
std::string myName
The name of the connections.
int myID
The id of the connections.
static void clearDict()
Clears the dictionary.
double getPosition() const
Returns the position of the connection at the edge.
int getID() const
Returns the id of the connection.
static DictType myDict
District connection dictionary.
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.
std::map< int, NIVissimDistrictConnection * > DictType
Definition of a dictionary of district connections.
int myEdgeID
The id of the connected edge.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37