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-sim.org/
12 // Copyright (C) 2001-2014 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 <guisim/GUICalibrator.h>
40 #include "GUITriggerBuilder.h"
41 
42 #ifdef CHECK_MEMORY_LEAKS
43 #include <foreign/nvwa/debug_new.h>
44 #endif // CHECK_MEMORY_LEAKS
45 
46 
47 // ===========================================================================
48 // method definitions
49 // ===========================================================================
51 
52 
54 
55 
58  const std::string& id, const std::vector<MSLane*>& destLanes,
59  const std::string& file) {
60  GUILaneSpeedTrigger* lst = new GUILaneSpeedTrigger(id, destLanes, file);
61  static_cast<GUINet&>(net).getVisualisationSpeedUp().addAdditionalGLObject(lst);
62  return lst;
63 }
64 
65 
67 GUITriggerBuilder::buildRerouter(MSNet& net, const std::string& id,
68  std::vector<MSEdge*>& edges,
69  SUMOReal prob, const std::string& file, bool off) {
70  GUITriggeredRerouter* rr = new GUITriggeredRerouter(id, edges, prob, file, off,
71  dynamic_cast<GUINet&>(net).getVisualisationSpeedUp());
72  return rr;
73 }
74 
75 
76 void
77 GUITriggerBuilder::buildBusStop(MSNet& net, const std::string& id,
78  const std::vector<std::string>& lines,
79  MSLane* lane,
80  SUMOReal frompos, SUMOReal topos) {
81  GUIBusStop* stop = new GUIBusStop(id, lines, *lane, frompos, topos);
82  if (!net.addBusStop(stop)) {
83  delete stop;
84  throw InvalidArgument("Could not build bus stop '" + id + "'; probably declared twice.");
85  }
86  static_cast<GUINet&>(net).getVisualisationSpeedUp().addAdditionalGLObject(stop);
87 }
88 
89 
91 GUITriggerBuilder::buildCalibrator(MSNet& net, const std::string& id,
92  MSEdge* edge, SUMOReal pos,
93  const std::string& file,
94  const std::string& outfile,
95  const SUMOTime freq,
96  const MSRouteProbe* probe) {
97  GUICalibrator* cali = new GUICalibrator(id, edge, pos, file, outfile, freq, probe);
98  static_cast<GUINet&>(net).getVisualisationSpeedUp().addAdditionalGLObject(cali);
99  return cali;
100 }
101 
102 
103 /****************************************************************************/
104 
A lane area vehicles can halt at (gui-version)
Definition: GUIBusStop.h:71
virtual MSLaneSpeedTrigger * buildLaneSpeedTrigger(MSNet &net, const std::string &id, const std::vector< MSLane * > &destLanes, const std::string &file)
Builds a lane speed trigger.
Changes the speed allowed on a set of lanes (gui version)
Definition: GUICalibrator.h:53
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
virtual MSCalibrator * buildCalibrator(MSNet &net, const std::string &id, MSEdge *edge, SUMOReal pos, const std::string &file, const std::string &outfile, const SUMOTime freq, const MSRouteProbe *probe)
builds a microscopic calibrator
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:68
~GUITriggerBuilder()
Destructor.
virtual void buildBusStop(MSNet &net, const std::string &id, const std::vector< std::string > &lines, MSLane *lane, SUMOReal frompos, SUMOReal topos)
Builds a bus stop.
The simulated network and simulation perfomer.
Definition: MSNet.h:91
bool addBusStop(MSBusStop *busStop)
Adds a bus stop.
Definition: MSNet.cpp:703
Changes the speed allowed on a set of lanes.
A road/street connecting two junctions.
Definition: MSEdge.h:74
GUITriggerBuilder()
Constructor.
Reroutes vehicles passing an edge.
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:90
Calibrates the flow on a segment to a specified one.
Definition: MSCalibrator.h:57
virtual MSTriggeredRerouter * buildRerouter(MSNet &net, const std::string &id, std::vector< MSEdge * > &edges, SUMOReal prob, const std::string &file, bool off)
builds an rerouter
#define SUMOReal
Definition: config.h:215
Changes the speed allowed on a set of lanes (gui version)
Representation of a lane in the micro simulation.
Definition: MSLane.h:77