Eclipse SUMO - Simulation of Urban MObility
GUIEdgeControlBuilder.cpp
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 /****************************************************************************/
20 // Derivation of NLEdgeControlBuilder which build gui-edges
21 /****************************************************************************/
22 #include <config.h>
23 
24 #include <vector>
25 #include <string>
26 #include <map>
27 #include <algorithm>
28 #include <guisim/GUIEdge.h>
29 #include <guisim/GUINet.h>
30 #include <guisim/GUILane.h>
31 #include <microsim/MSJunction.h>
32 #include <netload/NLBuilder.h>
33 #include "GUIEdgeControlBuilder.h"
34 #include <gui/GUIGlobals.h>
35 
36 
37 // ===========================================================================
38 // method definitions
39 // ===========================================================================
42 
43 
45 
46 
47 MSLane*
48 GUIEdgeControlBuilder::addLane(const std::string& id,
49  double maxSpeed, double friction, double length,
50  const PositionVector& shape,
51  double width,
52  SVCPermissions permissions,
53  SVCPermissions changeLeft, SVCPermissions changeRight,
54  int index, bool isRampAccel,
55  const std::string& type,
56  const PositionVector& outlineShape) {
57  MSLane* lane = new GUILane(id, maxSpeed, friction, length, myActiveEdge, myCurrentNumericalLaneID++, shape, width, permissions, changeLeft, changeRight, index, isRampAccel, type, outlineShape);
58  myLaneStorage->push_back(lane);
59  myCurrentLaneIndex = index;
60  return lane;
61 }
62 
63 
64 
65 MSEdge*
66 GUIEdgeControlBuilder::buildEdge(const std::string& id, const SumoXMLEdgeFunc function,
67  const std::string& streetName, const std::string& edgeType, const int priority, const double distance) {
68  return new GUIEdge(id, myCurrentNumericalEdgeID++, function, streetName, edgeType, priority, distance);
69 }
70 
71 
72 /****************************************************************************/
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
MSLane * addLane(const std::string &id, double maxSpeed, double friction, double length, const PositionVector &shape, double width, SVCPermissions permissions, SVCPermissions changeLeft, SVCPermissions changeRight, int index, bool isRampAccel, const std::string &type, const PositionVector &outlineShape) override
Builds and adds a lane.
MSEdge * buildEdge(const std::string &id, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, const int priority, const double distance) override
Builds an edge instance (GUIEdge in this case)
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:51
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:60
A road/street connecting two junctions.
Definition: MSEdge.h:77
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
Interface for building edges.
MSEdge * myActiveEdge
pointer to the currently chosen edge
int myCurrentLaneIndex
The index of the currently active lane (-1 if none is active)
int myCurrentNumericalLaneID
A running number for lane numbering.
std::vector< MSLane * > * myLaneStorage
pointer to a temporary lane storage
int myCurrentNumericalEdgeID
A running number for edge numbering.
A list of positions.