SUMO - Simulation of Urban MObility

GUIEdgeControlBuilder.cpp

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