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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // Builds detectors for guisim
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #include <string>
32 #include <iostream>
33 #include <guisim/GUIInductLoop.h>
34 #include <guisim/GUIE2Collector.h>
35 #include <guisim/GUIE3Collector.h>
37 #include <microsim/MSGlobals.h>
38 #include <microsim/MSNet.h>
42 #include "GUIDetectorBuilder.h"
43 
45 #include <mesosim/MELoop.h>
46 
47 
48 // ===========================================================================
49 // method definitions
50 // ===========================================================================
52  : NLDetectorBuilder(net) {}
53 
54 
56 
57 
60  MSLane* lane, double pos, const std::string& vTypes, bool show) {
61  if (show) {
63  return new GUIMEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos, vTypes);
64  }
65  return new GUIInductLoop(id, lane, pos, vTypes);
66  } else {
67  return NLDetectorBuilder::createInductLoop(id, lane, pos, vTypes);
68  }
69 }
70 
71 
74  MSLane* lane, double pos, const std::string& od, const std::string& vTypes) {
75  return new GUIInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos, vTypes);
76 }
77 
78 
81  DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
82  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
83  const std::string& vTypes, bool showDetector) {
84  return new GUIE2Collector(id, usage, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
85 }
86 
89  DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
90  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
91  const std::string& vTypes, bool showDetector) {
92  return new GUIE2Collector(id, usage, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
93 }
94 
97  const CrossSectionVector& entries,
98  const CrossSectionVector& exits,
99  double haltingSpeedThreshold,
100  SUMOTime haltingTimeThreshold, const std::string& vTypes) {
101  return new GUIE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes);
102 }
103 
104 
105 
106 /****************************************************************************/
107 
The gui-version of the MSE3Collector.
Builds detectors for microsim.
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:607
GUIDetectorBuilder(MSNet &net)
Constructor.
An areal detector corresponding to a sequence of consecutive lanes.
Definition: MSE2Collector.h:86
std::vector< MSCrossSection > CrossSectionVector
The gui-version of the MSE2Collector.
The simulated network and simulation perfomer.
Definition: MSNet.h:90
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:54
~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:112
long long int SUMOTime
Definition: TraCIDefs.h:51
static bool gUseMesoSim
Definition: MSGlobals.h:97
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
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()
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes)
Creates an instance of an e3 detector using the given values.