forked from organicmaps/organicmaps
[search] Fixed buildings matching.
* Fixed building-to-street check. High precision geometry is used now to get building center and to get nearby streets. * Fixed search results merge for buildings.
This commit is contained in:
parent
50ff16f269
commit
59a0d804f4
2 changed files with 18 additions and 2 deletions
|
@ -647,6 +647,14 @@ class PreResult2Maker
|
|||
|
||||
m_query.GetBestMatchName(f, name);
|
||||
|
||||
// It's invalid for a building to have an empty name if it has a
|
||||
// house number - it will be merged with other buildings in a
|
||||
// MakePreResult2(). To prevent this, house number is used as a
|
||||
// building name here, if the latter is empty.
|
||||
auto const & checker = ftypes::IsBuildingChecker::Instance();
|
||||
if (checker(f) && name.empty())
|
||||
name = f.GetHouseNumber();
|
||||
|
||||
// country (region) name is a file name if feature isn't from World.mwm
|
||||
if (m_pFV->IsWorld())
|
||||
country.clear();
|
||||
|
@ -973,7 +981,8 @@ public:
|
|||
|
||||
void Query::GetBestMatchName(FeatureType const & f, string & name) const
|
||||
{
|
||||
UNUSED_VALUE(f.ForEachName(impl::BestNameFinder(name, m_keywordsScorer)));
|
||||
impl::BestNameFinder finder(name, m_keywordsScorer);
|
||||
UNUSED_VALUE(f.ForEachName(finder));
|
||||
}
|
||||
|
||||
/// Makes continuous range for tokens and prefix.
|
||||
|
|
|
@ -308,7 +308,14 @@ private:
|
|||
if (!loaded)
|
||||
GetByIndex(houseId, feature);
|
||||
|
||||
m2::PointD const center = feature::GetCenter(feature, FeatureType::WORST_GEOMETRY);
|
||||
// Best geometry is used here as feature::GetCenter(feature)
|
||||
// actually modifies internal state of a |feature| by caching
|
||||
// it's geometry. So, when GetMatchingStreet(houseId, feature)
|
||||
// is called, high precision geometry is used again to compute
|
||||
// |feature|'s center, and this is a right behavior as
|
||||
// house-to-street table was generated by using high-precision
|
||||
// centers of features.
|
||||
m2::PointD const center = feature::GetCenter(feature);
|
||||
if (!calculator.GetProjection(center, proj))
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue