libosmscout  1.1.1
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 
25 #include <osmscout/OSMScoutTypes.h>
26 
29 
31 
32 namespace osmscout {
33 
34  class OSMSCOUT_API TurnRestriction CLASS_FINAL
35  {
36  public:
37  enum Type
38  {
39  Allow = 0,
40  Forbit = 1
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 
52  inline TurnRestriction(Type type,
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
uint64_t Id
Definition: OSMScoutTypes.h:41
OSMId GetTo() const
Definition: TurnRestriction.h:84
OSMId GetFrom() const
Definition: TurnRestriction.h:74
int64_t OSMId
Definition: OSMScoutTypes.h:34
Type GetType() const
Definition: TurnRestriction.h:64
Type
Definition: GroundTile.h:48
Definition: Area.h:38
#define CLASS_FINAL
Definition: Compiler.h:26
#define OSMSCOUT_API
Definition: CoreImportExport.h:45
void SetFrom(Id from)
Definition: TurnRestriction.h:69
void SetTo(OSMId to)
Definition: TurnRestriction.h:89
TurnRestriction(Type type, OSMId from, OSMId via, OSMId to)
Definition: TurnRestriction.h:52
std::shared_ptr< TurnRestriction > TurnRestrictionRef
Definition: TurnRestriction.h:98
OSMId GetVia() const
Definition: TurnRestriction.h:79