SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // Builds trigger objects for guisim 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 <string> 00034 #include <fstream> 00035 #include <guisim/GUILaneSpeedTrigger.h> 00036 #include <guisim/GUINet.h> 00037 #include <guisim/GUITriggeredRerouter.h> 00038 #include <guisim/GUIBusStop.h> 00039 #include "GUITriggerBuilder.h" 00040 00041 #ifdef CHECK_MEMORY_LEAKS 00042 #include <foreign/nvwa/debug_new.h> 00043 #endif // CHECK_MEMORY_LEAKS 00044 00045 00046 // =========================================================================== 00047 // method definitions 00048 // =========================================================================== 00049 GUITriggerBuilder::GUITriggerBuilder() {} 00050 00051 00052 GUITriggerBuilder::~GUITriggerBuilder() {} 00053 00054 00055 MSLaneSpeedTrigger* 00056 GUITriggerBuilder::buildLaneSpeedTrigger(MSNet& net, 00057 const std::string& id, const std::vector<MSLane*> &destLanes, 00058 const std::string& file) { 00059 GUILaneSpeedTrigger* lst = new GUILaneSpeedTrigger(id, destLanes, file); 00060 static_cast<GUINet&>(net).getVisualisationSpeedUp().addAdditionalGLObject(lst); 00061 return lst; 00062 } 00063 00064 00065 MSTriggeredRerouter* 00066 GUITriggerBuilder::buildRerouter(MSNet& net, const std::string& id, 00067 std::vector<MSEdge*> &edges, 00068 SUMOReal prob, const std::string& file, bool off) { 00069 GUITriggeredRerouter* rr = new GUITriggeredRerouter(id, edges, prob, file, off); 00070 static_cast<GUINet&>(net).getVisualisationSpeedUp().addAdditionalGLObject(rr); 00071 return rr; 00072 } 00073 00074 00075 void 00076 GUITriggerBuilder::buildBusStop(MSNet& net, const std::string& id, 00077 const std::vector<std::string> &lines, 00078 MSLane* lane, 00079 SUMOReal frompos, SUMOReal topos) throw(InvalidArgument) { 00080 GUIBusStop* stop = new GUIBusStop(id, lines, *lane, frompos, topos); 00081 if (!net.addBusStop(stop)) { 00082 delete stop; 00083 throw InvalidArgument("Could not build bus stop '" + id + "'; probably declared twice."); 00084 } 00085 static_cast<GUINet&>(net).getVisualisationSpeedUp().addAdditionalGLObject(stop); 00086 } 00087 00088 00089 /****************************************************************************/ 00090