[metadata] Better handling of building:height

This commit is contained in:
Ilya Zverev 2016-01-14 11:53:03 +03:00 committed by Sergey Yershov
parent 45c58107d1
commit 0a61e6e5cd

View file

@ -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;
}
}