1 /****************************************************************************/ 2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo 3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others. 4 // This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v2.0 6 // which accompanies this distribution, and is available at 7 // http://www.eclipse.org/legal/epl-v20.html 8 // SPDX-License-Identifier: EPL-2.0 9 /****************************************************************************/ 10 /// @file NBPTStop.h 11 /// @author Gregor Laemmel 12 /// @date Tue, 20 Mar 2017 13 /// @version $Id$ 14 /// 15 // The representation of a single pt stop 16 /****************************************************************************/ 17 #ifndef SUMO_NBPTSTOP_H 18 #define SUMO_NBPTSTOP_H 19 20 // =========================================================================== 21 // included modules 22 // =========================================================================== 23 #include <config.h> 24 25 #include <string> 26 #include <utils/geom/Position.h> 27 #include "utils/common/SUMOVehicleClass.h" 28 #include "NBPTPlatform.h" 29 30 31 // =========================================================================== 32 // class declarations 33 // =========================================================================== 34 class OutputDevice; 35 class NBEdgeCont; 36 37 38 // =========================================================================== 39 // class definitions 40 // =========================================================================== 41 /** 42 * @class NBPTStop 43 * @brief The representation of a single pt stop 44 */ 45 class NBPTStop { 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 */ 54 NBPTStop(std::string ptStopId, Position position, std::string edgeId, std::string origEdgeId, double length, std::string name, SVCPermissions svcPermissions); 55 std::string getID() const; 56 57 const std::string getEdgeId() const; 58 const std::string getOrigEdgeId() const; 59 const std::string getName() const; 60 const Position& getPosition() const; 61 SVCPermissions getPermissions() const; 62 void write(OutputDevice& device); 63 void reshiftPosition(const double offsetX, const double offsetY); 64 65 const std::vector<NBPTPlatform>& getPlatformCands(); 66 bool getIsMultipleStopPositions() const; 67 void setIsMultipleStopPositions(bool multipleStopPositions); 68 double getLength() const; 69 bool setEdgeId(std::string edgeId, NBEdgeCont& ec); 70 void registerAdditionalEdge(std::string wayId, std::string edgeId); 71 void addPlatformCand(NBPTPlatform platform); 72 bool findLaneAndComputeBusStopExtent(NBEdgeCont& ec); 73 74 void setMyPTStopId(std::string id); 75 void addAccess(std::string laneID, double offset, double length); 76 77 /// @brief remove all access definitions 78 void clearAccess(); 79 80 /// @brief register line that services this stop (for displaying) 81 void addLine(const std::string& line); 82 setBidiStop(NBPTStop * bidiStop)83 void setBidiStop(NBPTStop* bidiStop) { 84 myBidiStop = bidiStop; 85 } 86 getBidiStop()87 NBPTStop* getBidiStop() const { 88 return myBidiStop; 89 } 90 91 private: 92 void computeExtent(double center, double d); 93 94 private: 95 std::string myPTStopId; 96 Position myPosition; 97 std::string myEdgeId; 98 std::map<std::string, std::string> myAdditionalEdgeCandidates; 99 public: 100 const std::map<std::string, std::string>& getMyAdditionalEdgeCandidates() const; 101 private: 102 std::string myOrigEdgeId; 103 public: 104 void setMyOrigEdgeId(const std::string& myOrigEdgeId); 105 private: 106 double myPTStopLength; 107 public: 108 void setMyPTStopLength(double myPTStopLength); 109 private: 110 const std::string myName; 111 std::string myLaneId; 112 const SVCPermissions myPermissions; 113 114 double myStartPos; 115 double myEndPos; 116 117 /// @brief laneId, lanePos, accessLength 118 std::vector<std::tuple<std::string, double, double>> myAccesses; 119 120 /// @brief list of public transport lines (for displaying) 121 std::vector<std::string> myLines; 122 123 NBPTStop* myBidiStop; 124 125 126 private: 127 /// @brief Invalidated assignment operator. 128 NBPTStop& operator=(const NBPTStop&); 129 130 131 std::vector<NBPTPlatform> myPlatformCands; 132 bool myIsMultipleStopPositions; 133 }; 134 135 #endif //SUMO_NBPTSTOP_H 136