From 2eaf3625af6a7e3b4e4c26b1ec56479c45205135 Mon Sep 17 00:00:00 2001 From: vng Date: Thu, 20 Sep 2012 13:16:28 +0300 Subject: [PATCH] Fix generator error with types skipping. --- generator/feature_builder.hpp | 3 ++- generator/osm_element.hpp | 12 +++--------- indexer/feature_data.hpp | 8 ++++++++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/generator/feature_builder.hpp b/generator/feature_builder.hpp index 51cfa0a431..82c3fab3cb 100644 --- a/generator/feature_builder.hpp +++ b/generator/feature_builder.hpp @@ -116,7 +116,8 @@ public: bool PreSerialize(); /// Note! This function overrides all previous assigned types. - inline void SetParams(FeatureParams const & params) { m_Params = params; } + /// Set all the parameters, except geometry type (it's set by other functions). + inline void SetParams(FeatureParams const & params) { m_Params.SetParams(params); } /// For OSM debugging, store original OSM id void AddOsmId(string const & type, uint64_t osmId); diff --git a/generator/osm_element.hpp b/generator/osm_element.hpp index 5db33a2360..dcd282d941 100644 --- a/generator/osm_element.hpp +++ b/generator/osm_element.hpp @@ -320,8 +320,7 @@ protected: bool ParseType(XMLElement * p, uint64_t & id, FeatureParams & fValue) { - VERIFY ( strings::to_uint64(p->attrs["id"], id), - ("Unknown element with invalid id : ", p->attrs["id"]) ); + CHECK ( strings::to_uint64(p->attrs["id"], id), (p->attrs["id"]) ); // try to get type from element tags ftype::GetNameAndType(p, fValue); @@ -354,11 +353,6 @@ class SecondPassParserUsual : public SecondPassParserBase typedef typename base_type::feature_builder_t feature_t; - void InitFeature(FeatureParams const & fValue, feature_t & ft) - { - ft.SetParams(fValue); - } - uint32_t m_coastType; protected: @@ -372,7 +366,6 @@ protected: return; feature_t ft; - InitFeature(fValue, ft); if (p->name == "node") { @@ -481,7 +474,7 @@ protected: while (!wayMap.empty()) { feature_t f; - InitFeature(fValue, f); + f.SetParams(fValue); for (typename base_type::way_map_t::iterator it = wayMap.begin(); it != wayMap.end(); ++it) f.AddOsmId("way", it->second->m_wayOsmId); @@ -503,6 +496,7 @@ protected: return; } + ft.SetParams(fValue); if (ft.PreSerialize()) { // add osm id for debugging diff --git a/indexer/feature_data.hpp b/indexer/feature_data.hpp index 31894a5c86..ffbe1fec9d 100644 --- a/indexer/feature_data.hpp +++ b/indexer/feature_data.hpp @@ -196,6 +196,14 @@ public: m_geomTypes[0] = m_geomTypes[1] = m_geomTypes[2] = false; } + /// Assign parameters except geometry type. + /// Geometry is independent state and it's set by FeatureType's geometry functions. + inline void SetParams(FeatureParams const & rhs) + { + BaseT::operator=(rhs); + m_Types = rhs.m_Types; + } + inline bool IsValid() const { return !m_Types.empty(); } inline void SetGeomType(feature::EGeomType t) { m_geomTypes[t] = true; }