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    NBPTLine.h
11 /// @author  Gregor Laemmel
12 /// @author  Nikita Cherednychek
13 /// @date    Tue, 20 Mar 2017
14 /// @version $Id$
15 ///
16 // The representation of one direction of a single pt line
17 /****************************************************************************/
18 #ifndef SUMO_NBPTLINE_H
19 #define SUMO_NBPTLINE_H
20 
21 
22 #include <string>
23 #include <vector>
24 #include <map>
25 #include "NBEdge.h" // Cherednychek
26 
27 // ===========================================================================
28 // class declarations
29 // ===========================================================================
30 class OutputDevice;
31 class NBPTStop;
32 class NBEdgeCont;
33 
34 class NBPTLine {
35 
36 public:
37     explicit NBPTLine(const std::string& id, const std::string& name,
38                       const std::string& type, const std::string& ref, int interval, const std::string& nightService);
39 
40     void addPTStop(NBPTStop* pStop);
41 
getLineID()42     const std::string& getLineID() const {
43         return myPTLineId;
44     }
45 
getName()46     const std::string& getName() const {
47         return myName;
48     }
49 
getType()50     const std::string& getType() const {
51         return myType;
52     }
53 
54     std::vector<NBPTStop*> getStops();
55     void write(OutputDevice& device, NBEdgeCont& ec);
56     void addWayNode(long long int way, long long int node);
57 
58     void setMyNumOfStops(int numStops);
59 
60     /// @brief get line reference (not unique)
getRef()61     const std::string& getRef() const {
62         return myRef;
63     }
64 
replaceStops(std::vector<NBPTStop * > stops)65     void replaceStops(std::vector<NBPTStop*> stops) {
66         myPTStops = stops;
67     }
68 
69 private:
70     std::string myName;
71     std::string myType;
72     std::vector<NBPTStop*> myPTStops;
73 
74 private:
75     std::map<std::string, std::vector<long long int> > myWaysNodes;
76     std::vector<std::string> myWays;
77 public:
78     const std::vector<std::string>& getMyWays() const;
79     std::vector<long long int>* getWaysNodes(std::string wayId);
80 private:
81 
82     std::string myCurrentWay;
83     std::string myPTLineId;
84     std::string myRef;
85     int myInterval;
86     std::string myNightService;
87 
88 public:
89     void addEdgeVector(std::vector<NBEdge*>::iterator fr, std::vector<NBEdge*>::iterator to);
90 private:
91     // route of ptline
92     std::vector<NBEdge*> myRoute;
93 public:
94     const std::vector<NBEdge*>& getRoute() const;
95 private:
96 
97     int myNumOfStops;
98 };
99 
100 
101 #endif //SUMO_NBPTLINE_H
102