|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Derivation of NLEdgeControlBuilder which build gui-edges 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This program is free software; you can redistribute it and/or modify 00014 // it under the terms of the GNU General Public License as published by 00015 // the Free Software Foundation; either version 2 of the License, or 00016 // (at your option) any later version. 00017 // 00018 /****************************************************************************/ 00019 00020 00021 // =========================================================================== 00022 // included modules 00023 // =========================================================================== 00024 #ifdef _MSC_VER 00025 #include <windows_config.h> 00026 #else 00027 #include <config.h> 00028 #endif 00029 00030 #include <vector> 00031 #include <string> 00032 #include <map> 00033 #include <algorithm> 00034 #include <guisim/GUIEdge.h> 00035 #include <guisim/GUINet.h> 00036 #include <guisim/GUILane.h> 00037 #include <guisim/GUIInternalLane.h> 00038 #include <microsim/MSJunction.h> 00039 #include <netload/NLBuilder.h> 00040 #include "GUIEdgeControlBuilder.h" 00041 #include <gui/GUIGlobals.h> 00042 00043 #ifdef CHECK_MEMORY_LEAKS 00044 #include <foreign/nvwa/debug_new.h> 00045 #endif // CHECK_MEMORY_LEAKS 00046 00047 00048 // =========================================================================== 00049 // method definitions 00050 // =========================================================================== 00051 GUIEdgeControlBuilder::GUIEdgeControlBuilder() throw() 00052 : NLEdgeControlBuilder() {} 00053 00054 00055 GUIEdgeControlBuilder::~GUIEdgeControlBuilder() throw() {} 00056 00057 00058 MSEdge* 00059 GUIEdgeControlBuilder::closeEdge() { 00060 MSEdge* ret = NLEdgeControlBuilder::closeEdge(); 00061 static_cast<GUIEdge*>(ret)->initGeometry(); 00062 return ret; 00063 } 00064 00065 00066 MSLane* 00067 GUIEdgeControlBuilder::addLane(const std::string& id, 00068 SUMOReal maxSpeed, SUMOReal length, 00069 const PositionVector& shape, 00070 SUMOReal width, 00071 const SUMOVehicleClasses& allowed, 00072 const SUMOVehicleClasses& disallowed) { 00073 MSLane* lane = 0; 00074 switch (myFunction) { 00075 case MSEdge::EDGEFUNCTION_INTERNAL: 00076 lane = new GUIInternalLane(id, maxSpeed, length, myActiveEdge, 00077 myCurrentNumericalLaneID++, shape, width, allowed, disallowed); 00078 break; 00079 case MSEdge::EDGEFUNCTION_NORMAL: 00080 case MSEdge::EDGEFUNCTION_CONNECTOR: 00081 lane = new GUILane(id, maxSpeed, length, myActiveEdge, 00082 myCurrentNumericalLaneID++, shape, width, allowed, disallowed); 00083 break; 00084 default: 00085 throw InvalidArgument("A lane with an unknown type occured (" + toString(myFunction) + ")"); 00086 } 00087 myLaneStorage->push_back(lane); 00088 return lane; 00089 } 00090 00091 00092 00093 MSEdge* 00094 GUIEdgeControlBuilder::buildEdge(const std::string& id, const std::string& streetName) throw() { 00095 return new GUIEdge(id, myCurrentNumericalEdgeID++, streetName); 00096 } 00097 00098 /****************************************************************************/ 00099