| 153 | } |
| 154 | |
| 155 | void Framework::VisualizeCrossMwmTransitionsInRect(m2::RectD const & rect) |
| 156 | { |
| 157 | using CrossMwmID = base::GeoObjectId; |
| 158 | using ConnectorT = routing::CrossMwmConnector<CrossMwmID>; |
| 159 | std::map<MwmSet::MwmId, ConnectorT> connectors; |
| 160 | std::map<MwmSet::MwmId, dp::Color> colors; |
| 161 | |
| 162 | GetDataSource().ForEachInRect([&](FeatureType & ft) |
| 163 | { |
| 164 | if (ft.GetGeomType() != feature::GeomType::Line) |
| 165 | return; |
| 166 | |
| 167 | auto const & mwmId = ft.GetID().m_mwmId; |
| 168 | auto res = connectors.try_emplace(mwmId, ConnectorT()); |
| 169 | ConnectorT & connector = res.first->second; |
| 170 | if (res.second) |
| 171 | { |
| 172 | MwmSet::MwmHandle handle = m_featuresFetcher.GetDataSource().GetMwmHandleById(mwmId); |
| 173 | CHECK(handle.IsAlive(), ()); |
| 174 | |
| 175 | auto reader = routing::connector::GetReader<CrossMwmID>(handle.GetValue()->m_cont); |
| 176 | routing::CrossMwmConnectorBuilder<CrossMwmID> builder(connector); |
| 177 | builder.DeserializeTransitions(routing::VehicleType::Car, reader); |
| 178 | |
| 179 | static uint32_t counter = 0; |
| 180 | colors.emplace(mwmId, colorList[counter++ % std::size(colorList)]); |
| 181 | } |
| 182 | |
| 183 | std::vector<uint32_t> transitSegments; |
| 184 | connector.ForEachTransitSegmentId(ft.GetID().m_index, [&transitSegments](uint32_t seg) |
| 185 | { |
| 186 | transitSegments.push_back(seg); |
| 187 | return false; |
| 188 | }); |
| 189 | |
| 190 | if (!transitSegments.empty()) |
| 191 | { |
| 192 | auto const color = colors.find(mwmId)->second; |
| 193 | |
| 194 | int segIdx = -1; |
| 195 | m2::PointD prevPt; |
| 196 | ft.ForEachPoint([&](m2::PointD const & pt) |
| 197 | { |
| 198 | if (base::IsExist(transitSegments, segIdx)) |
| 199 | { |
| 200 | GetDrapeApi().AddLine(DebugPrint(ft.GetID()) + ", " + std::to_string(segIdx), |
| 201 | df::DrapeApiLineData({prevPt, pt}, color).Width(10.0f)); |
| 202 | } |
| 203 | |
| 204 | prevPt = pt; |
| 205 | ++segIdx; |
| 206 | }, scales::GetUpperScale()); |
| 207 | } |
| 208 | }, rect, scales::GetUpperScale()); |
| 209 | } |
no test coverage detected