| 1495 | } |
| 1496 | |
| 1497 | void Framework::CreateDrapeEngine(ref_ptr<dp::GraphicsContextFactory> contextFactory, DrapeCreationParams && params) |
| 1498 | { |
| 1499 | auto idReadFn = [this](df::MapDataProvider::TReadCallback<FeatureID const> const & fn, m2::RectD const & r, |
| 1500 | int scale) -> void { m_featuresFetcher.ForEachFeatureID(r, fn, scale); }; |
| 1501 | |
| 1502 | auto featureReadFn = [this](df::MapDataProvider::TReadCallback<FeatureType> const & fn, |
| 1503 | vector<FeatureID> const & ids) -> void { m_featuresFetcher.ReadFeatures(fn, ids); }; |
| 1504 | |
| 1505 | auto myPositionModeChangedFn = [this](location::EMyPositionMode mode, bool routingActive) |
| 1506 | { |
| 1507 | GetPlatform().RunTask(Platform::Thread::Gui, [this, mode, routingActive]() |
| 1508 | { |
| 1509 | // Deactivate selection (and hide place page) if we return to routing in F&R mode. |
| 1510 | if (routingActive && mode == location::FollowAndRotate) |
| 1511 | DeactivateMapSelection(); |
| 1512 | |
| 1513 | if (m_myPositionListener != nullptr) |
| 1514 | m_myPositionListener(mode, routingActive); |
| 1515 | }); |
| 1516 | }; |
| 1517 | |
| 1518 | auto overlaysShowStatsFn = [](list<df::OverlayShowEvent> &&) {}; |
| 1519 | |
| 1520 | auto onGraphicsContextInitialized = [this]() |
| 1521 | { |
| 1522 | GetPlatform().RunTask(Platform::Thread::Gui, [this]() |
| 1523 | { |
| 1524 | if (m_onGraphicsContextInitialized) |
| 1525 | m_onGraphicsContextInitialized(); |
| 1526 | }); |
| 1527 | }; |
| 1528 | |
| 1529 | auto isCountryLoadedByNameFn = bind(&Framework::IsCountryLoadedByName, this, _1); |
| 1530 | auto updateCurrentCountryFn = bind(&Framework::OnUpdateCurrentCountry, this, _1, _2); |
| 1531 | |
| 1532 | bool allow3d; |
| 1533 | bool allow3dBuildings; |
| 1534 | Load3dMode(allow3d, allow3dBuildings); |
| 1535 | |
| 1536 | auto const isAutozoomEnabled = LoadAutoZoom(); |
| 1537 | |
| 1538 | auto const trafficEnabled = m_trafficManager.IsEnabled(); |
| 1539 | auto const isolinesEnabled = m_isolinesManager.IsEnabled(); |
| 1540 | |
| 1541 | auto const simplifiedTrafficColors = m_trafficManager.HasSimplifiedColorScheme(); |
| 1542 | auto const fontsScaleFactor = LoadLargeFontsSize() ? kLargeFontsScaleFactor : 1.0; |
| 1543 | |
| 1544 | df::DrapeEngine::Params p( |
| 1545 | params.m_apiVersion, contextFactory, dp::Viewport(0, 0, params.m_surfaceWidth, params.m_surfaceHeight), |
| 1546 | df::MapDataProvider(std::move(idReadFn), std::move(featureReadFn), std::move(isCountryLoadedByNameFn), |
| 1547 | std::move(updateCurrentCountryFn)), |
| 1548 | params.m_hints, params.m_visualScale, fontsScaleFactor, std::move(params.m_widgetsInitInfo), |
| 1549 | std::move(myPositionModeChangedFn), allow3dBuildings, trafficEnabled, isolinesEnabled, |
| 1550 | params.m_isChoosePositionMode, params.m_isChoosePositionMode, GetSelectedFeatureTriangles(), |
| 1551 | m_routingManager.IsRoutingActive() && m_routingManager.IsRoutingFollowing(), isAutozoomEnabled, |
| 1552 | simplifiedTrafficColors, std::nullopt /* arrow3dCustomDecl */, std::move(overlaysShowStatsFn), |
| 1553 | std::move(onGraphicsContextInitialized), std::move(params.m_renderInjectionHandler)); |
| 1554 |
no test coverage detected