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