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.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 /****************************************************************************/
17 // Derivation of NLEdgeControlBuilder which build gui-edges
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <vector>
27 #include <string>
28 #include <map>
29 #include <algorithm>
30 #include <guisim/GUIEdge.h>
31 #include <guisim/GUINet.h>
32 #include <guisim/GUILane.h>
33 #include <microsim/MSJunction.h>
34 #include <netload/NLBuilder.h>
35 #include "GUIEdgeControlBuilder.h"
36 #include <gui/GUIGlobals.h>
37 
38 
39 // ===========================================================================
40 // method definitions
41 // ===========================================================================
44 
45 
47 
48 
49 MSLane*
50 GUIEdgeControlBuilder::addLane(const std::string& id,
51  double maxSpeed, double length,
52  const PositionVector& shape,
53  double width,
54  SVCPermissions permissions,
55  int index, bool isRampAccel,
56  const std::string& type) {
57  MSLane* lane = new GUILane(id, maxSpeed, length, myActiveEdge, myCurrentNumericalLaneID++, shape, width, permissions, index, isRampAccel, type);
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 
virtual MSLane * addLane(const std::string &id, double maxSpeed, double length, const PositionVector &shape, double width, SVCPermissions permissions, int index, bool isRampAccel, const std::string &type)
Builds and adds a lane.
GUIEdgeControlBuilder()
Constructor.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
MSEdge * myActiveEdge
pointer to the currently chosen edge
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:62
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:53
A road/street connecting two junctions.
Definition: MSEdge.h:76
A list of positions.
std::vector< MSLane * > * myLaneStorage
pointer to a temporary lane storage
int myCurrentNumericalEdgeID
A running number for edge numbering.
int myCurrentLaneIndex
The index of the currently active lane (-1 if none is active)
MSEdge * buildEdge(const std::string &id, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, const int priority, const double distance)
Builds an edge instance (GUIEdge in this case)
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
int myCurrentNumericalLaneID
A running number for lane numbering.
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
Interface for building edges.