MCPcopy Create free account
hub / github.com/comaps/comaps / MatchWorld2Country

Method MatchWorld2Country

libs/search/geocoder.cpp:1598–1626  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1596}
1597
1598uint32_t Geocoder::MatchWorld2Country(FeatureID const & id) const
1599{
1600 if (m_context->m_handle.GetId() == id.m_mwmId)
1601 return id.m_index;
1602
1603 ASSERT(id.IsWorld(), ());
1604 // Get source Feature's name and center.
1605 std::string name;
1606 m2::PointD pt;
1607 m_dataSource.ReadFeature([&](FeatureType & ft)
1608 {
1609 name = ft.GetName(localisation::kDefaultNameIndex);
1610 pt = feature::GetCenter(ft);
1611 }, id);
1612
1613 // Match name and center in the current MwmContext.
1614 uint32_t resID = kInvalidFeatureId;
1615 m_context->ForEachFeature({pt, pt}, [&](FeatureType & ft)
1616 {
1617 if (resID == kInvalidFeatureId && ft.GetName(localisation::kDefaultNameIndex) == name &&
1618 // Relaxed points comparison because geometry coding in the World and in a Country is different.
1619 feature::GetCenter(ft).EqualDxDy(pt, kMwmPointAccuracy * 100))
1620 {
1621 resID = ft.GetID().m_index;
1622 }
1623 });
1624
1625 return resID;
1626}
1627
1628void Geocoder::FindPaths(BaseContext & ctx)
1629{

Callers

nothing calls this directly

Calls 9

ASSERTFunction · 0.85
GetCenterFunction · 0.85
ReadFeatureMethod · 0.80
GetIdMethod · 0.45
IsWorldMethod · 0.45
GetNameMethod · 0.45
ForEachFeatureMethod · 0.45
EqualDxDyMethod · 0.45
GetIDMethod · 0.45

Tested by

no test coverage detected