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-2020 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 length,
50  const PositionVector& shape,
51  double width,
52  SVCPermissions permissions,
53  int index, bool isRampAccel,
54  const std::string& type) {
55  MSLane* lane = new GUILane(id, maxSpeed, length, myActiveEdge, myCurrentNumericalLaneID++, shape, width, permissions, index, isRampAccel, type);
56  myLaneStorage->push_back(lane);
57  myCurrentLaneIndex = index;
58  return lane;
59 }
60 
61 
62 
63 MSEdge*
64 GUIEdgeControlBuilder::buildEdge(const std::string& id, const SumoXMLEdgeFunc function,
65  const std::string& streetName, const std::string& edgeType, const int priority, const double distance) {
66  return new GUIEdge(id, myCurrentNumericalEdgeID++, function, streetName, edgeType, priority, distance);
67 }
68 
69 
70 /****************************************************************************/
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...
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)
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.
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:50
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:59
A road/street connecting two junctions.
Definition: MSEdge.h:77
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
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.