bool ResultMatches(DataSource const & dataSource, shared_ptr<MatchingRule> rule, search::Result const & result) { bool matches = false; dataSource.ReadFeature([&](FeatureType & ft) { matches = rule->Matches(ft); }, result.GetFeatureID()); return matches; }
bool Matches(Context & context, Sample::Result const & golden, search::Result const & actual) { static double constexpr kToleranceMeters = 50; if (actual.GetResultType() != Result::RESULT_FEATURE) return false; FeatureType ft; if (!context.GetFeature(actual.GetFeatureID(), ft)) return false; string name; if (!ft.GetName(FeatureType::DEFAULT_LANG, name)) name.clear(); auto const houseNumber = ft.GetHouseNumber(); auto const center = feature::GetCenter(ft); return golden.m_name == strings::MakeUniString(name) && golden.m_houseNumber == houseNumber && MercatorBounds::DistanceOnEarth(golden.m_pos, center) < kToleranceMeters; }
string DrawWidget::GetDistance(search::Result const & res) const { string dist; double lat, lon; if (m_framework->GetCurrentPosition(lat, lon)) { double dummy; (void) m_framework->GetDistanceAndAzimut(res.GetFeatureCenter(), lat, lon, -1.0, dist, dummy); } return dist; }