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 /****************************************************************************/
17 // The gui-version of the MSInductLoop, together with the according
18 /****************************************************************************/
19 #ifndef GUIInductLoop_h
20 #define GUIInductLoop_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <fx.h>
30 #include <utils/geom/Position.h>
31 #include "GUIDetectorWrapper.h"
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
47 class GUIInductLoop : public MSInductLoop {
48 public:
56  GUIInductLoop(const std::string& id, MSLane* const lane, double position, const std::string& vTypes, bool show);
57 
58 
61 
62 
68  void reset();
69 
70 
75 
76 
87  std::vector<VehicleData> collectVehiclesOnDet(SUMOTime t, bool leaveTime = false) const;
88 
89 
91  void setSpecialColor(const RGBColor* color);
92 
94  bool isVisible() const {
95  return myShow;
96  }
97 
99  void setVisible(bool show) {
100  myShow = show;
101  }
102 
103 protected:
106 
115  void enterDetectorByMove(SUMOTrafficObject& veh, double entryTimestep);
116 
117 
126  void leaveDetectorByMove(SUMOTrafficObject& veh, double leaveTimestep);
127 
128 
136  void leaveDetectorByLaneChange(SUMOTrafficObject& veh, double lastPos);
138 
139 
140 
141 
142 public:
147  class MyWrapper : public GUIDetectorWrapper {
148  public:
150  MyWrapper(GUIInductLoop& detector, double pos);
151 
153  ~MyWrapper();
154 
155 
157 
158 
167  GUIMainWindow& app, GUISUMOAbstractView& parent);
168 
169 
176 
177 
182  void drawGL(const GUIVisualizationSettings& s) const;
184 
185 
187  void setSpecialColor(const RGBColor* color) {
188  mySpecialColor = color;
189  }
190 
191  private:
194 
197 
200 
202  double myFGRotation;
203 
205  double myPosition;
206 
209 
210  private:
213 
216 
217  };
218 
219 private:
220 
223 
225  bool myShow;
226 
228  mutable FXMutex myLock;
229 
230 };
231 
232 
233 #endif
234 
235 /****************************************************************************/
236 
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:47
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
GUIDetectorWrapper
Definition: GUIDetectorWrapper.h:42
GUIInductLoop::setVisible
void setVisible(bool show)
toggle visibility
Definition: GUIInductLoop.h:99
GUIInductLoop::MyWrapper::setSpecialColor
void setSpecialColor(const RGBColor *color)
set (outline) color for extra visualiaztion
Definition: GUIInductLoop.h:187
GUIInductLoop::MyWrapper::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIInductLoop.cpp:157
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
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:205
GUIInductLoop::isVisible
bool isVisible() const
whether the induction loop shall be visible
Definition: GUIInductLoop.h:94
GUIInductLoop::MyWrapper::myFGPosition
Position myFGPosition
The position in full-geometry mode.
Definition: GUIInductLoop.h:199
GUIInductLoop::leaveDetectorByMove
void leaveDetectorByMove(SUMOTrafficObject &veh, double leaveTimestep)
Processes a vehicle that leaves the detector.
Definition: GUIInductLoop.cpp:77
RGBColor
Definition: RGBColor.h:39
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:225
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:228
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GUIInductLoop::MyWrapper::MyWrapper
MyWrapper(const MyWrapper &)
Invalidated copy constructor.
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:202
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GUIInductLoop::MyWrapper::mySpecialColor
const RGBColor * mySpecialColor
color for extra visualization
Definition: GUIInductLoop.h:208
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::myBoundary
Boundary myBoundary
The detector's boundary.
Definition: GUIInductLoop.h:196
GUIInductLoop::MyWrapper::~MyWrapper
~MyWrapper()
Destructor.
Definition: GUIInductLoop.cpp:119
GUIInductLoop
The gui-version of the MSInductLoop.
Definition: GUIInductLoop.h:47
GUIInductLoop::myWrapper
MyWrapper * myWrapper
the glObject wrapper for this induction loop
Definition: GUIInductLoop.h:222
Position.h
GUIInductLoop::MyWrapper::myDetector
GUIInductLoop & myDetector
The wrapped detector.
Definition: GUIInductLoop.h:193
GUIMainWindow
Definition: GUIMainWindow.h:46
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:345
GUIInductLoop::MyWrapper
A MSInductLoop-visualiser.
Definition: GUIInductLoop.h:147
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