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-2015 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 
46 #ifdef HAVE_INTERNAL
47 #include <mesogui/GUIMEInductLoop.h>
48 #include <mesosim/MELoop.h>
49 #endif
50 
51 #ifdef CHECK_MEMORY_LEAKS
52 #include <foreign/nvwa/debug_new.h>
53 #endif // CHECK_MEMORY_LEAKS
54 
55 
56 // ===========================================================================
57 // method definitions
58 // ===========================================================================
60  : NLDetectorBuilder(net) {}
61 
62 
64 
65 
68  MSLane* lane, SUMOReal pos, bool splitByType, bool show) {
69  if (show) {
70 #ifdef HAVE_INTERNAL
72  return new GUIMEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos);
73  }
74 #endif
75  return new GUIInductLoop(id, lane, pos, splitByType);
76  } else {
77  return NLDetectorBuilder::createInductLoop(id, lane, pos, splitByType);
78  }
79 }
80 
81 
84  MSLane* lane, SUMOReal pos, const std::string& od) {
85  return new GUIInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos);
86 }
87 
88 
91  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
92  SUMOTime haltingTimeThreshold,
93  SUMOReal haltingSpeedThreshold,
94  SUMOReal jamDistThreshold) {
95  return new GUI_E2_ZS_Collector(id, usage, lane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
96 }
97 
98 
101  DetectorUsage usage, MSLane* lane, SUMOReal pos,
102  SUMOTime haltingTimeThreshold,
103  SUMOReal haltingSpeedThreshold,
104  SUMOReal jamDistThreshold) {
105  return new GUI_E2_ZS_CollectorOverLanes(id, usage, lane, pos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
106 }
107 
108 
111  const CrossSectionVector& entries,
112  const CrossSectionVector& exits,
113  SUMOReal haltingSpeedThreshold,
114  SUMOTime haltingTimeThreshold) {
115  return new GUIE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold);
116 }
117 
118 
119 
120 /****************************************************************************/
121 
The gui-version of the MSE3Collector.
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:461
Builds detectors for microsim.
long long int SUMOTime
Definition: SUMOTime.h:43
virtual MSDetectorFileOutput * createInstantInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, const std::string &od)
Creates an instance of an e1 detector using the given values.
The gui-version of a MS_E2_ZS_CollectorOverLanes.
GUIDetectorBuilder(MSNet &net)
Constructor.
std::vector< MSCrossSection > CrossSectionVector
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, bool splitByType, bool show=true)
Creates an instance of an e1 detector using the given values.
virtual MSDetectorFileOutput * createSingleLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Creates an instance of an e2-detector (areal detector) using the given values.
The simulated network and simulation perfomer.
Definition: MSNet.h:94
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold)
Creates an instance of an e3 detector using the given values.
The gui-version of the MSInductLoop.
Definition: GUIInductLoop.h:55
~GUIDetectorBuilder()
Destructor.
virtual MSDetectorFileOutput * createMultiLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Creates an instance of an e2ol-detector using the given values.
The gui-version of the MSInstantInductLoop.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
The gui-version of the MS_E2_ZS_Collector.
#define SUMOReal
Definition: config.h:214
static const bool gUseMesoSim
Definition: MSGlobals.h:102
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
Base of value-generating classes (detectors)
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, bool splitByType, bool show=true)
Creates an instance of an e1 detector using the given values.