Eclipse SUMO - Simulation of Urban MObility
GUIDetectorBuilder.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // Builds detectors for guisim
20 /****************************************************************************/
21 #include <config.h>
22 
23 #include <string>
24 #include <iostream>
25 #include <guisim/GUIInductLoop.h>
26 #include <guisim/GUIE2Collector.h>
27 #include <guisim/GUIE3Collector.h>
29 #include <microsim/MSGlobals.h>
30 #include <microsim/MSNet.h>
34 #include "GUIDetectorBuilder.h"
35 
37 #include <mesosim/MELoop.h>
38 
39 
40 // ===========================================================================
41 // method definitions
42 // ===========================================================================
44  : NLDetectorBuilder(net) {}
45 
46 
48 
49 
52  MSLane* lane, double pos, const std::string& vTypes, bool show) {
54  return new GUIMEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos, vTypes);
55  } else {
56  return new GUIInductLoop(id, lane, pos, vTypes, show);
57  }
58 }
59 
60 
63  MSLane* lane, double pos, const std::string& od, const std::string& vTypes) {
64  return new GUIInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos, vTypes);
65 }
66 
67 
70  DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
71  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
72  const std::string& vTypes, bool showDetector) {
73  return new GUIE2Collector(id, usage, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
74 }
75 
78  DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
79  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
80  const std::string& vTypes, bool showDetector) {
81  return new GUIE2Collector(id, usage, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
82 }
83 
86  const CrossSectionVector& entries,
87  const CrossSectionVector& exits,
88  double haltingSpeedThreshold,
89  SUMOTime haltingTimeThreshold, const std::string& vTypes, bool openEntry) {
90  return new GUIE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes, openEntry);
91 }
92 
93 
94 /****************************************************************************/
std::vector< MSCrossSection > CrossSectionVector
long long int SUMOTime
Definition: SUMOTime.h:31
GUIDetectorBuilder(MSNet &net)
Constructor.
virtual MSE2Collector * createE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, double pos, double endPos, double length, SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, const std::string &vTypes, bool showDetector)
Creates a GUIE2Collector instance, overrides MSE2Collector::createE2Detector()
virtual MSDetectorFileOutput * createInstantInductLoop(const std::string &id, MSLane *lane, double pos, const std::string &od, const std::string &vTypes)
Creates an instance of an e1 detector using the given values.
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes, bool openEntry)
Creates an instance of an e3 detector using the given values.
~GUIDetectorBuilder()
Destructor.
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, double pos, const std::string &vTypes, bool show=true)
Creates an instance of an e1 detector using the given values.
The gui-version of the MSE2Collector.
The gui-version of the MSE3Collector.
The gui-version of the MSInductLoop.
Definition: GUIInductLoop.h:45
The gui-version of the MSInstantInductLoop.
Base of value-generating classes (detectors)
An areal detector corresponding to a sequence of consecutive lanes.
Definition: MSE2Collector.h:79
static bool gUseMesoSim
Definition: MSGlobals.h:88
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:94
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:673
The simulated network and simulation perfomer.
Definition: MSNet.h:89
Builds detectors for microsim.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.