LCOV - code coverage report
Current view: top level - src/guinetload - GUIDetectorBuilder.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 15 15
Test Date: 2026-03-02 16:00:03 Functions: 87.5 % 8 7

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
       4              : // This program and the accompanying materials are made available under the
       5              : // terms of the Eclipse Public License 2.0 which is available at
       6              : // https://www.eclipse.org/legal/epl-2.0/
       7              : // This Source Code may also be made available under the following Secondary
       8              : // Licenses when the conditions for such availability set forth in the Eclipse
       9              : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10              : // or later which is available at
      11              : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12              : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13              : /****************************************************************************/
      14              : /// @file    GUIDetectorBuilder.cpp
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Michael Behrisch
      17              : /// @date    Tue, 22 Jul 2003
      18              : ///
      19              : // Builds detectors for guisim
      20              : /****************************************************************************/
      21              : #include <config.h>
      22              : 
      23              : #include <string>
      24              : #include <iostream>
      25              : #include <guisim/GUIInductLoop.h>
      26              : #include <guisim/GUIE2Collector.h>
      27              : #include <guisim/GUIE3Collector.h>
      28              : #include <guisim/GUIInstantInductLoop.h>
      29              : #include <microsim/MSGlobals.h>
      30              : #include <microsim/MSNet.h>
      31              : #include <microsim/output/MSInductLoop.h>
      32              : #include <utils/common/UtilExceptions.h>
      33              : #include <utils/common/FileHelpers.h>
      34              : #include "GUIDetectorBuilder.h"
      35              : 
      36              : #include <mesogui/GUIMEInductLoop.h>
      37              : #include <mesosim/MELoop.h>
      38              : 
      39              : 
      40              : // ===========================================================================
      41              : // method definitions
      42              : // ===========================================================================
      43         8432 : GUIDetectorBuilder::GUIDetectorBuilder(MSNet& net)
      44         8432 :     : NLDetectorBuilder(net) {}
      45              : 
      46              : 
      47         8432 : GUIDetectorBuilder::~GUIDetectorBuilder() {}
      48              : 
      49              : 
      50              : MSDetectorFileOutput*
      51         1571 : GUIDetectorBuilder::createInductLoop(const std::string& id,
      52              :                                      MSLane* lane, double pos, double length,
      53              :                                      const std::string name, const std::string& vTypes,
      54              :                                      const std::string& nextEdges,
      55              :                                      int detectPersons, bool show) {
      56         1571 :     if (MSGlobals::gUseMesoSim) {
      57          540 :         return new GUIMEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos, name, vTypes, nextEdges, detectPersons, show);
      58              :     } else {
      59         2783 :         return new GUIInductLoop(id, lane, pos, length, name, vTypes, nextEdges, detectPersons, show);
      60              :     }
      61              : }
      62              : 
      63              : 
      64              : MSDetectorFileOutput*
      65          123 : GUIDetectorBuilder::createInstantInductLoop(const std::string& id,
      66              :         MSLane* lane, double pos, const std::string& od, const std::string name, const std::string& vTypes, const std::string& nextEdges,
      67              :         int detectPersons) {
      68          247 :     return new GUIInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos, name, vTypes, nextEdges, detectPersons);
      69              : }
      70              : 
      71              : 
      72              : MSE2Collector*
      73          771 : GUIDetectorBuilder::createE2Detector(const std::string& id,
      74              :                                      DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
      75              :                                      SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
      76              :                                      const std::string name, const std::string& vTypes,
      77              :                                      const std::string& nextEdges,
      78              :                                      int detectPersons, bool showDetector) {
      79         2313 :     return new GUIE2Collector(id, usage, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, name, vTypes, nextEdges, detectPersons, showDetector);
      80              : }
      81              : 
      82              : MSE2Collector*
      83            6 : GUIDetectorBuilder::createE2Detector(const std::string& id,
      84              :                                      DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
      85              :                                      SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
      86              :                                      const std::string name, const std::string& vTypes,
      87              :                                      const std::string& nextEdges,
      88              :                                      int detectPersons, bool showDetector) {
      89           14 :     return new GUIE2Collector(id, usage, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, name, vTypes, nextEdges, detectPersons, showDetector);
      90              : }
      91              : 
      92              : MSDetectorFileOutput*
      93          167 : GUIDetectorBuilder::createE3Detector(const std::string& id,
      94              :                                      const CrossSectionVector& entries,
      95              :                                      const CrossSectionVector& exits,
      96              :                                      double haltingSpeedThreshold,
      97              :                                      SUMOTime haltingTimeThreshold,
      98              :                                      const std::string name, const std::string& vTypes,
      99              :                                      const std::string& nextEdges,
     100              :                                      int detectPersons, bool openEntry, bool expectArrival) {
     101          501 :     return new GUIE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, name, vTypes, nextEdges, detectPersons, openEntry, expectArrival);
     102              : }
     103              : 
     104              : 
     105              : /****************************************************************************/
        

Generated by: LCOV version 2.0-1