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-2016 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>
37 #include <guisim/GUIE3Collector.h>
39 #include <microsim/MSGlobals.h>
40 #include <microsim/MSNet.h>
44 #include "GUIDetectorBuilder.h"
45 
47 #include <mesosim/MELoop.h>
48 
49 #ifdef CHECK_MEMORY_LEAKS
50 #include <foreign/nvwa/debug_new.h>
51 #endif // CHECK_MEMORY_LEAKS
52 
53 
54 // ===========================================================================
55 // method definitions
56 // ===========================================================================
58  : NLDetectorBuilder(net) {}
59 
60 
62 
63 
66  MSLane* lane, SUMOReal pos, const std::string& vTypes, bool show) {
67  if (show) {
69  return new GUIMEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos, vTypes);
70  }
71  return new GUIInductLoop(id, lane, pos, vTypes);
72  } else {
73  return NLDetectorBuilder::createInductLoop(id, lane, pos, vTypes);
74  }
75 }
76 
77 
80  MSLane* lane, SUMOReal pos, const std::string& od, const std::string& vTypes) {
81  return new GUIInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos, vTypes);
82 }
83 
84 
87  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
88  SUMOTime haltingTimeThreshold,
89  SUMOReal haltingSpeedThreshold,
90  SUMOReal jamDistThreshold, const std::string& vTypes) {
91  return new GUI_E2_ZS_Collector(id, usage, lane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
92 }
93 
94 
97  DetectorUsage usage, MSLane* lane, SUMOReal pos,
98  SUMOTime haltingTimeThreshold,
99  SUMOReal haltingSpeedThreshold,
100  SUMOReal jamDistThreshold, const std::string& vTypes) {
101  return new GUI_E2_ZS_CollectorOverLanes(id, usage, lane, pos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
102 }
103 
104 
107  const CrossSectionVector& entries,
108  const CrossSectionVector& exits,
109  SUMOReal haltingSpeedThreshold,
110  SUMOTime haltingTimeThreshold, const std::string& vTypes) {
111  return new GUIE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes);
112 }
113 
114 
115 
116 /****************************************************************************/
117 
The gui-version of the MSE3Collector.
Builds detectors for microsim.
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:571
long long int SUMOTime
Definition: SUMOTime.h:43
The gui-version of a MS_E2_ZS_CollectorOverLanes.
GUIDetectorBuilder(MSNet &net)
Constructor.
An areal (along a single lane) detector.
Definition: MSE2Collector.h:83
std::vector< MSCrossSection > CrossSectionVector
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes)
Creates an instance of an e3 detector using the given values.
The simulated network and simulation perfomer.
Definition: MSNet.h:93
virtual MSDetectorFileOutput * createInstantInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, const std::string &od, const std::string &vTypes)
Creates an instance of an e1 detector using the given values.
The gui-version of the MSInductLoop.
Definition: GUIInductLoop.h:55
~GUIDetectorBuilder()
Destructor.
virtual MSE2Collector * createSingleLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, const std::string &vTypes)
Creates an instance of an e2-detector (areal detector) using the given values.
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, SUMOReal 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.
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, const std::string &vTypes, bool show=true)
Creates an instance of an e1 detector using the given values.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:107
The gui-version of the MS_E2_ZS_Collector.
#define SUMOReal
Definition: config.h:213
virtual MSDetectorFileOutput * createMultiLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, const std::string &vTypes)
Creates an instance of an e2ol-detector using the given values.
static bool gUseMesoSim
Definition: MSGlobals.h:95
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
Base of value-generating classes (detectors)