LCOV - code coverage report
Current view: top level - src/microsim/transportables - MSStageTrip.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 89.5 % 19 17
Test Date: 2025-05-07 15:35:18 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-2025 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       416992 :     MSStoppingPlace* getOriginStop() const {
      58       416992 :         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           40 :     void setOrigin(const MSEdge* origin, MSStoppingPlace* originStop, double departPos) {
      92           40 :         myOrigin = origin;
      93           40 :         myOriginStop = originStop;
      94           40 :         myDepartPos = departPos;
      95           40 :     }
      96              : 
      97              :     /// proceeds to the next step
      98              :     void proceed(MSNet* net, MSTransportable* transportable, SUMOTime now, MSStage* previous);
      99              : 
     100              :     /** @brief Called on writing tripinfo output
     101              :     *
     102              :     * @param[in] os The stream to write the information into
     103              :     * @exception IOError not yet implemented
     104              :     */
     105         9996 :     void tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const {
     106              :         UNUSED_PARAMETER(os);
     107              :         UNUSED_PARAMETER(transportable);
     108         9996 :     }
     109              : 
     110              :     /// @brief trip doesn't participate in plan summary
     111         9996 :     SUMOTime getDuration() const {
     112         9996 :         return 0;
     113              :     }
     114              : 
     115         9996 :     SUMOTime getTravelTime() const {
     116         9996 :         return 0;
     117              :     }
     118              : 
     119              :     /** @brief Called on writing vehroute output
     120              :     *
     121              :     * @param[in] os The stream to write the information into
     122              :     * @exception IOError not yet implemented
     123              :     */
     124              :     void routeOutput(const bool isPerson, OutputDevice& os, const bool withRouteLength, const MSStage* const previous) const;
     125              : 
     126              :     /// @brief Whether the transportable is walking
     127            0 :     bool isWalk() const {
     128            0 :         return myModeSet == 0;
     129              :     }
     130              : 
     131              : private:
     132              :     /// the origin edge
     133              :     const MSEdge* myOrigin;
     134              : 
     135              :     /// the origin edge
     136              :     MSStoppingPlace* myOriginStop;
     137              : 
     138              :     /// the time the trip should take (applies to only walking)
     139              :     SUMOTime myDuration;
     140              : 
     141              :     /// @brief The allowed modes of transportation
     142              :     const SVCPermissions myModeSet;
     143              : 
     144              :     /// @brief The possible vehicles to use
     145              :     const std::string myVTypes;
     146              : 
     147              :     /// @brief The walking speed
     148              :     const double mySpeed;
     149              : 
     150              :     /// @brief The factor to apply to walking durations
     151              :     const double myWalkFactor;
     152              : 
     153              :     /// @brief The depart position
     154              :     double myDepartPos;
     155              : 
     156              :     /// @brief The lateral depart position
     157              :     const double myDepartPosLat;
     158              : 
     159              :     /// @brief whether an arrivalPos was in the input
     160              :     const bool myHaveArrivalPos;
     161              : 
     162              : private:
     163              :     /// @brief Invalidated copy constructor.
     164              :     MSStageTrip(const MSStageTrip&);
     165              : 
     166              :     /// @brief Invalidated assignment operator.
     167              :     MSStageTrip& operator=(const MSStageTrip&);
     168              : 
     169              : };
        

Generated by: LCOV version 2.0-1