libosmscout 1.1.1
Loading...
Searching...
No Matches
RawWay.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_IMPORT_RAWWAY_H
2#define OSMSCOUT_IMPORT_RAWWAY_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#include <unordered_map>
25
26#include <osmscout/Tag.h>
27#include <osmscout/TypeConfig.h>
28
31
33
34namespace osmscout {
35
36 class RawWay CLASS_FINAL
37 {
38 private:
39 OSMId id=0;
40 bool isArea=false;
41 std::vector<OSMId> nodes;
42 FeatureValueBuffer featureValueBuffer;
43
44 public:
45 RawWay() = default;
46
47 inline OSMId GetId() const
48 {
49 return id;
50 }
51
52 inline bool IsArea() const
53 {
54 return isArea;
55 }
56
57 inline TypeInfoRef GetType() const
58 {
59 return featureValueBuffer.GetType();
60 }
61
62 inline const std::vector<OSMId>& GetNodes() const
63 {
64 return nodes;
65 }
66
67 inline size_t GetNodeCount() const
68 {
69 return nodes.size();
70 }
71
72 inline OSMId GetNodeId(size_t idx) const
73 {
74 return nodes[idx];
75 }
76
77 inline OSMId GetFirstNodeId() const
78 {
79 return nodes[0];
80 }
81
82 inline OSMId GetLastNodeId() const
83 {
84 return nodes[nodes.size()-1];
85 }
86
87 inline size_t GetFeatureCount() const
88 {
89 return featureValueBuffer.GetType()->GetFeatureCount();
90 }
91
92 inline bool HasFeature(size_t idx) const
93 {
94 return featureValueBuffer.HasFeature(idx);
95 }
96
97 inline const FeatureInstance& GetFeature(size_t idx) const
98 {
99 return featureValueBuffer.GetType()->GetFeature(idx);
100 }
101
102 inline FeatureValue* GetFeatureValue(size_t idx) const
103 {
104 return featureValueBuffer.GetValue(idx);
105 }
106
108 {
109 return featureValueBuffer;
110 }
111
113 {
114 featureValueBuffer.Set(other);
115 }
116
117 bool IsOneway() const;
118
119 void SetId(OSMId id);
121 bool area);
122 void SetNodes(const std::vector<OSMId>& nodes);
123
124 template<typename Iterator>
125 void SetNodes(Iterator first, Iterator end)
126 {
127 nodes.assign(first,end);
128 }
129
130 void Parse(TagErrorReporter& errorReporter,
131 const TagRegistry& tagRegistry,
132 const TagMap& tags);
133 void Read(const TypeConfig& typeConfig,
134 FileScanner& scanner);
135 void Write(const TypeConfig& typeConfig,
136 FileWriter& writer) const;
137 };
138
139 using RawWayRef = std::shared_ptr<RawWay>;
140}
141
142#endif
Definition Area.h:88
OSMId GetFirstNodeId() const
Definition RawWay.h:77
void SetNodes(const std::vector< OSMId > &nodes)
TypeInfoRef GetType() const
Definition RawWay.h:57
std::vector< Point > nodes
List of nodes.
Definition Way.h:57
size_t GetNodeCount() const
Definition RawWay.h:67
OSMId GetId() const
Definition RawWay.h:47
void SetNodes(Iterator first, Iterator end)
Definition RawWay.h:125
void Parse(TagErrorReporter &errorReporter, const TagRegistry &tagRegistry, const TagMap &tags)
void Write(const TypeConfig &typeConfig, FileWriter &writer) const
bool HasFeature(size_t idx) const
Definition RawWay.h:92
FeatureValue * GetFeatureValue(size_t idx) const
Definition RawWay.h:102
OSMId GetNodeId(size_t idx) const
Definition RawWay.h:72
OSMId id
We are an area.
Definition ObjectRef.h:49
bool IsArea() const
Definition RawWay.h:52
const std::vector< OSMId > & GetNodes() const
Definition RawWay.h:62
void SetType(const TypeInfoRef &type, bool area)
const FeatureValueBuffer & GetFeatureValueBuffer() const
Definition RawWay.h:107
Type type
The type of the cell.
Definition GroundTile.h:92
void SetFeatureValueBuffer(const FeatureValueBuffer &other)
Definition RawWay.h:112
void SetId(OSMId id)
bool IsOneway() const
FeatureValueBuffer()=default
const FeatureInstance & GetFeature(size_t idx) const
Definition RawWay.h:97
void Read(const TypeConfig &typeConfig, FileScanner &scanner)
size_t GetFeatureCount() const
Definition RawWay.h:87
OSMId GetLastNodeId() const
Definition RawWay.h:82
Definition TypeFeature.h:41
int64_t OSMId
Definition OSMScoutTypes.h:33
Definition Area.h:39
std::unordered_map< TagId, std::string > TagMap
Definition Tag.h:41
std::shared_ptr< RawWay > RawWayRef
Definition RawWay.h:139
std::shared_ptr< TypeInfo > TypeInfoRef
Definition TypeConfig.h:61