diff options
author | Maksim Andrianov <maksimandrianov1@gmail.com> | 2018-07-23 12:14:51 +0300 |
---|---|---|
committer | Sergey Yershov <syershov@maps.me> | 2018-08-02 11:35:45 +0300 |
commit | b4b73b00e6a5725c342146686ad773dc06bfa997 (patch) | |
tree | 95d8a1c403d5c1403e03dc9e6c108849c9ba27b6 /generator/osm_element.hpp | |
parent | 243f9390ab8b0613508dbd0e9a76a7b7e893d5f2 (diff) |
Review fixes
Diffstat (limited to 'generator/osm_element.hpp')
-rw-r--r-- | generator/osm_element.hpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/generator/osm_element.hpp b/generator/osm_element.hpp index cd41746ff8..8f5019e59e 100644 --- a/generator/osm_element.hpp +++ b/generator/osm_element.hpp @@ -95,9 +95,13 @@ struct OsmElement std::string ToString(std::string const & shift = std::string()) const; - inline std::vector<uint64_t> const & Nodes() const { return m_nds; } - inline std::vector<Member> const & Members() const { return m_members; } - inline std::vector<Tag> const & Tags() const { return m_tags; } + std::vector<uint64_t> const & Nodes() const { return m_nds; } + std::vector<Member> const & Members() const { return m_members; } + std::vector<Tag> const & Tags() const { return m_tags; } + + bool IsNode() const { return type == EntityType::Node; } + bool IsWay() const { return type == EntityType::Way; } + bool IsRelation() const { return type == EntityType::Relation; } static EntityType StringToEntityType(std::string const & t) { @@ -111,10 +115,9 @@ struct OsmElement return EntityType::Unknown; } - bool operator == (OsmElement const & e) const + bool operator==(OsmElement const & e) const { - return ( - type == e.type + return type == e.type && id == e.id && my::AlmostEqualAbs(lon, e.lon, 1e-7) && my::AlmostEqualAbs(lat, e.lat, 1e-7) @@ -125,8 +128,7 @@ struct OsmElement && role == e.role && m_nds == e.m_nds && m_members == e.m_members - && m_tags == e.m_tags - ); + && m_tags == e.m_tags; } void AddNd(uint64_t ref) { m_nds.emplace_back(ref); } @@ -136,7 +138,10 @@ struct OsmElement } void AddTag(std::string const & k, std::string const & v); - template <class TFn> void UpdateTag(std::string const & k, TFn && fn) + bool HasTagValue(std::string const & k, std::string const & v) const; + + template <class Fn> + void UpdateTag(std::string const & k, Fn && fn) { for (auto & tag : m_tags) { |