SUMO - Simulation of Urban MObility

GUITriggerBuilder.cpp

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