SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUITriggerBuilder.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Builds trigger objects for guisim
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <fstream>
36 #include <guisim/GUINet.h>
38 #include <guisim/GUIBusStop.h>
39 #include "GUITriggerBuilder.h"
40 
41 #ifdef CHECK_MEMORY_LEAKS
42 #include <foreign/nvwa/debug_new.h>
43 #endif // CHECK_MEMORY_LEAKS
44 
45 
46 // ===========================================================================
47 // method definitions
48 // ===========================================================================
50 
51 
53 
54 
57  const std::string& id, const std::vector<MSLane*> &destLanes,
58  const std::string& file) {
59  GUILaneSpeedTrigger* lst = new GUILaneSpeedTrigger(id, destLanes, file);
60  static_cast<GUINet&>(net).getVisualisationSpeedUp().addAdditionalGLObject(lst);
61  return lst;
62 }
63 
64 
66 GUITriggerBuilder::buildRerouter(MSNet& net, const std::string& id,
67  std::vector<MSEdge*> &edges,
68  SUMOReal prob, const std::string& file, bool off) {
69  GUITriggeredRerouter* rr = new GUITriggeredRerouter(id, edges, prob, file, off);
70  static_cast<GUINet&>(net).getVisualisationSpeedUp().addAdditionalGLObject(rr);
71  return rr;
72 }
73 
74 
75 void
76 GUITriggerBuilder::buildBusStop(MSNet& net, const std::string& id,
77  const std::vector<std::string> &lines,
78  MSLane* lane,
79  SUMOReal frompos, SUMOReal topos) throw(InvalidArgument) {
80  GUIBusStop* stop = new GUIBusStop(id, lines, *lane, frompos, topos);
81  if (!net.addBusStop(stop)) {
82  delete stop;
83  throw InvalidArgument("Could not build bus stop '" + id + "'; probably declared twice.");
84  }
85  static_cast<GUINet&>(net).getVisualisationSpeedUp().addAdditionalGLObject(stop);
86 }
87 
88 
89 /****************************************************************************/
90