libosmscout 1.1.1
Loading...
Searching...
No Matches
TurnRestriction.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_TURNRESTRICTION_H
2#define OSMSCOUT_TURNRESTRICTION_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2009 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
26
29
31
32namespace osmscout {
33
34 class OSMSCOUT_API TurnRestriction CLASS_FINAL
35 {
36 public:
37 enum Type
38 {
39 Allow = 0,
41 };
42
43 private:
44 Type type;
45 OSMId from; // Way id
46 OSMId via; // Node id
47 OSMId to; // Way id
48
49 public:
50 TurnRestriction() = default;
51
53 OSMId from,
54 OSMId via,
55 OSMId to)
56 : type(type),
57 from(from),
58 via(via),
59 to(to)
60 {
61 // no code
62 }
63
64 inline Type GetType() const
65 {
66 return type;
67 }
68
69 void inline SetFrom(Id from)
70 {
71 this->from=from;
72 }
73
74 inline OSMId GetFrom() const
75 {
76 return from;
77 }
78
79 inline OSMId GetVia() const
80 {
81 return via;
82 }
83
84 inline OSMId GetTo() const
85 {
86 return to;
87 }
88
89 void inline SetTo(OSMId to)
90 {
91 this->to=to;
92 }
93
94 void Read(FileScanner& scanner);
95 void Write(FileWriter& writer) const;
96 };
97
98 using TurnRestrictionRef = std::shared_ptr<TurnRestriction>;
99}
100
101#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
Definition Area.h:88
void Read(FileScanner &scanner)
OSMId GetVia() const
Definition TurnRestriction.h:79
OSMId GetFrom() const
Definition TurnRestriction.h:74
OSMId GetTo() const
Definition TurnRestriction.h:84
Type
Definition GroundTile.h:48
@ Allow
Definition TurnRestriction.h:39
@ Forbit
Definition TurnRestriction.h:40
const GeoCoord from
Definition RouteStateAgent.h:37
const GeoCoord to
Definition RouteStateAgent.h:39
TurnRestriction(Type type, OSMId from, OSMId via, OSMId to)
Definition TurnRestriction.h:52
Type GetType() const
Definition TurnRestriction.h:64
Type type
The type of the cell.
Definition GroundTile.h:92
void SetFrom(Id from)
Definition TurnRestriction.h:69
void SetTo(OSMId to)
Definition TurnRestriction.h:89
void Write(FileWriter &writer) const
uint64_t Id
Definition OSMScoutTypes.h:40
int64_t OSMId
Definition OSMScoutTypes.h:33
Definition Area.h:39
std::shared_ptr< TurnRestriction > TurnRestrictionRef
Definition TurnRestriction.h:98