libosmscout 1.1.1
Loading...
Searching...
No Matches
RawRelation.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_IMPORT_RAWRELATION_H
2#define OSMSCOUT_IMPORT_RAWRELATION_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
35
36namespace osmscout {
37
38 class RawRelation CLASS_FINAL
39 {
40 public:
46
47 struct Member
48 {
51 std::string role;
52
54 };
55
56 private:
57 OSMId id=0;
58 FeatureValueBuffer featureValueBuffer;
59
60 public:
61 std::vector<Member> members;
62
63 public:
64 RawRelation() = default;
65
66 inline OSMId GetId() const
67 {
68 return id;
69 }
70
71 inline TypeInfoRef GetType() const
72 {
73 return featureValueBuffer.GetType();
74 }
75
76 inline size_t GetFeatureCount() const
77 {
78 return featureValueBuffer.GetType()->GetFeatureCount();
79 }
80
81 inline bool HasFeature(size_t idx) const
82 {
83 return featureValueBuffer.HasFeature(idx);
84 }
85
86 inline const FeatureInstance& GetFeature(size_t idx) const
87 {
88 return featureValueBuffer.GetType()->GetFeature(idx);
89 }
90
91 inline FeatureValue* GetFeatureValue(size_t idx) const
92 {
93 return featureValueBuffer.GetValue(idx);
94 }
95
97 {
98 return featureValueBuffer;
99 }
100
101 void SetId(OSMId id);
103
104 void Parse(TagErrorReporter& errorReporter,
105 const TagRegistry& tagRegistry,
106 const TagMap& tags);
107 void Read(const TypeConfig& typeConfig,
108 FileScanner& scanner);
109 void Write(const TypeConfig& typeConfig,
110 FileWriter& writer) const;
111 };
112
113 using RawRelationRef = std::shared_ptr<RawRelation>;
114}
115
116#endif
Definition Area.h:88
MemberType
Definition RawRelation.h:41
@ memberRelation
Definition RawRelation.h:44
@ memberWay
Definition RawRelation.h:43
@ memberNode
Definition RawRelation.h:42
TypeInfoRef GetType() const
Definition RawRelation.h:71
OSMId GetId() const
Definition RawRelation.h:66
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 RawRelation.h:81
FeatureValue * GetFeatureValue(size_t idx) const
Definition RawRelation.h:91
OSMId id
We are an area.
Definition ObjectRef.h:49
const FeatureValueBuffer & GetFeatureValueBuffer() const
Definition RawRelation.h:96
Type type
The type of the cell.
Definition GroundTile.h:92
void SetId(OSMId id)
void SetType(const TypeInfoRef &type)
FeatureValueBuffer()=default
const FeatureInstance & GetFeature(size_t idx) const
Definition RawRelation.h:86
void Read(const TypeConfig &typeConfig, FileScanner &scanner)
size_t GetFeatureCount() const
Definition RawRelation.h:76
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< RawRelation > RawRelationRef
Definition RawRelation.h:113
std::shared_ptr< TypeInfo > TypeInfoRef
Definition TypeConfig.h:61
Definition RawRelation.h:48
MemberType type
Definition RawRelation.h:49
OSMId id
Definition RawRelation.h:50
std::string role
Definition RawRelation.h:51
ObjectOSMRef GetObjectOSMRef() const