LCOV - code coverage report
Current view: top level - src/microsim/transportables - MSStageTrip.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 87.5 % 16 14
Test Date: 2024-12-21 15:45:41 Functions: 85.7 % 7 6

            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    MSStageTrip.h
      15              : /// @author  Michael Behrisch
      16              : /// @author  Jakob Erdmann
      17              : /// @date    Wed, 1 Jun 2022
      18              : ///
      19              : // An intermodal routing request (to be transformed into a sequence of walks and rides)
      20              : /****************************************************************************/
      21              : #pragma once
      22              : #include <config.h>
      23              : 
      24              : #include <microsim/transportables/MSStage.h>
      25              : 
      26              : 
      27              : // ===========================================================================
      28              : // class declarations
      29              : // ===========================================================================
      30              : class MSTransportable;
      31              : class MSEdge;
      32              : class MSLane;
      33              : class MSNet;
      34              : class MSStoppingPlace;
      35              : class OutputDevice;
      36              : 
      37              : /**
      38              : * A "placeholder" stage storing routing info which will result in real stages when routed
      39              : */
      40              : class MSStageTrip : public MSStage {
      41              : public:
      42              :     /// constructor
      43              :     MSStageTrip(const MSEdge* origin, MSStoppingPlace* fromStop,
      44              :                 const MSEdge* destination, MSStoppingPlace* toStop,
      45              :                 const SUMOTime duration, const SVCPermissions modeSet,
      46              :                 const std::string& vTypes, const double speed, const double walkFactor,
      47              :                 const std::string& group,
      48              :                 const double departPosLat, const bool hasArrivalPos, const double arrivalPos);
      49              : 
      50              :     /// destructor
      51              :     virtual ~MSStageTrip();
      52              : 
      53              :     MSStage* clone() const;
      54              : 
      55              :     const MSEdge* getEdge() const;
      56              : 
      57       411531 :     MSStoppingPlace* getOriginStop() const {
      58       411531 :         return myOriginStop;
      59              :     }
      60              : 
      61              :     double getEdgePos(SUMOTime now) const;
      62              : 
      63              :     Position getPosition(SUMOTime now) const;
      64              : 
      65              :     double getAngle(SUMOTime now) const;
      66              : 
      67           53 :     double getDistance() const {
      68              :         // invalid
      69           53 :         return -1;
      70              :     }
      71              : 
      72           53 :     std::string getStageDescription(const bool isPerson) const {
      73              :         UNUSED_PARAMETER(isPerson);
      74           53 :         return "trip";
      75              :     }
      76              : 
      77              :     std::string getOriginDescription() const;
      78              :     std::string getDestinationDescription() const;
      79              : 
      80              :     std::string getStageSummary(const bool isPerson) const;
      81              : 
      82              :     std::vector<SUMOVehicle*> getVehicles(MSVehicleControl& vehControl, MSTransportable* transportable, const MSEdge* origin);
      83              : 
      84              :     const std::string reroute(const SUMOTime time, MSTransportableRouter& router, MSTransportable* const transportable,
      85              :                               MSStage* previous, const MSEdge* origin, const MSEdge* destination, std::vector<MSStage*>& stages);
      86              : 
      87              :     /// logs end of the step
      88              :     const std::string setArrived(MSNet* net, MSTransportable* transportable, SUMOTime now, const bool vehicleArrived);
      89              : 
      90              :     /// change origin for parking area rerouting
      91              :     void setOrigin(const MSEdge* origin) {
      92           35 :         myOrigin = origin;
      93           35 :     }
      94              : 
      95              :     /// proceeds to the next step
      96              :     void proceed(MSNet* net, MSTransportable* transportable, SUMOTime now, MSStage* previous);
      97              : 
      98              :     /** @brief Called on writing tripinfo output
      99              :     *
     100              :     * @param[in] os The stream to write the information into
     101              :     * @exception IOError not yet implemented
     102              :     */
     103         9978 :     void tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const {
     104              :         UNUSED_PARAMETER(os);
     105              :         UNUSED_PARAMETER(transportable);
     106         9978 :     }
     107              : 
     108              :     /// @brief trip doesn't participate in plan summary
     109         9978 :     SUMOTime getDuration() const {
     110         9978 :         return 0;
     111              :     }
     112              : 
     113         9978 :     SUMOTime getTravelTime() const {
     114         9978 :         return 0;
     115              :     }
     116              : 
     117              :     /** @brief Called on writing vehroute output
     118              :     *
     119              :     * @param[in] os The stream to write the information into
     120              :     * @exception IOError not yet implemented
     121              :     */
     122              :     void routeOutput(const bool isPerson, OutputDevice& os, const bool withRouteLength, const MSStage* const previous) const;
     123              : 
     124              :     /// @brief Whether the transportable is walking
     125            0 :     bool isWalk() const {
     126            0 :         return myModeSet == 0;
     127              :     }
     128              : 
     129              : private:
     130              :     /// the origin edge
     131              :     const MSEdge* myOrigin;
     132              : 
     133              :     /// the origin edge
     134              :     MSStoppingPlace* myOriginStop;
     135              : 
     136              :     /// the time the trip should take (applies to only walking)
     137              :     SUMOTime myDuration;
     138              : 
     139              :     /// @brief The allowed modes of transportation
     140              :     const SVCPermissions myModeSet;
     141              : 
     142              :     /// @brief The possible vehicles to use
     143              :     const std::string myVTypes;
     144              : 
     145              :     /// @brief The walking speed
     146              :     const double mySpeed;
     147              : 
     148              :     /// @brief The factor to apply to walking durations
     149              :     const double myWalkFactor;
     150              : 
     151              :     /// @brief The depart position
     152              :     double myDepartPos;
     153              : 
     154              :     /// @brief The lateral depart position
     155              :     const double myDepartPosLat;
     156              : 
     157              :     /// @brief whether an arrivalPos was in the input
     158              :     const bool myHaveArrivalPos;
     159              : 
     160              : private:
     161              :     /// @brief Invalidated copy constructor.
     162              :     MSStageTrip(const MSStageTrip&);
     163              : 
     164              :     /// @brief Invalidated assignment operator.
     165              :     MSStageTrip& operator=(const MSStageTrip&);
     166              : 
     167              : };
        

Generated by: LCOV version 2.0-1