SUMO - Simulation of Urban MObility
GUIDetectorBuilder.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 // Builds detectors for guisim
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <string>
33 #include <iostream>
34 #include <guisim/GUIInductLoop.h>
35 #include <guisim/GUIE2Collector.h>
36 #include <guisim/GUIE3Collector.h>
38 #include <microsim/MSGlobals.h>
39 #include <microsim/MSNet.h>
43 #include "GUIDetectorBuilder.h"
44 
46 #include <mesosim/MELoop.h>
47 
48 
49 // ===========================================================================
50 // method definitions
51 // ===========================================================================
53  : NLDetectorBuilder(net) {}
54 
55 
57 
58 
61  MSLane* lane, double pos, const std::string& vTypes, bool show) {
62  if (show) {
64  return new GUIMEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos, vTypes);
65  }
66  return new GUIInductLoop(id, lane, pos, vTypes);
67  } else {
68  return NLDetectorBuilder::createInductLoop(id, lane, pos, vTypes);
69  }
70 }
71 
72 
75  MSLane* lane, double pos, const std::string& od, const std::string& vTypes) {
76  return new GUIInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos, vTypes);
77 }
78 
79 
82  DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
83  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
84  const std::string& vTypes, bool showDetector) {
85  return new GUIE2Collector(id, usage, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
86 }
87 
90  DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
91  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
92  const std::string& vTypes, bool showDetector) {
93  return new GUIE2Collector(id, usage, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
94 }
95 
98  const CrossSectionVector& entries,
99  const CrossSectionVector& exits,
100  double haltingSpeedThreshold,
101  SUMOTime haltingTimeThreshold, const std::string& vTypes) {
102  return new GUIE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes);
103 }
104 
105 
106 
107 /****************************************************************************/
108 
The gui-version of the MSE3Collector.
Builds detectors for microsim.
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:582
GUIDetectorBuilder(MSNet &net)
Constructor.
An areal detector corresponding to a sequence of consecutive lanes.
Definition: MSE2Collector.h:87
std::vector< MSCrossSection > CrossSectionVector
The gui-version of the MSE2Collector.
The simulated network and simulation perfomer.
Definition: MSNet.h:94
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:55
~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:113
long long int SUMOTime
Definition: TraCIDefs.h:52
static bool gUseMesoSim
Definition: MSGlobals.h:98
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
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.