Merge pull request #5295 from Zverik/wlan_vis

[search] Fix wifi test and internet_access=wlan visibility
This commit is contained in:
mpimenov 2017-01-30 13:41:04 +04:00 committed by GitHub
commit 0e099e063d
4 changed files with 32 additions and 1 deletions

View file

@ -100,6 +100,7 @@ void GetCategoryTypes(CategoriesHolder const & categories, pair<int, int> const
feature::TypesHolder const & types, vector<uint32_t> & result)
{
Classificator const & c = classif();
auto const & invisibleChecker = ftypes::IsInvisibleIndexedChecker::Instance();
for (uint32_t t : types)
{
@ -112,6 +113,13 @@ void GetCategoryTypes(CategoriesHolder const & categories, pair<int, int> const
if (!categories.IsTypeExist(t))
continue;
// There are some special non-drawable types we plan to search on.
if (invisibleChecker(t))
{
result.push_back(t);
continue;
}
// Index only those types that are visible.
pair<int, int> r = feature::GetDrawableScaleRange(t);
CHECK_LESS_OR_EQUAL(r.first, r.second, (c.GetReadableObjectName(t)));

View file

@ -208,6 +208,7 @@ namespace
/// Add here all exception classificator types: needed for algorithms,
/// but don't have drawing rules.
/// See also ftypes_matcher.cpp, IsInvisibleIndexedChecker.
bool TypeAlwaysExists(uint32_t type, EGeomType g = GEOM_UNDEFINED)
{
static const uint32_t roundabout = classif().GetTypeByPath({ "junction", "roundabout" });
@ -215,6 +216,7 @@ namespace
static const uint32_t psurface = classif().GetTypeByPath({ "psurface" });
static const uint32_t wheelchair = classif().GetTypeByPath({ "wheelchair" });
static const uint32_t sponsored = classif().GetTypeByPath({ "sponsored" });
static const uint32_t internet = classif().GetTypeByPath({ "internet_access" });
// Caching type length to exclude generic [wheelchair].
uint8_t const typeLength = ftype::GetLevel(type);
@ -237,7 +239,7 @@ namespace
if (wheelchair == type && typeLength == 2)
return true;
if (sponsored == type)
if (sponsored == type || internet == type)
return true;
return false;

View file

@ -431,6 +431,18 @@ IsOpentableChecker const & IsOpentableChecker::Instance()
return inst;
}
IsInvisibleIndexedChecker::IsInvisibleIndexedChecker() : BaseChecker(1 /* level */)
{
m_types.push_back(classif().GetTypeByPath({"internet_access"}));
m_types.push_back(classif().GetTypeByPath({"wheelchair"}));
}
IsInvisibleIndexedChecker const & IsInvisibleIndexedChecker::Instance()
{
static IsInvisibleIndexedChecker const instance;
return instance;
}
IsLocalityChecker::IsLocalityChecker()
{
Classificator const & c = classif();

View file

@ -192,6 +192,15 @@ public:
static IsOpentableChecker const & Instance();
};
// Checks for types that are not drawable, but searchable.
class IsInvisibleIndexedChecker : public BaseChecker
{
IsInvisibleIndexedChecker();
public:
static IsInvisibleIndexedChecker const & Instance();
};
/// Type of locality (do not change values and order - they have detalization order)
/// COUNTRY < STATE < CITY < ...
enum Type { NONE = -1, COUNTRY = 0, STATE, CITY, TOWN, VILLAGE, LOCALITY_COUNT };