libosmscout 1.1.1
Loading...
Searching...
No Matches
SidewayFeature.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_FEATURE_SIDEWAY_FEATURE_H
2#define OSMSCOUT_FEATURE_SIDEWAY_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 public:
33 enum Feature : uint8_t {
36 cyclewayLaneLeft = 1u << 2u,
40 };
41
42 private:
43 uint8_t featureSet=0;
44
45 public:
47
48 bool IsFlagSet(size_t flagIndex) const override
49 {
50 return (featureSet & (1<< flagIndex))!=0;
51 }
52
53 void SetFeatureSet(uint8_t featureSet)
54 {
55 this->featureSet=featureSet;
56 }
57
59 {
60 return (featureSet & sidewalkTrackLeft)!=0;
61 }
62
64 {
65 return (featureSet & sidewalkTrackRight)!=0;
66 }
67
69 {
70 return (featureSet & cyclewayLaneLeft)!=0;
71 }
72
74 {
75 return (featureSet & cyclewayLaneRight)!=0;
76 }
77
79 {
80 return (featureSet & cyclewayTrackLeft)!=0;
81 }
82
84 {
85 return (featureSet & cyclewayTrackRight)!=0;
86 }
87
88 void Read(FileScanner& scanner) override;
89 void Write(FileWriter& writer) override;
90
92 bool operator==(const FeatureValue& other) const override;
93 };
94
96 {
97 private:
98 enum class FeatureFlags: uint8_t {
99 sidewalkTrackLeft = 0,
100 sidewalkTrackRight = 1,
101 cyclewayLaneLeft = 2,
102 cyclewayLaneRight = 3,
103 cyclewayTrackLeft = 4,
104 cyclewayTrackRight = 5
105 };
106
107 private:
108 TagId tagSidewalk;
109 TagId tagCyclewayLeft;
110 TagId tagCyclewayLeftSegregated;
111 TagId tagCyclewayRight;
112 TagId tagCyclewayRightSegregated;
113
114 public:
116 static const char* const NAME;
117
118 public:
120 void Initialize(TagRegistry& tagRegistry) override;
121
122 std::string GetName() const override;
123
124 size_t GetValueAlignment() const override;
125 size_t GetValueSize() const override;
126 FeatureValue* AllocateValue(void* buffer) override;
127
128 void Parse(TagErrorReporter& reporter,
129 const TagRegistry& tagRegistry,
130 const FeatureInstance& feature,
131 const ObjectOSMRef& object,
132 const TagMap& tags,
133 FeatureValueBuffer& buffer) const override;
134 };
135}
136
137#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
Definition TypeFeature.h:41
size_t GetValueAlignment() const override
std::string GetName() const override
void Initialize(TagRegistry &tagRegistry) override
static const char *const NAME
Definition SidewayFeature.h:116
void Parse(TagErrorReporter &reporter, const TagRegistry &tagRegistry, const FeatureInstance &feature, const ObjectOSMRef &object, const TagMap &tags, FeatureValueBuffer &buffer) const override
FeatureValue * AllocateValue(void *buffer) override
size_t GetValueSize() const override
bool HasCyclewayTrackLeft() const
Definition SidewayFeature.h:78
Feature
Definition SidewayFeature.h:33
@ sidewalkTrackRight
Definition SidewayFeature.h:35
@ cyclewayTrackRight
Definition SidewayFeature.h:39
@ cyclewayTrackLeft
Definition SidewayFeature.h:38
@ sidewalkTrackLeft
Definition SidewayFeature.h:34
@ cyclewayLaneLeft
Definition SidewayFeature.h:36
@ cyclewayLaneRight
Definition SidewayFeature.h:37
void SetFeatureSet(uint8_t featureSet)
Definition SidewayFeature.h:53
SidewayFeatureValue & operator=(const FeatureValue &other) override
void Read(FileScanner &scanner) override
bool HasCyclewayLaneRight() const
Definition SidewayFeature.h:73
bool HasSidewalkTrackRight() const
Definition SidewayFeature.h:63
bool IsFlagSet(size_t flagIndex) const override
Definition SidewayFeature.h:48
bool HasCyclewayLaneLeft() const
Definition SidewayFeature.h:68
bool operator==(const FeatureValue &other) const override
bool HasCyclewayTrackRight() const
Definition SidewayFeature.h:83
void Write(FileWriter &writer) override
bool HasSidewalkTrackLeft() const
Definition SidewayFeature.h:58
Definition TagErrorReporter.h:33
Definition Area.h:39
std::unordered_map< TagId, std::string > TagMap
Definition Tag.h:41
uint16_t TagId
Definition Tag.h:39