SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUIEdgeControlBuilder.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Derivation of NLEdgeControlBuilder which build gui-edges
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <vector>
34 #include <string>
35 #include <map>
36 #include <algorithm>
37 #include <guisim/GUIEdge.h>
38 #include <guisim/GUINet.h>
39 #include <guisim/GUILane.h>
40 #include <microsim/MSJunction.h>
41 #include <netload/NLBuilder.h>
42 #include "GUIEdgeControlBuilder.h"
43 #include <gui/GUIGlobals.h>
44 
45 #ifdef CHECK_MEMORY_LEAKS
46 #include <foreign/nvwa/debug_new.h>
47 #endif // CHECK_MEMORY_LEAKS
48 
49 
50 // ===========================================================================
51 // method definitions
52 // ===========================================================================
55 
56 
58 
59 
60 MSLane*
61 GUIEdgeControlBuilder::addLane(const std::string& id,
62  SUMOReal maxSpeed, SUMOReal length,
63  const PositionVector& shape,
64  SUMOReal width,
65  SVCPermissions permissions) {
66  MSLane* lane = new GUILane(id, maxSpeed, length, myActiveEdge, myCurrentNumericalLaneID++, shape, width, permissions, (int)myLaneStorage->size());
67  myLaneStorage->push_back(lane);
68  return lane;
69 }
70 
71 
72 
73 MSEdge*
74 GUIEdgeControlBuilder::buildEdge(const std::string& id, const MSEdge::EdgeBasicFunction function, const std::string& streetName) {
75  return new GUIEdge(id, myCurrentNumericalEdgeID++, function, streetName);
76 }
77 
78 /****************************************************************************/
79 
GUIEdgeControlBuilder()
Constructor.
virtual MSLane * addLane(const std::string &id, SUMOReal maxSpeed, SUMOReal length, const PositionVector &shape, SUMOReal width, SVCPermissions permissions)
Builds and adds a lane.
unsigned int myCurrentNumericalLaneID
A running number for lane numbering.
EdgeBasicFunction
Defines possible edge types.
Definition: MSEdge.h:82
MSEdge * myActiveEdge
pointer to the currently chosen edge
unsigned int myCurrentNumericalEdgeID
A running number for edge numbering.
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:70
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:61
A road/street connecting two junctions.
Definition: MSEdge.h:73
A list of positions.
std::vector< MSLane * > * myLaneStorage
pointer to a temporary lane storage
MSEdge * buildEdge(const std::string &id, const MSEdge::EdgeBasicFunction function, const std::string &streetName)
Builds an edge instance (GUIEdge in this case)
#define SUMOReal
Definition: config.h:215
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
Interface for building edges.