diff options
author | Sergey Yershov <yershov@corp.mail.ru> | 2015-08-12 15:07:55 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 03:01:24 +0300 |
commit | 6b82fed453bf3a43370a2c285dfb353c1bb45e78 (patch) | |
tree | 95b0dcfe1ed054ad10a9ec6a2cba2b57bf8ce7c4 /generator | |
parent | ae2ba105a11e8effd24baeeb02c67ee79f05eb77 (diff) |
Make separate 'nd' tag processing
Diffstat (limited to 'generator')
-rw-r--r-- | generator/osm_element.hpp | 13 | ||||
-rw-r--r-- | generator/xml_element.cpp | 6 | ||||
-rw-r--r-- | generator/xml_element.hpp | 14 |
3 files changed, 11 insertions, 22 deletions
diff --git a/generator/osm_element.hpp b/generator/osm_element.hpp index 38c519f179..7a1bf5f136 100644 --- a/generator/osm_element.hpp +++ b/generator/osm_element.hpp @@ -423,16 +423,13 @@ public: FeatureBuilderT ft; // Parse geometry. - for (auto const & e : p->childs) + for (uint64_t ref : p->Nodes()) { - if (e.type == XMLElement::EntityType::Nd) - { - m2::PointD pt; - if (!GetPoint(e.ref, pt)) - return; + m2::PointD pt; + if (!GetPoint(ref, pt)) + return; - ft.AddPoint(pt); - } + ft.AddPoint(pt); } if (ft.GetPointsCount() < 2) diff --git a/generator/xml_element.cpp b/generator/xml_element.cpp index 5c03965117..22e21a3e3f 100644 --- a/generator/xml_element.cpp +++ b/generator/xml_element.cpp @@ -18,11 +18,7 @@ void XMLElement::AddKV(string const & k, string const & v) void XMLElement::AddND(uint64_t ref) { - childs.push_back(XMLElement()); - XMLElement & e = childs.back(); - - e.type = EntityType::Nd; - e.ref = ref; + m_nds.push_back(ref); } void XMLElement::AddMEMBER(uint64_t ref, EntityType type, string const & role) diff --git a/generator/xml_element.hpp b/generator/xml_element.hpp index 41a5878436..1d7379c9ab 100644 --- a/generator/xml_element.hpp +++ b/generator/xml_element.hpp @@ -34,7 +34,8 @@ struct XMLElement string v; EntityType memberType = EntityType::Unknown; string role; - + + vector<uint64_t> m_nds; vector<XMLElement> childs; void Clear() @@ -49,20 +50,15 @@ struct XMLElement memberType = EntityType::Unknown; role.clear(); + m_nds.clear(); childs.clear(); } string ToString(string const & shift = string()) const; - vector<uint64_t> Nodes() const + vector<uint64_t> const & Nodes() const { - vector<uint64_t> nds; - for (auto const & e : childs) - { - if (e.type == EntityType::Nd) - nds.push_back(e.ref); - } - return move(nds); + return m_nds; } struct Member |