SUMO - Simulation of Urban MObility

GUITriggerBuilder.cpp

Go to the documentation of this file.
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 void
00066 GUITriggerBuilder::buildRerouter(MSNet& net, const std::string& id,
00067                                  std::vector<MSEdge*> &edges,
00068                                  SUMOReal prob, const std::string& file, bool off) {
00069     static_cast<GUINet&>(net).getVisualisationSpeedUp().addAdditionalGLObject(new GUITriggeredRerouter(id, edges, prob, file, off));
00070 }
00071 
00072 
00073 void
00074 GUITriggerBuilder::buildBusStop(MSNet& net, const std::string& id,
00075                                 const std::vector<std::string> &lines,
00076                                 MSLane* lane,
00077                                 SUMOReal frompos, SUMOReal topos) throw(InvalidArgument) {
00078     GUIBusStop* stop = new GUIBusStop(id, lines, *lane, frompos, topos);
00079     if (!net.addBusStop(stop)) {
00080         delete stop;
00081         throw InvalidArgument("Could not build bus stop '" + id + "'; probably declared twice.");
00082     }
00083     static_cast<GUINet&>(net).getVisualisationSpeedUp().addAdditionalGLObject(stop);
00084 }
00085 
00086 
00087 /****************************************************************************/
00088 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines