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 
long long int SUMOTime
Definition: SUMOTime.h:35
Boundary myBoundary
The detector&#39;s boundary.
A MSInductLoop-visualiser.
void reset()
Resets all generated values to allow computation of next interval.
MyWrapper & operator=(const MyWrapper &)
Invalidated assignment operator.
MyWrapper(GUIInductLoop &detector, double pos)
Constructor.
Stores the information about how to visualize structures.
void setVisible(bool show)
toggle visibility
void setSpecialColor(const RGBColor *color)
sets special caller for myWrapper
Position myFGPosition
The position in full-geometry mode.
GUIInductLoop & myDetector
The wrapped detector.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
The gui-version of the MSInductLoop.
Definition: GUIInductLoop.h:48
double myPosition
The position on the lane.
virtual GUIDetectorWrapper * buildDetectorGUIRepresentation()
Returns this detector&#39;s visualisation-wrapper.
const RGBColor * mySpecialColor
color for extra visualization
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
FXMutex myLock
Mutex preventing parallel read/write access to internal MSInductLoop state.
bool myShow
whether this induction loop shall be visible in the gui
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...
void setSpecialColor(const RGBColor *color)
set (outline) color for extra visualiaztion
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool isVisible() const
whether the induction loop shall be visible
Definition: GUIInductLoop.h:95
Representation of a vehicle or person.
void leaveDetectorByLaneChange(SUMOTrafficObject &veh, double lastPos)
Removes a vehicle from the detector&#39;s map myVehiclesOnDet.
MyWrapper * myWrapper
the glObject wrapper for this induction loop
void enterDetectorByMove(SUMOTrafficObject &veh, double entryTimestep)
Introduces a vehicle to the detector&#39;s map myVehiclesOnDet.
~GUIInductLoop()
Destructor.
GUIInductLoop & getLoop()
Returns the detector itself.
void leaveDetectorByMove(SUMOTrafficObject &veh, double leaveTimestep)
Processes a vehicle that leaves the detector.
double myFGRotation
The rotation in full-geometry mode.
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
A window containing a gl-object&#39;s parameter.
GUIInductLoop(const std::string &id, MSLane *const lane, double position, const std::string &vTypes, bool show)
Constructor.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
An unextended detector measuring at a fixed position on a fixed lane.
Definition: MSInductLoop.h:64