Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NIVissimEdge.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// A temporary storage for edges imported from Vissim
20/****************************************************************************/
21#pragma once
22#include <config.h>
23
25#include <vector>
26#include <string>
27#include <map>
28#include <netbuild/NBEdge.h>
33
34
35// ===========================================================================
36// class declarations
37// ===========================================================================
38class NBNode;
39class NBDistrictCont;
41
42
43// ===========================================================================
44// class definitions
45// ===========================================================================
51 : public NIVissimAbstractEdge {
52public:
54 NIVissimEdge(int id, const std::string& name,
55 const std::string& type,
56 std::vector<double> laneWidths,
57 double zuschlag1,
58 double zuschlag2, double length,
59 const PositionVector& geom,
60 const NIVissimClosedLanesVector& clv);
61
64
65 void setNodeCluster(int nodeid);
66 void buildGeom();
67
69 void addIncomingConnection(int id);
70
72 void addOutgoingConnection(int id);
73
75 Position getBegin2D() const;
76
78 Position getEnd2D() const;
79
81 double getLength() const;
82
84
87
90 void setSpeed(int lane, int speedDist);
92
94 const std::vector<NIVissimEdge*>& getToTreatAsSame() const;
95
96
100 bool wasWithinAJunction() const {
101 return myAmWithinJunction;
102 }
103
106
109
110public:
113 static bool dictionary(int id, const std::string& name,
114 const std::string& type, int noLanes, double zuschlag1,
115 double zuschlag2, double length,
116 const PositionVector& geom,
117 const NIVissimClosedLanesVector& clv);
118
120 static bool dictionary(int id, NIVissimEdge* o);
121
123 static NIVissimEdge* dictionary(int id);
124
133 static void buildConnectionClusters();
134
136 static void dict_buildNBEdges(NBDistrictCont& dc, NBNodeCont& nc,
137 NBEdgeCont& ec, double offset);
138
139 static void dict_propagateSpeeds();
140
141 static void dict_checkEdges2Join();
142
143
152 static void reportUnsetSpeeds();
153
154
155private:
157 typedef std::vector<NIVissimConnectionCluster*> ConnectionClusters;
158
159private:
169 NBEdgeCont& ec, double sameNodesOffset);
170
172 std::pair<NIVissimConnectionCluster*, NBNode*>
174
176 std::pair<NIVissimConnectionCluster*, NBNode*>
178
180 std::pair<NBNode*, NBNode*> resolveSameNode(NBNodeCont& nc,
181 double offset, NBNode* prevFrom, NBNode* prevTo);
182
183// double recheckSpeedPatches();
184
185 std::vector<NIVissimConnection*> getOutgoingConnected(int lane) const;
186
187 void propagateSpeed(double speed, std::vector<int> forLanes);
188
189
190 void setDistrictSpeed();
191 double getRealSpeed(int distNo);
193 void propagateOwn();
194
195
196
197private:
198 static NBNode* getNodeSecure(int nodeid, const Position& pos,
199 const std::string& possibleName);
200
201 std::pair<NBNode*, NBNode*>
204 NBNode* fromNode, NBNode* toNode);
205
206private:
212 public:
214 explicit connection_position_sorter(int edgeid);
215
217 int operator()(int c1id, int c2id) const;
218
219 private:
222
223 };
224
225
231 public:
233 explicit connection_cluster_position_sorter(int edgeid);
234
237 NIVissimConnectionCluster* cc2) const;
238
239 private:
242
243 };
244
245private:
247 std::string myName;
248
250 std::string myType;
251
254 std::vector<double> myLaneWidths;
255
258
261
264
266 std::vector<int> myIncomingConnections;
267
269 std::vector<int> myOutgoingConnections;
270
271 std::vector<double> myDistrictConnections;
272
273 std::vector<int> myPatchedSpeeds;
274
275 std::vector<double> myLaneSpeeds;
276
277 std::vector<NIVissimEdge*> myToTreatAsSame;
278
281
282private:
284 typedef std::map<int, NIVissimEdge*> DictType;
285
288
290 static int myMaxID;
291
292 static std::vector<std::string> myLanesWithMissingSpeeds;
293
294};
std::vector< NIVissimClosedLaneDef * > NIVissimClosedLanesVector
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
Represents a single node (junction) during network building.
Definition NBNode.h:66
int operator()(NIVissimConnectionCluster *cc1, NIVissimConnectionCluster *cc2) const
comparing operation
int operator()(int c1id, int c2id) const
comparing operation
A temporary storage for edges imported from Vissim.
void checkDistrictConnectionExistanceAt(double pos)
static NBNode * getNodeSecure(int nodeid, const Position &pos, const std::string &possibleName)
std::pair< NBNode *, NBNode * > resolveSameNode(NBNodeCont &nc, double offset, NBNode *prevFrom, NBNode *prevTo)
Tries to resolve the problem that the same node has been returned as origin and destination node.
void mergedInto(NIVissimConnectionCluster *old, NIVissimConnectionCluster *act)
void propagateSpeed(double speed, std::vector< int > forLanes)
const std::vector< NIVissimEdge * > & getToTreatAsSame() const
static int myMaxID
The current maximum id; needed for further id assignment.
NIVissimClosedLanesVector myClosedLanes
List of lanes closed on this edge.
static std::vector< std::string > myLanesWithMissingSpeeds
std::string myName
The name of the edge.
NIVissimEdge * getBestOutgoing() const
void addIncomingConnection(int id)
Adds a connection where this edge is the destination.
bool myAmWithinJunction
Information whether this edge was not build due to being within a junction.
static DictType myDict
The dictionary.
static void reportUnsetSpeeds()
Writes edges with unset speeds to the warnings message log instance.
std::map< int, NIVissimEdge * > DictType
Definition of the dictionary type.
double getRealSpeed(int distNo)
std::vector< double > myDistrictConnections
NIVissimEdge * getBestIncoming() const
~NIVissimEdge()
Destructor.
void addOutgoingConnection(int id)
Adds a connection where this edge is the source.
std::vector< double > myLaneSpeeds
std::vector< NIVissimConnectionCluster * > ConnectionClusters
The definition for a container for connection clusters.
double getLength() const
Returns the length of the node.
void addToConnectionCluster(NIVissimConnectionCluster *c)
void setSpeed(int lane, int speedDist)
bool wasWithinAJunction() const
Returns whether this edge was found to be within a junction.
std::pair< NIVissimConnectionCluster *, NBNode * > getFromNode(NBNodeCont &nc, ConnectionClusters &clusters)
Returns the origin node.
std::vector< NIVissimEdge * > myToTreatAsSame
void removeFromConnectionCluster(NIVissimConnectionCluster *c)
static void dict_checkEdges2Join()
static void buildConnectionClusters()
Clusters connections of each edge.
Position getBegin2D() const
std::vector< NIVissimConnection * > getOutgoingConnected(int lane) const
static void dict_buildNBEdges(NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec, double offset)
Builds NBEdges from the VissimEdges within the dictionary.
void checkUnconnectedLaneSpeeds()
double myZuschlag1
Additional load values for this edge.
static void dict_propagateSpeeds()
std::pair< NIVissimConnectionCluster *, NBNode * > getToNode(NBNodeCont &nc, ConnectionClusters &clusters)
Returns the destination node.
std::vector< double > myLaneWidths
static bool dictionary(int id, const std::string &name, const std::string &type, int noLanes, double zuschlag1, double zuschlag2, double length, const PositionVector &geom, const NIVissimClosedLanesVector &clv)
Adds the described item to the dictionary Builds the edge first.
std::string myType
The type of the edge.
void buildNBEdge(NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec, double sameNodesOffset)
Builds the NBEdge from this VissimEdge.
std::vector< int > myOutgoingConnections
List of connections outgoing from this edge.
Position getEnd2D() const
Returns the end position of the edge.
void setDistrictSpeed()
bool addToTreatAsSame(NIVissimEdge *e)
int myNoLanes
The number of lanes the edge has.
void setNodeCluster(int nodeid)
NIVissimConnection * getConnectionTo(NIVissimEdge *e)
std::vector< int > myPatchedSpeeds
std::pair< NBNode *, NBNode * > remapOneOfNodes(NBNodeCont &nc, NIVissimDistrictConnection *d, NBNode *fromNode, NBNode *toNode)
ConnectionClusters myConnectionClusters
List of connection clusters along this edge.
double myZuschlag2
std::vector< int > myIncomingConnections
List of connections incoming to this edge.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.