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