SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUIE3Collector.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // The gui-version of a MSE3Collector
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 
33 #include "GUIE3Collector.h"
34 #include "GUIEdge.h"
35 #include <utils/geom/Line.h>
37 #include <utils/gui/div/GLHelper.h>
39 #include <microsim/MSLane.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 // ===========================================================================
50 /* -------------------------------------------------------------------------
51  * GUIE3Collector::MyWrapper-methods
52  * ----------------------------------------------------------------------- */
54  : GUIDetectorWrapper("E3 detector", detector.getID()),
55  myDetector(detector) {
56  const CrossSectionVector& entries = detector.getEntries();
57  const CrossSectionVector& exits = detector.getExits();
59  for (i = entries.begin(); i != entries.end(); ++i) {
62  myEntryDefinitions.push_back(def);
63  }
64  for (i = exits.begin(); i != exits.end(); ++i) {
67  myExitDefinitions.push_back(def);
68  }
69 }
70 
71 
73 
74 
80  return def;
81 }
82 
83 
88  new GUIParameterTableWindow(app, *this, 3);
89  // add items
90  // values
91  ret->mkItem("vehicles within [#]", true,
93  ret->mkItem("mean speed [m/s]", true,
95  ret->mkItem("haltings [#]", true,
97  // close building
98  ret->closeBuilding();
99  return ret;
100 }
101 
102 
103 void
105  glPushName(getGlID());
106  glPushMatrix();
107  glTranslated(0, 0, getType());
108  typedef std::vector<SingleCrossingDefinition> CrossingDefinitions;
109  CrossingDefinitions::const_iterator i;
110  glColor3d(0, .8, 0);
111  for (i = myEntryDefinitions.begin(); i != myEntryDefinitions.end(); ++i) {
112  drawSingleCrossing((*i).myFGPosition, (*i).myFGRotation, s.addExaggeration);
113  }
114  glColor3d(.8, 0, 0);
115  for (i = myExitDefinitions.begin(); i != myExitDefinitions.end(); ++i) {
116  drawSingleCrossing((*i).myFGPosition, (*i).myFGRotation, s.addExaggeration);
117  }
118  glPopMatrix();
119  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
120  glPopName();
121 }
122 
123 
124 void
126  SUMOReal rot, SUMOReal upscale) const {
127  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
128  glPushMatrix();
129  glScaled(upscale, upscale, 1);
130  glTranslated(pos.x(), pos.y(), 0);
131  glRotated(rot, 0, 0, 1);
132  glBegin(GL_LINES);
133  glVertex2d(1.7, 0);
134  glVertex2d(-1.7, 0);
135  glEnd();
136  glBegin(GL_QUADS);
137  glVertex2d(-1.7, .5);
138  glVertex2d(-1.7, -.5);
139  glVertex2d(1.7, -.5);
140  glVertex2d(1.7, .5);
141  glEnd();
142  // arrows
143  glTranslated(1.5, 0, 0);
144  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
146  glTranslated(-3, 0, 0);
147  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
149  glPopMatrix();
150 }
151 
152 
153 Boundary
155  Boundary b(myBoundary);
156  b.grow(20);
157  return b;
158 }
159 
160 
163  return myDetector;
164 }
165 
166 
167 /* -------------------------------------------------------------------------
168  * GUIE3Collector-methods
169  * ----------------------------------------------------------------------- */
170 GUIE3Collector::GUIE3Collector(const std::string& id,
171  const CrossSectionVector& entries, const CrossSectionVector& exits,
172  SUMOReal haltingSpeedThreshold,
173  SUMOTime haltingTimeThreshold)
174  : MSE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold) {}
175 
176 
178 
179 
180 const CrossSectionVector&
182  return myEntries;
183 }
184 
185 
186 const CrossSectionVector&
188  return myExits;
189 }
190 
191 
192 
195  return new MyWrapper(*this);
196 }
197 
198 
199 
200 /****************************************************************************/
201