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 468262 : MSStoppingPlace* getOriginStop() const { 58 468262 : 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 74 : double getDistance() const { 68 : // invalid 69 74 : return -1; 70 : } 71 : 72 74 : std::string getStageDescription(const bool isPerson) const { 73 : UNUSED_PARAMETER(isPerson); 74 74 : 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 : /// logs end of the step 83 : const std::string setArrived(MSNet* net, MSTransportable* transportable, SUMOTime now, const bool vehicleArrived); 84 : 85 : /// change origin for parking area rerouting 86 : void setOrigin(const MSEdge* origin) { 87 31 : myOrigin = origin; 88 31 : } 89 : 90 : /// proceeds to the next step 91 : void proceed(MSNet* net, MSTransportable* transportable, SUMOTime now, MSStage* previous); 92 : 93 : /** @brief Called on writing tripinfo output 94 : * 95 : * @param[in] os The stream to write the information into 96 : * @exception IOError not yet implemented 97 : */ 98 10690 : void tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const { 99 : UNUSED_PARAMETER(os); 100 : UNUSED_PARAMETER(transportable); 101 10690 : } 102 : 103 : /// @brief trip doesn't participate in plan summary 104 : SUMOTime getTimeLoss() const { 105 : return 0; 106 : } 107 10690 : SUMOTime getDuration() const { 108 10690 : return 0; 109 : } 110 10690 : SUMOTime getTravelTime() const { 111 10690 : return 0; 112 : } 113 10690 : SUMOTime getWaitingTime() const { 114 10690 : 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 : };