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.sourceforge.net/
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 <guisim/GUIInternalLane.h>
41 #include <microsim/MSJunction.h>
42 #include <netload/NLBuilder.h>
43 #include "GUIEdgeControlBuilder.h"
44 #include <gui/GUIGlobals.h>
45 
46 #ifdef CHECK_MEMORY_LEAKS
47 #include <foreign/nvwa/debug_new.h>
48 #endif // CHECK_MEMORY_LEAKS
49 
50 
51 // ===========================================================================
52 // method definitions
53 // ===========================================================================
56 
57 
59 
60 
61 MSEdge*
64  static_cast<GUIEdge*>(ret)->initGeometry();
65  return ret;
66 }
67 
68 
69 MSLane*
70 GUIEdgeControlBuilder::addLane(const std::string& id,
71  SUMOReal maxSpeed, SUMOReal length,
72  const PositionVector& shape,
73  SUMOReal width,
74  SVCPermissions permissions) {
75  MSLane* lane = 0;
76  switch (myActiveEdge->getPurpose()) {
78  lane = new GUIInternalLane(id, maxSpeed, length, myActiveEdge,
79  myCurrentNumericalLaneID++, shape, width, permissions);
80  break;
83  lane = new GUILane(id, maxSpeed, length, myActiveEdge,
84  myCurrentNumericalLaneID++, shape, width, permissions);
85  break;
86  default:
87  throw InvalidArgument("A lane with an unknown type occured (" + toString(myActiveEdge->getPurpose()) + ")");
88  }
89  myLaneStorage->push_back(lane);
90  return lane;
91 }
92 
93 
94 
95 MSEdge*
96 GUIEdgeControlBuilder::buildEdge(const std::string& id, const MSEdge::EdgeBasicFunction function, const std::string& streetName) {
97  if (function == MSEdge::EDGEFUNCTION_INTERNAL) {
98  return new GUIEdge(id, -1, function, streetName);
99  }
100  return new GUIEdge(id, myCurrentNumericalEdgeID++, function, streetName);
101 }
102 
103 /****************************************************************************/
104