libosmscout 1.1.1
Loading...
Searching...
No Matches
EleFeature.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_FEATURE_ELE_FEATURE_H
2#define OSMSCOUT_FEATURE_ELE_FEATURE_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2014 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 <osmscout/TypeConfig.h>
25
27
28namespace osmscout {
29
31 {
32 private:
33 int16_t ele=0;
34
35 public:
36 EleFeatureValue() = default;
37
38 explicit EleFeatureValue(int16_t ele)
39 : ele(ele)
40 {
41 // no code
42 }
43
44 void SetEle(int16_t ele)
45 {
46 this->ele=ele;
47 }
48
49 int16_t GetEle() const
50 {
51 return ele;
52 }
53
54 std::string GetLabel(const Locale &locale, size_t labelIndex) const override;
55
56 void Read(FileScanner& scanner) override;
57 void Write(FileWriter& writer) override;
58
59 EleFeatureValue& operator=(const FeatureValue& other) override;
60 bool operator==(const FeatureValue& other) const override;
61 };
62
64 {
65 private:
66 TagId tagEle=0;
67
68 public:
70 static const char* const NAME;
71
73 static const char* const IN_METER_LABEL;
74
76 static const size_t IN_METER_LABEL_INDEX;
77
79 static const char* const IN_FEET_LABEL;
80
82 static const size_t IN_FEET_LABEL_INDEX;
83
85 static const char* const IN_LOCALE_UNIT_LABEL;
86
88 static const size_t IN_LOCALE_UNIT_LABEL_INDEX;
89
90 public:
92 void Initialize(TagRegistry& tagRegistry) override;
93
94 std::string GetName() const override;
95
96 size_t GetValueAlignment() const override;
97 size_t GetValueSize() const override;
98 FeatureValue* AllocateValue(void* buffer) override;
99
100 void Parse(TagErrorReporter& reporter,
101 const TagRegistry& tagRegistry,
102 const FeatureInstance& feature,
103 const ObjectOSMRef& object,
104 const TagMap& tags,
105 FeatureValueBuffer& buffer) const override;
106 };
107
109
110}
111
112#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
static const char *const NAME
Definition EleFeature.h:70
static const size_t IN_METER_LABEL_INDEX
Definition EleFeature.h:76
static const size_t IN_LOCALE_UNIT_LABEL_INDEX
Definition EleFeature.h:88
void Parse(TagErrorReporter &reporter, const TagRegistry &tagRegistry, const FeatureInstance &feature, const ObjectOSMRef &object, const TagMap &tags, FeatureValueBuffer &buffer) const override
size_t GetValueSize() const override
static const char *const IN_FEET_LABEL
Definition EleFeature.h:79
static const char *const IN_METER_LABEL
Definition EleFeature.h:73
static const size_t IN_FEET_LABEL_INDEX
Definition EleFeature.h:82
std::string GetName() const override
FeatureValue * AllocateValue(void *buffer) override
static const char *const IN_LOCALE_UNIT_LABEL
Definition EleFeature.h:85
void Initialize(TagRegistry &tagRegistry) override
size_t GetValueAlignment() const override
void Read(FileScanner &scanner) override
std::string GetLabel(const Locale &locale, size_t labelIndex) const override
void Write(FileWriter &writer) override
EleFeatureValue & operator=(const FeatureValue &other) override
EleFeatureValue(int16_t ele)
Definition EleFeature.h:38
bool operator==(const FeatureValue &other) const override
void SetEle(int16_t ele)
Definition EleFeature.h:44
int16_t GetEle() const
Definition EleFeature.h:49
Definition TypeFeature.h:41
Definition FeatureReader.h:143
Definition TagErrorReporter.h:33
Definition Area.h:39
std::unordered_map< TagId, std::string > TagMap
Definition Tag.h:41
FeatureValueReader< EleFeature, EleFeatureValue > EleFeatureValueReader
Definition EleFeature.h:108
uint16_t TagId
Definition Tag.h:39