SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUIInstantInductLoop.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // The gui-version of the MSInstantInductLoop
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2003-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 
35 #include "GUIInstantInductLoop.h"
36 #include <utils/gui/div/GLHelper.h>
37 #include <utils/geom/Line.h>
42 #include <microsim/MSLane.h>
43 #include "GUIEdge.h"
45 
46 #ifdef CHECK_MEMORY_LEAKS
47 #include <foreign/nvwa/debug_new.h>
48 #endif // CHECK_MEMORY_LEAKS
49 
50 
51 // ===========================================================================
52 // method definitions
53 // ===========================================================================
54 /* -------------------------------------------------------------------------
55  * GUIInstantInductLoop-methods
56  * ----------------------------------------------------------------------- */
58  MSLane* const lane, SUMOReal positionInMeters)
59  : MSInstantInductLoop(id, od, lane, positionInMeters) {}
60 
61 
63 
64 
67  return new MyWrapper(*this, myPosition);
68 }
69 
70 
71 /* -------------------------------------------------------------------------
72  * GUIInstantInductLoop::MyWrapper-methods
73  * ----------------------------------------------------------------------- */
75  : GUIDetectorWrapper("instant induct loop", detector.getID()),
76  myDetector(detector), myPosition(pos) {
81 }
82 
83 
85 
86 
89  Boundary b(myBoundary);
90  b.grow(20);
91  return b;
92 }
93 
94 
95 
98  GUISUMOAbstractView& /*parent !!! recheck this - never needed?*/) {
99  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, 7);
100  // add items
101  // parameter
102  ret->mkItem("position [m]", false, myPosition);
103  ret->mkItem("lane", false, myDetector.getLane()->getID());
104  // values
105  // close building
106  ret->closeBuilding();
107  return ret;
108 }
109 
110 
111 void
113  glPushName(getGlID());
114  SUMOReal width = (SUMOReal) 2.0 * s.scale;
115  glLineWidth(1.0);
116  // shape
117  glColor3d(1, 0, 1);
118  glPushMatrix();
119  glTranslated(0, 0, getType());
120  glTranslated(myFGPosition.x(), myFGPosition.y(), 0);
121  glRotated(myFGRotation, 0, 0, 1);
122  glScaled(s.addExaggeration, s.addExaggeration, 1);
123  glBegin(GL_QUADS);
124  glVertex2d(0 - 1.0, 2);
125  glVertex2d(-1.0, -2);
126  glVertex2d(1.0, -2);
127  glVertex2d(1.0, 2);
128  glEnd();
129  glTranslated(0, 0, .01);
130  glBegin(GL_LINES);
131  glVertex2d(0, 2 - .1);
132  glVertex2d(0, -2 + .1);
133  glEnd();
134 
135  // outline
136  if (width * s.addExaggeration > 1) {
137  glColor3d(1, 1, 1);
138  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
139  glBegin(GL_QUADS);
140  glVertex2f(0 - 1.0, 2);
141  glVertex2f(-1.0, -2);
142  glVertex2f(1.0, -2);
143  glVertex2f(1.0, 2);
144  glEnd();
145  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
146  }
147 
148  // position indicator
149  if (width * s.addExaggeration > 1) {
150  glRotated(90, 0, 0, -1);
151  glColor3d(1, 1, 1);
152  glBegin(GL_LINES);
153  glVertex2d(0, 1.7);
154  glVertex2d(0, -1.7);
155  glEnd();
156  }
157  glPopMatrix();
158  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
159  glPopName();
160 }
161 
162 
165  return myDetector;
166 }
167 
168 
169 
170 /****************************************************************************/
171