libosmscout  1.1.1
RawCoastline.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_IMPORT_RAWCOASTLINE_H
2 #define OSMSCOUT_IMPORT_RAWCOASTLINE_H
3 
4 /*
5  This source is part of the libosmscout library
6  Copyright (C) 2012 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/Tag.h>
26 
29 
31 
32 namespace osmscout {
33 
34  class RawCoastline CLASS_FINAL
35  {
36  private:
37  // Attribute availability flags (for optimized attribute storage)
38 
39  static const uint8_t isArea = 1 << 0;
40 
41  private:
42  OSMId id{};
43  mutable uint8_t flags=0;
44  std::vector<OSMId> nodes;
45 
46  public:
47 
48  public:
49  RawCoastline() = default;
50 
51  inline OSMId GetId() const
52  {
53  return id;
54  }
55 
56  inline bool IsArea() const
57  {
58  return (flags & isArea)!=0;
59  }
60 
61  inline const std::vector<OSMId>& GetNodes() const
62  {
63  return nodes;
64  }
65 
66  inline size_t GetNodeCount() const
67  {
68  return nodes.size();
69  }
70 
71  inline OSMId GetNodeId(size_t idx) const
72  {
73  return nodes[idx];
74  }
75 
76  void SetId(OSMId id);
77  void SetType(bool area);
78  void SetNodes(const std::vector<OSMId>& nodes);
79 
80  void Read(FileScanner& scanner);
81  void Write(FileWriter& writer) const;
82  };
83 
84  using RawCoastlineRef = std::shared_ptr<RawCoastline>;
85 }
86 
87 #endif
int64_t OSMId
Definition: OSMScoutTypes.h:34
const std::vector< OSMId > & GetNodes() const
Definition: RawCoastline.h:61
Definition: Area.h:38
#define CLASS_FINAL
Definition: Compiler.h:26
size_t GetNodeCount() const
Definition: RawCoastline.h:66
OSMId GetId() const
Definition: RawCoastline.h:51
std::shared_ptr< RawCoastline > RawCoastlineRef
Definition: RawCoastline.h:84
OSMId GetNodeId(size_t idx) const
Definition: RawCoastline.h:71
bool IsArea() const
Definition: RawCoastline.h:56