From 0a61e6e5cd990c13f06b20193c6841bac15ca4ae Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Thu, 14 Jan 2016 11:53:03 +0300 Subject: [PATCH] [metadata] Better handling of building:height --- drape_frontend/rule_drawer.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drape_frontend/rule_drawer.cpp b/drape_frontend/rule_drawer.cpp index 0d0c69c187..a82154106a 100644 --- a/drape_frontend/rule_drawer.cpp +++ b/drape_frontend/rule_drawer.cpp @@ -148,19 +148,23 @@ void RuleDrawer::operator()(FeatureType const & f) { f.ParseMetadata(); feature::Metadata const & md = f.GetMetadata(); - string value = md.Get(feature::Metadata::FMD_HEIGHT); - double const kDefaultHeightInMeters = 3.0; + constexpr double kDefaultHeightInMeters = 3.0; + constexpr double kMetersPerLevel = 3.0; double heightInMeters = kDefaultHeightInMeters; + + string value = md.Get(feature::Metadata::FMD_HEIGHT); if (!value.empty()) + { strings::to_double(value, heightInMeters); + } else { value = md.Get(feature::Metadata::FMD_BUILDING_LEVELS); if (!value.empty()) { - strings::to_double(value, heightInMeters); - heightInMeters *= 3.0; + if (strings::to_double(value, heightInMeters)) + heightInMeters *= kMetersPerLevel; } }