| 94 | } // namespace |
| 95 | |
| 96 | DrawWidget::DrawWidget(Framework & framework, std::unique_ptr<ScreenshotParams> && screenshotParams, QWidget * parent) |
| 97 | : TBase(framework, screenshotParams != nullptr, parent) |
| 98 | , m_rubberBand(nullptr) |
| 99 | , m_emulatingLocation(false) |
| 100 | { |
| 101 | setFocusPolicy(Qt::StrongFocus); |
| 102 | |
| 103 | m_framework.SetPlacePageListeners([this]() { ShowPlacePage(); }, {} /* onClose */, {} /* onUpdate */, |
| 104 | {} /*onSwitchFullScreen */); |
| 105 | |
| 106 | auto & routingManager = m_framework.GetRoutingManager(); |
| 107 | |
| 108 | routingManager.SetRouteBuildingListener( |
| 109 | [&routingManager, this](routing::RouterResultCode, storage::CountriesSet const &) |
| 110 | { |
| 111 | auto & drapeApi = m_framework.GetDrapeApi(); |
| 112 | |
| 113 | m_turnsVisualizer.ClearTurns(drapeApi); |
| 114 | |
| 115 | if (RoutingSettings::TurnsEnabled()) |
| 116 | m_turnsVisualizer.Visualize(routingManager, drapeApi); |
| 117 | |
| 118 | auto const routerType = routing::GetLastUsedRouter(); |
| 119 | if (routerType == routing::RouterType::Pedestrian || routerType == routing::RouterType::Bicycle) |
| 120 | { |
| 121 | RoutingManager::DistanceAltitude da; |
| 122 | if (!routingManager.GetRouteAltitudesAndDistancesM(da)) |
| 123 | return; |
| 124 | |
| 125 | for (int iter = 0; iter < 2; ++iter) |
| 126 | { |
| 127 | LOG(LINFO, ("Altitudes", iter == 0 ? "before" : "after", "simplify:")); |
| 128 | LOG_SHORT(LDEBUG, (da)); |
| 129 | |
| 130 | uint32_t totalAscent, totalDescent; |
| 131 | da.CalculateAscentDescent(totalAscent, totalDescent); |
| 132 | LOG_SHORT(LINFO, ("Ascent:", totalAscent, "Descent:", totalDescent)); |
| 133 | |
| 134 | da.Simplify(); |
| 135 | } |
| 136 | } |
| 137 | }); |
| 138 | |
| 139 | routingManager.SetRouteRecommendationListener([this](RoutingManager::Recommendation r) { OnRouteRecommendation(r); }); |
| 140 | |
| 141 | if (screenshotParams != nullptr) |
| 142 | { |
| 143 | m_ratio = screenshotParams->m_dpiScale; |
| 144 | m_screenshoter = std::make_unique<Screenshoter>(*screenshotParams, m_framework, this); |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | DrawWidget::~DrawWidget() |
| 149 | { |
nothing calls this directly
no test coverage detected