LCOV - code coverage report
Current view: top level - src/netbuild - NBPTStop.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 13 14 92.9 %
Date: 2024-05-07 15:28:01 Functions: 1 2 50.0 %

          Line data    Source code
       1             : /****************************************************************************/
       2             : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3             : // Copyright (C) 2001-2024 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    NBPTStop.h
      15             : /// @author  Gregor Laemmel
      16             : /// @date    Tue, 20 Mar 2017
      17             : ///
      18             : // The representation of a single pt stop
      19             : /****************************************************************************/
      20             : #pragma once
      21             : #include <config.h>
      22             : 
      23             : #include <memory>
      24             : #include <string>
      25             : #include <utils/common/Parameterised.h>
      26             : #include <utils/geom/Position.h>
      27             : #include "NBPTPlatform.h"
      28             : 
      29             : 
      30             : // ===========================================================================
      31             : // class declarations
      32             : // ===========================================================================
      33             : class OutputDevice;
      34             : class NBEdgeCont;
      35             : class NBEdge;
      36             : 
      37             : 
      38             : // ===========================================================================
      39             : // class definitions
      40             : // ===========================================================================
      41             : /**
      42             : * @class NBPTStop
      43             : * @brief The representation of a single pt stop
      44             : */
      45             : class NBPTStop : public Parameterised {
      46             : 
      47             : public:
      48             :     /**@brief Constructor
      49             :     * @param[in] id The id of the pt stop
      50             :     * @param[in] position The position of the pt stop
      51             :     * @param[in] edgeId The edge id of the pt stop
      52             :     * @param[in] length The length of the pt stop
      53             :     * @param[in] color ptStop color
      54             :     * @param[in] givenStartPos Loaded startPos (and implicit endPos) that should not be adapted
      55             :     */
      56             :     NBPTStop(std::string ptStopId, Position position, std::string edgeId, std::string origEdgeId, double length, std::string name,
      57             :              SVCPermissions svcPermissions, double parkingLength = 0, const RGBColor color = RGBColor(false), double  givenStartPos = -1);
      58             : 
      59             :     /// @brief Destructor
      60        8295 :     virtual ~NBPTStop() {};
      61             : 
      62             :     std::string getID() const;
      63             : 
      64             :     const std::string& getEdgeId() const;
      65             : 
      66             :     const std::string& getLaneId() const {
      67         147 :         return myLaneId;
      68             :     }
      69             : 
      70             :     const std::string getOrigEdgeId() const;
      71             : 
      72             :     const std::string getName() const;
      73             : 
      74             :     const Position& getPosition() const;
      75             : 
      76             :     SVCPermissions getPermissions() const;
      77             : 
      78             :     long long int getAreaID() const {
      79           0 :         return myAreaID;
      80             :     }
      81             : 
      82             :     void write(OutputDevice& device);
      83             : 
      84             :     void reshiftPosition(const double offsetX, const double offsetY);
      85             : 
      86             :     const std::vector<NBPTPlatform>& getPlatformCands();
      87             : 
      88             :     bool getIsMultipleStopPositions() const;
      89             : 
      90             :     void setIsMultipleStopPositions(bool multipleStopPositions, long long int areaID);
      91             : 
      92             :     double getLength() const;
      93             : 
      94             :     bool setEdgeId(std::string edgeId, const NBEdgeCont& ec);
      95             : 
      96             :     void registerAdditionalEdge(std::string wayId, std::string edgeId);
      97             : 
      98             :     void addPlatformCand(NBPTPlatform platform);
      99             : 
     100             :     bool findLaneAndComputeBusStopExtent(const NBEdgeCont& ec);
     101             : 
     102             :     bool findLaneAndComputeBusStopExtent(const NBEdge* edge);
     103             : 
     104             :     void setPTStopId(std::string id) {
     105         286 :         myPTStopId = id;
     106         286 :     }
     107             : 
     108             :     void setIsPlatform() {
     109          73 :         myIsPlatform = true;
     110          73 :     }
     111             : 
     112             :     bool isPlatform() const {
     113         118 :         return myIsPlatform;
     114             :     }
     115             :     void addAccess(std::string laneID, double offset, double length);
     116             : 
     117             :     /// @brief remove all access definitions
     118             :     void clearAccess();
     119             : 
     120             :     /// @brief register line that services this stop (for displaying)
     121             :     void addLine(const std::string& line);
     122             : 
     123             :     void setBidiStop(std::shared_ptr<NBPTStop> bidiStop) {
     124             :         myBidiStop = bidiStop;
     125             :     }
     126             : 
     127             :     std::shared_ptr<NBPTStop> getBidiStop() const {
     128             :         return myBidiStop.lock();
     129             :     }
     130             : 
     131             :     bool isLoose() const {
     132        3957 :         return myIsLoose;
     133             :     }
     134             : 
     135             :     double getEndPos() const {
     136          34 :         return myEndPos;
     137             :     }
     138             : 
     139             :     const std::vector<std::string>& getLines() const {
     140             :         return myLines;
     141             :     }
     142             : 
     143             :     /// @brief mirror coordinates along the x-axis
     144             :     void mirrorX();
     145             : 
     146             :     /// @brief replace the stop edge with the closest edge on the given edge list in all stops
     147             :     bool replaceEdge(const std::string& edgeID, const std::vector<NBEdge*>& replacement);
     148             : 
     149             :     const std::map<std::string, std::string>& getAdditionalEdgeCandidates() const {
     150             :         return myAdditionalEdgeCandidates;
     151             :     }
     152             :     void setOrigEdgeId(const std::string& origEdgeId) {
     153         107 :         myOrigEdgeId = origEdgeId;
     154         107 :     }
     155             :     void setPTStopLength(double ptStopLength) {
     156         411 :         myPTStopLength = ptStopLength;
     157          31 :     }
     158             : 
     159             : private:
     160             :     std::string myPTStopId;
     161             :     Position myPosition;
     162             :     std::string myEdgeId;
     163             :     std::map<std::string, std::string> myAdditionalEdgeCandidates;
     164             :     std::string myOrigEdgeId;
     165             :     double myPTStopLength;
     166             :     const std::string myName;
     167             :     const double myParkingLength;
     168             :     const RGBColor myColor;
     169             :     std::string myLaneId;
     170             :     const SVCPermissions myPermissions;
     171             : 
     172             :     double myStartPos;
     173             :     double myEndPos;
     174             : 
     175             :     /// @brief laneId, lanePos, accessLength
     176             :     std::vector<std::tuple<std::string, double, double>> myAccesses;
     177             : 
     178             :     /// @brief list of public transport lines (for displaying)
     179             :     std::vector<std::string> myLines;
     180             : 
     181             :     std::weak_ptr<NBPTStop> myBidiStop;
     182             : 
     183             :     /// @brief whether the stop was not part of the road network and must be mapped
     184             :     bool myIsLoose;
     185             : 
     186             :     /// @brief whether this stop was build from a platform position
     187             :     bool myIsPlatform;
     188             : 
     189             :     std::vector<NBPTPlatform> myPlatformCands;
     190             :     bool myIsMultipleStopPositions;
     191             :     long long int myAreaID;
     192             :     double myGivenStartPos;
     193             : 
     194             : private:
     195             :     /// @brief Invalidated assignment operator.
     196             :     NBPTStop& operator=(const NBPTStop&);
     197             : 
     198             : };

Generated by: LCOV version 1.14