SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUI_E2_ZS_CollectorOverLanes.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // The gui-version of a MS_E2_ZS_CollectorOverLanes.
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-2013 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 
36 #include <utils/gui/div/GLHelper.h>
37 #include <utils/geom/Line.h>
38 #include <utils/geom/GeomHelper.h>
40 #include <guisim/GUIEdge.h>
42 
43 #ifdef CHECK_MEMORY_LEAKS
44 #include <foreign/nvwa/debug_new.h>
45 #endif // CHECK_MEMORY_LEAKS
46 
47 
48 // ===========================================================================
49 // method definitions
50 // ===========================================================================
51 /* -------------------------------------------------------------------------
52  * GUI_E2_ZS_CollectorOverLanes-methods
53  * ----------------------------------------------------------------------- */
55  DetectorUsage usage, MSLane* lane, SUMOReal startPos,
56  SUMOTime haltingTimeThreshold,
57  SUMOReal haltingSpeedThreshold,
58  SUMOReal jamDistThreshold)
59  : MS_E2_ZS_CollectorOverLanes(id, usage, lane, startPos,
60  haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold) {}
61 
62 
63 
65 
66 
69  return new MyWrapper(*this, myAlreadyBuild);
70 }
71 
72 
75  SUMOReal start, SUMOReal end) {
76  std::string id = makeID(myID, c, r);
77  if (start + end < l->getLength()) {
78  start = l->getLength() - end - (SUMOReal) 0.1;
79  }
80  return new GUI_E2_ZS_Collector(id, myUsage,
81  l, start, end, haltingTimeThresholdM,
83 }
84 
85 
86 /* -------------------------------------------------------------------------
87  * GUI_E2_ZS_CollectorOverLanes::MyWrapper-methods
88  * ----------------------------------------------------------------------- */
91  const LaneDetMap& detectors)
92  : GUIDetectorWrapper("E2OverLanes detector", detector.getID()),
93  myDetector(detector) {
94  for (LaneDetMap::const_iterator i = detectors.begin(); i != detectors.end(); ++i) {
95  GUI_E2_ZS_Collector* c = static_cast<GUI_E2_ZS_Collector*>((*i).second);
97  mySubWrappers.push_back(dw);
99  }
100 }
101 
102 
104  for (std::vector<GUIDetectorWrapper*>::iterator i = mySubWrappers.begin(); i != mySubWrappers.end(); ++i) {
105  delete(*i);
106  }
107 }
108 
109 
110 Boundary
112  Boundary b(myBoundary);
113  return b;
114 }
115 
116 
120  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, 12);
121  // add items
122  /*
123  myMkExistingItem(*ret, "density [?]", E2::DENSITY);
124  myMkExistingItem(*ret, "jam lengths [veh]", E2::MAX_JAM_LENGTH_IN_VEHICLES);
125  myMkExistingItem(*ret, "jam length [m]", E2::MAX_JAM_LENGTH_IN_METERS);
126  myMkExistingItem(*ret, "jam len sum [veh]", E2::JAM_LENGTH_SUM_IN_VEHICLES);
127  myMkExistingItem(*ret, "jam len sum [m]", E2::JAM_LENGTH_SUM_IN_METERS);
128  myMkExistingItem(*ret, "queue length [veh]", E2::QUEUE_LENGTH_AHEAD_OF_TRAFFIC_LIGHTS_IN_VEHICLES);
129  myMkExistingItem(*ret, "queue length [m]", E2::QUEUE_LENGTH_AHEAD_OF_TRAFFIC_LIGHTS_IN_METERS);
130  myMkExistingItem(*ret, "vehicles [veh]", E2::N_VEHICLES);
131  myMkExistingItem(*ret, "occupancy degree [?]", E2::OCCUPANCY_DEGREE);
132  myMkExistingItem(*ret, "space mean speed [?]", E2::SPACE_MEAN_SPEED);
133  myMkExistingItem(*ret, "halting duration [?]", E2::CURRENT_HALTING_DURATION_SUM_PER_VEHICLE);
134  */
135  //
136  ret->mkItem("length [m]", false, myDetector.getLength());
137  /*
138  ret->mkItem("position [m]", false,
139  myDetector.getStartPos());*/
140 // ret->mkItem("", false, myDetector.getStartLaneID());
141  // close building
142  ret->closeBuilding();
143  return ret;
144 }
145 
146 
147 /*
148 void
149 GUI_E2_ZS_CollectorOverLanes::MyWrapper::myMkExistingItem(GUIParameterTableWindow &ret,
150  const std::string &name,
151  E2::DetType type)
152 {
153 if (!myDetector.hasDetector(type)) {
154  return;
155 }
156 MyValueRetriever *binding =
157  new MyValueRetriever(myDetector, type, 1);
158 ret.mkItem(name.c_str(), true, binding);
159 }
160 */
161 
162 
163 void
165  for (std::vector<GUIDetectorWrapper*>::const_iterator i = mySubWrappers.begin(); i != mySubWrappers.end(); ++i) {
166  (*i)->drawGL(s);
167  }
168 }
169 
170 
173  return myDetector;
174 }
175 
176 
177 
178 /****************************************************************************/
179