Eclipse SUMO - Simulation of Urban MObility
GUIInductLoop.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // The gui-version of the MSInductLoop, together with the according
19 /****************************************************************************/
20 #ifndef GUIInductLoop_h
21 #define GUIInductLoop_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <fx.h>
31 #include <utils/geom/Position.h>
32 #include "GUIDetectorWrapper.h"
33 
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
48 class GUIInductLoop : public MSInductLoop {
49 public:
57  GUIInductLoop(const std::string& id, MSLane* const lane, double position, const std::string& vTypes, bool show);
58 
59 
62 
63 
69  void reset();
70 
71 
76 
77 
88  std::vector<VehicleData> collectVehiclesOnDet(SUMOTime t, bool leaveTime = false) const;
89 
90 
92  void setSpecialColor(const RGBColor* color);
93 
95  bool isVisible() const {
96  return myShow;
97  }
98 
100  void setVisible(bool show) {
101  myShow = show;
102  }
103 
104 protected:
107 
116  void enterDetectorByMove(SUMOTrafficObject& veh, double entryTimestep);
117 
118 
127  void leaveDetectorByMove(SUMOTrafficObject& veh, double leaveTimestep);
128 
129 
137  void leaveDetectorByLaneChange(SUMOTrafficObject& veh, double lastPos);
139 
140 
141 
142 
143 public:
148  class MyWrapper : public GUIDetectorWrapper {
149  public:
151  MyWrapper(GUIInductLoop& detector, double pos);
152 
154  ~MyWrapper();
155 
156 
158 
159 
168  GUIMainWindow& app, GUISUMOAbstractView& parent);
169 
170 
177 
178 
183  void drawGL(const GUIVisualizationSettings& s) const;
185 
186 
189 
191  void setSpecialColor(const RGBColor* color) {
192  mySpecialColor = color;
193  }
194 
195  private:
198 
201 
204 
206  double myFGRotation;
207 
209  double myPosition;
210 
213 
214  private:
216  MyWrapper(const MyWrapper&);
217 
219  MyWrapper& operator=(const MyWrapper&);
220 
221  };
222 
223 private:
224 
227 
229  bool myShow;
230 
232  mutable FXMutex myLock;
233 
234 };
235 
236 
237 #endif
238 
239 /****************************************************************************/
240 
GUIInductLoop::MyWrapper::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIInductLoop.cpp:123
GUIInductLoop::leaveDetectorByLaneChange
void leaveDetectorByLaneChange(SUMOTrafficObject &veh, double lastPos)
Removes a vehicle from the detector's map myVehiclesOnDet.
Definition: GUIInductLoop.cpp:83
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:48
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:63
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
GUIDetectorWrapper
Definition: GUIDetectorWrapper.h:43
GUIInductLoop::setVisible
void setVisible(bool show)
toggle visibility
Definition: GUIInductLoop.h:100
GUIInductLoop::MyWrapper::setSpecialColor
void setSpecialColor(const RGBColor *color)
set (outline) color for extra visualiaztion
Definition: GUIInductLoop.h:191
GUIInductLoop::MyWrapper::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIInductLoop.cpp:157
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
MSInductLoop
An unextended detector measuring at a fixed position on a fixed lane.
Definition: MSInductLoop.h:64
GUIInductLoop::MyWrapper::myPosition
double myPosition
The position on the lane.
Definition: GUIInductLoop.h:209
GUIInductLoop::isVisible
bool isVisible() const
whether the induction loop shall be visible
Definition: GUIInductLoop.h:95
GUIInductLoop::MyWrapper::myFGPosition
Position myFGPosition
The position in full-geometry mode.
Definition: GUIInductLoop.h:203
GUIInductLoop::leaveDetectorByMove
void leaveDetectorByMove(SUMOTrafficObject &veh, double leaveTimestep)
Processes a vehicle that leaves the detector.
Definition: GUIInductLoop.cpp:77
RGBColor
Definition: RGBColor.h:40
GUIInductLoop::~GUIInductLoop
~GUIInductLoop()
Destructor.
Definition: GUIInductLoop.cpp:52
GUIInductLoop::myShow
bool myShow
whether this induction loop shall be visible in the gui
Definition: GUIInductLoop.h:229
GUIInductLoop::GUIInductLoop
GUIInductLoop(const std::string &id, MSLane *const lane, double position, const std::string &vTypes, bool show)
Constructor.
Definition: GUIInductLoop.cpp:44
GUIInductLoop::myLock
FXMutex myLock
Mutex preventing parallel read/write access to internal MSInductLoop state.
Definition: GUIInductLoop.h:232
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GUIInductLoop::buildDetectorGUIRepresentation
virtual GUIDetectorWrapper * buildDetectorGUIRepresentation()
Returns this detector's visualisation-wrapper.
Definition: GUIInductLoop.cpp:56
GUIInductLoop::MyWrapper::myFGRotation
double myFGRotation
The rotation in full-geometry mode.
Definition: GUIInductLoop.h:206
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GUIInductLoop::MyWrapper::mySpecialColor
const RGBColor * mySpecialColor
color for extra visualization
Definition: GUIInductLoop.h:212
GUIInductLoop::MyWrapper::operator=
MyWrapper & operator=(const MyWrapper &)
Invalidated assignment operator.
GUIDetectorWrapper.h
GUIInductLoop::reset
void reset()
Resets all generated values to allow computation of next interval.
Definition: GUIInductLoop.cpp:64
GUIInductLoop::MyWrapper::getLoop
GUIInductLoop & getLoop()
Returns the detector itself.
Definition: GUIInductLoop.cpp:217
GUIInductLoop::MyWrapper::myBoundary
Boundary myBoundary
The detector's boundary.
Definition: GUIInductLoop.h:200
GUIInductLoop::MyWrapper::~MyWrapper
~MyWrapper()
Destructor.
Definition: GUIInductLoop.cpp:119
GUIInductLoop
The gui-version of the MSInductLoop.
Definition: GUIInductLoop.h:48
GUIInductLoop::myWrapper
MyWrapper * myWrapper
the glObject wrapper for this induction loop
Definition: GUIInductLoop.h:226
Position.h
GUIInductLoop::MyWrapper::myDetector
GUIInductLoop & myDetector
The wrapped detector.
Definition: GUIInductLoop.h:197
GUIMainWindow
Definition: GUIMainWindow.h:47
GUIInductLoop::setSpecialColor
void setSpecialColor(const RGBColor *color)
sets special caller for myWrapper
Definition: GUIInductLoop.cpp:97
GUIInductLoop::MyWrapper::MyWrapper
MyWrapper(GUIInductLoop &detector, double pos)
Constructor.
Definition: GUIInductLoop.cpp:108
config.h
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GUIInductLoop::MyWrapper
A MSInductLoop-visualiser.
Definition: GUIInductLoop.h:148
MSInductLoop.h
GUIInductLoop::enterDetectorByMove
void enterDetectorByMove(SUMOTrafficObject &veh, double entryTimestep)
Introduces a vehicle to the detector's map myVehiclesOnDet.
Definition: GUIInductLoop.cpp:71
GUIInductLoop::MyWrapper::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIInductLoop.cpp:132
GUIInductLoop::collectVehiclesOnDet
std::vector< VehicleData > collectVehiclesOnDet(SUMOTime t, bool leaveTime=false) const
Returns vehicle data for vehicles that have been on the detector starting at the given time.
Definition: GUIInductLoop.cpp:90