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-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 /****************************************************************************/
16 // Builds detectors for guisim
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <string>
26 #include <iostream>
27 #include <guisim/GUIInductLoop.h>
28 #include <guisim/GUIE2Collector.h>
29 #include <guisim/GUIE3Collector.h>
31 #include <microsim/MSGlobals.h>
32 #include <microsim/MSNet.h>
36 #include "GUIDetectorBuilder.h"
37 
39 #include <mesosim/MELoop.h>
40 
41 
42 // ===========================================================================
43 // method definitions
44 // ===========================================================================
46  : NLDetectorBuilder(net) {}
47 
48 
50 
51 
54  MSLane* lane, double pos, const std::string& vTypes, bool show) {
56  return new GUIMEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos, vTypes);
57  } else {
58  return new GUIInductLoop(id, lane, pos, vTypes, show);
59  }
60 }
61 
62 
65  MSLane* lane, double pos, const std::string& od, const std::string& vTypes) {
66  return new GUIInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos, vTypes);
67 }
68 
69 
72  DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
73  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
74  const std::string& vTypes, bool showDetector) {
75  return new GUIE2Collector(id, usage, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
76 }
77 
80  DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
81  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
82  const std::string& vTypes, bool showDetector) {
83  return new GUIE2Collector(id, usage, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
84 }
85 
88  const CrossSectionVector& entries,
89  const CrossSectionVector& exits,
90  double haltingSpeedThreshold,
91  SUMOTime haltingTimeThreshold, const std::string& vTypes, bool openEntry) {
92  return new GUIE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes, openEntry);
93 }
94 
95 
96 
97 /****************************************************************************/
98 
The gui-version of the MSE3Collector.
Builds detectors for microsim.
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.
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:670
long long int SUMOTime
Definition: SUMOTime.h:35
GUIDetectorBuilder(MSNet &net)
Constructor.
An areal detector corresponding to a sequence of consecutive lanes.
Definition: MSE2Collector.h:81
std::vector< MSCrossSection > CrossSectionVector
The gui-version of the MSE2Collector.
The simulated network and simulation perfomer.
Definition: MSNet.h:92
The gui-version of the MSInductLoop.
Definition: GUIInductLoop.h:48
~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 MSInstantInductLoop.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:106
static bool gUseMesoSim
Definition: MSGlobals.h:91
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
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.
Base of value-generating classes (detectors)
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()