[generator][search] Do not index for search isolines names. Do not save isolines names for step 10.

This commit is contained in:
Daria Volvenkova 2020-01-28 16:54:38 +03:00
parent 7dbb352395
commit 1659deda41
2 changed files with 22 additions and 9 deletions

View file

@ -9,19 +9,30 @@ namespace generator
{
namespace
{
static std::vector<int> const kAltClasses = {1000, 500, 100, 50, 10};
static std::vector<int> const kNamedAltClasses = {1000, 500, 100, 50};
static std::string const kTypePrefix = "step_";
std::string GetIsolineType(topography_generator::Altitude altitude)
{
static std::vector<int> const altClasses = {1000, 500, 100, 50, 10};
ASSERT(std::is_sorted(altClasses.cbegin(), altClasses.cend(), std::greater<int>()), ());
std::string const kPrefix = "step_";
ASSERT(std::is_sorted(kAltClasses.cbegin(), kAltClasses.cend(), std::greater<int>()), ());
if (altitude == 0)
return kPrefix + strings::to_string(altClasses.back());
return kTypePrefix + strings::to_string(kAltClasses.back());
for (auto altStep : altClasses)
for (auto altStep : kAltClasses)
{
if (altitude % altStep == 0)
return kPrefix + strings::to_string(altStep);
return kTypePrefix + strings::to_string(altStep);
}
return "";
}
std::string GetIsolineName(topography_generator::Altitude altitude)
{
for (auto altStep : kNamedAltClasses)
{
if (altitude % altStep == 0)
return strings::to_string(altitude);
}
return "";
}
@ -43,7 +54,7 @@ void IsolineFeaturesGenerator::GenerateIsolines(std::string const & countryName,
for (auto const & levelIsolines : countryIsolines.m_contours)
{
auto const altitude = levelIsolines.first;
auto const isolineName = strings::to_string(altitude);
auto const isolineName = GetIsolineName(altitude);
auto const isolineType = GetIsolineType(altitude);
if (isolineType.empty())
{
@ -60,7 +71,8 @@ void IsolineFeaturesGenerator::GenerateIsolines(std::string const & countryName,
fb.AddPoint(pt);
fb.AddType(type);
fb.AddName("default", isolineName);
if (!isolineName.empty())
fb.AddName("default", isolineName);
fbs.emplace_back(std::move(fb));
}
}

View file

@ -37,6 +37,7 @@ TypesSkipper::TypesSkipper()
}
m_skipAlways[1].push_back(c.GetTypeByPath({"sponsored", "partner18"}));
m_skipAlways[1].push_back(c.GetTypeByPath({"sponsored", "partner19"}));
m_skipAlways[0].push_back(c.GetTypeByPath({"isoline"}));
}
void TypesSkipper::SkipEmptyNameTypes(feature::TypesHolder & types) const