libosmscout 1.1.1
Loading...
Searching...
No Matches
PublicTransport.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_PUBLIC_TRANSPORT_H
2#define OSMSCOUT_PUBLIC_TRANSPORT_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2020 Tim Teulings
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <memory>
24#include <string>
25
27
28#include <osmscout/TypeConfig.h>
29
31
32#include <osmscout/util/Color.h>
33
36
37namespace osmscout {
38
44 class OSMSCOUT_API PTRoute CLASS_FINAL
45 {
46 public:
50 enum class StopType : uint8_t
51 {
52 normal = 0,
53 entryOnly = 1,
54 exitOnly = 2
55 };
56
60 enum class PlatformType : uint8_t
61 {
62 normal = 0,
63 entryOnly = 1,
64 exitOnly = 2
65 };
66
70 class OSMSCOUT_API Stop CLASS_FINAL
71 {
72 private:
73 StopType type;
74 ObjectFileRef stop;
75
76 public:
77 inline StopType GetType() const
78 {
79 return type;
80 }
81
82 inline const ObjectFileRef& GetStop() const
83 {
84 return stop;
85 }
86
87 void SetType(StopType stopType);
88 void SetStop(const ObjectFileRef& stop);
89
90 friend PTRoute;
91 };
92
96 class OSMSCOUT_API Platform CLASS_FINAL
97 {
98 private:
100 ObjectFileRef platform;
101
102 public:
103 inline PlatformType GetType() const
104 {
105 return type;
106 }
107
108 inline const ObjectFileRef& GetPlatform() const
109 {
110 return platform;
111 }
112
113 void SetType(PlatformType platformType);
114 void SetPlatform(const ObjectFileRef& platform);
115
116 friend PTRoute;
117 };
118
119
126 class OSMSCOUT_API Variant CLASS_FINAL
127 {
128 private:
129 std::string name;
130 std::string ref;
131 std::string operatorName;
132 std::string network;
133 std::string from;
134 std::string to;
135 Color color;
136
137 public:
138 std::vector<Stop> stops;
139 std::vector<Platform> platforms;
140
141 public:
142 inline std::string GetName() const
143 {
144 return name;
145 }
146
147 inline std::string GetRef() const
148 {
149 return ref;
150 }
151
152 inline std::string GetOperator() const
153 {
154 return operatorName;
155 }
156
157 inline std::string GetNetwork() const
158 {
159 return network;
160 }
161
162 inline std::string GetFrom() const
163 {
164 return from;
165 }
166
167 inline std::string GetTo() const
168 {
169 return to;
170 }
171
172 inline Color GetColor() const
173 {
174 return color;
175 }
176
177 void SetName(const std::string& name);
178 void SetRef(const std::string& ref);
179 void SetOperator(const std::string& operatorName);
180 void SetNetwork(const std::string& network);
181 void SetFrom(const std::string& from);
182 void SetTo(const std::string& to);
183 void SetColor(const Color& color);
184
185 friend PTRoute;
186 };
187
188 private:
190 FileOffset fileOffset;
191 FileOffset nextFileOffset;
192 std::string name;
193 std::string ref;
194 std::string operatorName;
195 std::string network;
196 Color color;
197
198 public:
199 std::vector<Variant> variants;
200
201 public:
202 inline PTRoute() = default;
203
204 inline TypeInfoRef GetType() const {
205 return type;
206 }
207
209 {
210 return fileOffset;
211 }
212
214 {
215 return nextFileOffset;
216 }
217
218 inline std::string GetName() const
219 {
220 return name;
221 }
222
223 inline std::string GetRef() const
224 {
225 return ref;
226 }
227
228 inline std::string GetOperator() const
229 {
230 return operatorName;
231 }
232
233 inline std::string GetNetwork() const
234 {
235 return network;
236 }
237
238 inline Color GetColor() const
239 {
240 return color;
241 }
242
244 void SetName(const std::string& name);
245 void SetRef(const std::string& ref);
246 void SetOperator(const std::string& operatorName);
247 void SetNetwork(const std::string& network);
248 void SetColor(const Color& color);
249
250 void Read(const TypeConfig& typeConfig,
251 FileScanner& scanner);
252
253 void Write(const TypeConfig& typeConfig,
254 FileWriter& writer) const;
255 };
256
257 using PTRouteRef = std::shared_ptr<PTRoute>;
258}
259
260#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
Definition Area.h:88
TypeInfoRef GetType() const
Definition PublicTransport.h:204
Color GetColor() const
Definition PublicTransport.h:238
void SetNetwork(const std::string &network)
std::string GetName() const
Definition PublicTransport.h:218
std::string GetRef() const
Definition PublicTransport.h:223
StopType
Definition PublicTransport.h:51
const GeoCoord from
Definition RouteStateAgent.h:37
void Write(const TypeConfig &typeConfig, FileWriter &writer) const
void SetColor(const Color &color)
FileOffset GetFileOffset() const
Definition PublicTransport.h:208
const GeoCoord to
Definition RouteStateAgent.h:39
void SetRef(const std::string &ref)
FileOffset GetNextFileOffset() const
Definition PublicTransport.h:213
std::string GetOperator() const
Definition PublicTransport.h:228
PlatformType
Definition PublicTransport.h:61
void SetName(const std::string &name)
Type type
The type of the cell.
Definition GroundTile.h:92
std::string GetNetwork() const
Definition PublicTransport.h:233
void SetOperator(const std::string &operatorName)
void SetType(const TypeInfoRef &type)
std::vector< Variant > variants
Definition PublicTransport.h:199
void Read(const TypeConfig &typeConfig, FileScanner &scanner)
@ normal
Definition Styles.h:510
uint64_t FileOffset
Definition OSMScoutTypes.h:46
Definition Area.h:39
std::shared_ptr< PTRoute > PTRouteRef
Definition PublicTransport.h:257
std::shared_ptr< TypeInfo > TypeInfoRef
Definition TypeConfig.h:61
Definition LaneAgent.h:61
std::vector< Stop > stops
Definition PublicTransport.h:138
const ObjectFileRef & GetStop() const
Definition PublicTransport.h:82
std::string GetRef() const
Definition PublicTransport.h:147
Color GetColor() const
Definition PublicTransport.h:172
StopType GetType() const
Definition PublicTransport.h:77
void SetName(const std::string &name)
std::string GetOperator() const
Definition PublicTransport.h:152
void SetRef(const std::string &ref)
void SetStop(const ObjectFileRef &stop)
void SetType(StopType stopType)
std::string GetNetwork() const
Definition PublicTransport.h:157
void SetOperator(const std::string &operatorName)
const ObjectFileRef & GetPlatform() const
Definition PublicTransport.h:108
void SetPlatform(const ObjectFileRef &platform)
void SetTo(const std::string &to)
void SetNetwork(const std::string &network)
void SetFrom(const std::string &from)
std::string GetName() const
Definition PublicTransport.h:142
void SetType(PlatformType platformType)
std::vector< Platform > platforms
Definition PublicTransport.h:139
std::string GetFrom() const
Definition PublicTransport.h:162
std::string GetTo() const
Definition PublicTransport.h:167
friend PTRoute
Definition PublicTransport.h:90
void SetColor(const Color &color)
PlatformType GetType() const
Definition PublicTransport.h:103