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.sourceforge.net/
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>
41 #include "GUILaneWrapper.h"
43 
44 #ifdef CHECK_MEMORY_LEAKS
45 #include <foreign/nvwa/debug_new.h>
46 #endif // CHECK_MEMORY_LEAKS
47 
48 
49 // ===========================================================================
50 // method definitions
51 // ===========================================================================
52 /* -------------------------------------------------------------------------
53  * GUI_E2_ZS_CollectorOverLanes-methods
54  * ----------------------------------------------------------------------- */
56  DetectorUsage usage, MSLane* lane, SUMOReal startPos,
57  SUMOTime haltingTimeThreshold,
58  SUMOReal haltingSpeedThreshold,
59  SUMOReal jamDistThreshold)
60  : MS_E2_ZS_CollectorOverLanes(id, usage, lane, startPos,
61  haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold) {}
62 
63 
64 
66 
67 
70  return new MyWrapper(*this, myAlreadyBuild);
71 }
72 
73 
76  SUMOReal start, SUMOReal end) {
77  std::string id = makeID(myID, c, r);
78  if (start + end < l->getLength()) {
79  start = l->getLength() - end - (SUMOReal) 0.1;
80  }
81  return new GUI_E2_ZS_Collector(id, myUsage,
82  l, start, end, haltingTimeThresholdM,
84 }
85 
86 
87 /* -------------------------------------------------------------------------
88  * GUI_E2_ZS_CollectorOverLanes::MyWrapper-methods
89  * ----------------------------------------------------------------------- */
92  const LaneDetMap& detectors)
93  : GUIDetectorWrapper("E2OverLanes detector", detector.getID()),
94  myDetector(detector) {
95  for (LaneDetMap::const_iterator i = detectors.begin(); i != detectors.end(); ++i) {
96  GUI_E2_ZS_Collector* c = static_cast<GUI_E2_ZS_Collector*>((*i).second);
98  mySubWrappers.push_back(dw);
100  }
101 }
102 
103 
105  for (std::vector<GUIDetectorWrapper*>::iterator i = mySubWrappers.begin(); i != mySubWrappers.end(); ++i) {
106  delete(*i);
107  }
108 }
109 
110 
111 Boundary
113  Boundary b(myBoundary);
114  return b;
115 }
116 
117 
121  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, 12);
122  // add items
123  /*
124  myMkExistingItem(*ret, "density [?]", E2::DENSITY);
125  myMkExistingItem(*ret, "jam lengths [veh]", E2::MAX_JAM_LENGTH_IN_VEHICLES);
126  myMkExistingItem(*ret, "jam length [m]", E2::MAX_JAM_LENGTH_IN_METERS);
127  myMkExistingItem(*ret, "jam len sum [veh]", E2::JAM_LENGTH_SUM_IN_VEHICLES);
128  myMkExistingItem(*ret, "jam len sum [m]", E2::JAM_LENGTH_SUM_IN_METERS);
129  myMkExistingItem(*ret, "queue length [veh]", E2::QUEUE_LENGTH_AHEAD_OF_TRAFFIC_LIGHTS_IN_VEHICLES);
130  myMkExistingItem(*ret, "queue length [m]", E2::QUEUE_LENGTH_AHEAD_OF_TRAFFIC_LIGHTS_IN_METERS);
131  myMkExistingItem(*ret, "vehicles [veh]", E2::N_VEHICLES);
132  myMkExistingItem(*ret, "occupancy degree [?]", E2::OCCUPANCY_DEGREE);
133  myMkExistingItem(*ret, "space mean speed [?]", E2::SPACE_MEAN_SPEED);
134  myMkExistingItem(*ret, "halting duration [?]", E2::CURRENT_HALTING_DURATION_SUM_PER_VEHICLE);
135  */
136  //
137  ret->mkItem("length [m]", false, myDetector.getLength());
138  /*
139  ret->mkItem("position [m]", false,
140  myDetector.getStartPos());*/
141 // ret->mkItem("", false, myDetector.getStartLaneID());
142  // close building
143  ret->closeBuilding();
144  return ret;
145 }
146 
147 
148 /*
149 void
150 GUI_E2_ZS_CollectorOverLanes::MyWrapper::myMkExistingItem(GUIParameterTableWindow &ret,
151  const std::string &name,
152  E2::DetType type)
153 {
154 if (!myDetector.hasDetector(type)) {
155  return;
156 }
157 MyValueRetriever *binding =
158  new MyValueRetriever(myDetector, type, 1);
159 ret.mkItem(name.c_str(), true, binding);
160 }
161 */
162 
163 
164 void
166  for (std::vector<GUIDetectorWrapper*>::const_iterator i = mySubWrappers.begin(); i != mySubWrappers.end(); ++i) {
167  (*i)->drawGL(s);
168  }
169 }
170 
171 
174  return myDetector;
175 }
176 
177 
178 
179 /****************************************************************************/
180