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-2018 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) {
55  if (show) {
57  return new GUIMEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos, vTypes);
58  }
59  return new GUIInductLoop(id, lane, pos, vTypes);
60  } else {
61  return NLDetectorBuilder::createInductLoop(id, lane, pos, vTypes);
62  }
63 }
64 
65 
68  MSLane* lane, double pos, const std::string& od, const std::string& vTypes) {
69  return new GUIInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos, vTypes);
70 }
71 
72 
75  DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
76  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
77  const std::string& vTypes, bool showDetector) {
78  return new GUIE2Collector(id, usage, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
79 }
80 
83  DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
84  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
85  const std::string& vTypes, bool showDetector) {
86  return new GUIE2Collector(id, usage, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
87 }
88 
91  const CrossSectionVector& entries,
92  const CrossSectionVector& exits,
93  double haltingSpeedThreshold,
94  SUMOTime haltingTimeThreshold, const std::string& vTypes, bool openEntry) {
95  return new GUIE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes, openEntry);
96 }
97 
98 
99 
100 /****************************************************************************/
101 
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:640
long long int SUMOTime
Definition: SUMOTime.h:36
GUIDetectorBuilder(MSNet &net)
Constructor.
An areal detector corresponding to a sequence of consecutive lanes.
Definition: MSE2Collector.h:80
std::vector< MSCrossSection > CrossSectionVector
The gui-version of the MSE2Collector.
The simulated network and simulation perfomer.
Definition: MSNet.h:84
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 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:78
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()