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

Method SelectSearchResult

libs/map/framework.cpp:1345–1391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1343}
1344
1345void Framework::SelectSearchResult(search::Result const & result, bool animation)
1346{
1347 using namespace search;
1348 place_page::BuildInfo info;
1349 info.m_source = place_page::BuildInfo::Source::Search;
1350 info.m_needAnimationOnSelection = false;
1351 int scale = -1;
1352 switch (result.GetResultType())
1353 {
1354 case Result::Type::Feature:
1355 info.m_mercator = result.GetFeatureCenter();
1356 info.m_match = place_page::BuildInfo::Match::Nothing;
1357 info.m_featureId = result.GetFeatureID();
1358 info.m_isGeometrySelectionAllowed = true;
1359 break;
1360
1361 case Result::Type::LatLon:
1362 info.m_mercator = result.GetFeatureCenter();
1363 info.m_match = place_page::BuildInfo::Match::Nothing;
1364 scale = scales::GetUpperComfortScale();
1365 break;
1366
1367 case Result::Type::Postcode:
1368 info.m_mercator = result.GetFeatureCenter();
1369 info.m_match = place_page::BuildInfo::Match::Nothing;
1370 info.m_postcode = result.GetString();
1371 scale = scales::GetUpperComfortScale();
1372 break;
1373
1374 case Result::Type::SuggestFromFeature:
1375 case Result::Type::PureSuggest:
1376 m_currentPlacePageInfo = {};
1377 ASSERT(false, ("Suggests should not be here."));
1378 return;
1379 }
1380
1381 m_currentPlacePageInfo = BuildPlacePageInfo(info);
1382 if (m_drapeEngine)
1383 {
1384 if (scale < 0)
1385 scale = GetFeatureViewportScale(m_currentPlacePageInfo->GetTypes());
1386 m2::PointD const center = m_currentPlacePageInfo->GetMercator();
1387 m_drapeEngine->SetModelViewCenter(center, scale, animation, true /* trackVisibleViewport */);
1388 }
1389
1390 ActivateMapSelection();
1391}
1392
1393void Framework::ShowSearchResult(search::Result const & res, bool animation)
1394{

Callers 1

MoveViewportToResultMethod · 0.80

Calls 9

GetUpperComfortScaleFunction · 0.85
ASSERTFunction · 0.85
GetFeatureViewportScaleFunction · 0.85
SetModelViewCenterMethod · 0.80
GetResultTypeMethod · 0.45
GetFeatureCenterMethod · 0.45
GetFeatureIDMethod · 0.45
GetStringMethod · 0.45
GetTypesMethod · 0.45

Tested by

no test coverage detected