diff --git a/drape_frontend/backend_renderer.cpp b/drape_frontend/backend_renderer.cpp index c3e187c372..546a734edc 100644 --- a/drape_frontend/backend_renderer.cpp +++ b/drape_frontend/backend_renderer.cpp @@ -345,7 +345,9 @@ void BackendRenderer::AcceptMessage(ref_ptr message) case Message::FlushTrafficGeometry: { ref_ptr msg = message; - m_trafficGenerator->FlushSegmentsGeometry(msg->GetKey(), msg->GetSegments(), m_texMng); + auto const & tileKey = msg->GetKey(); + if (m_requestedTiles->CheckTileKey(tileKey) && m_readManager->CheckTileKey(tileKey)) + m_trafficGenerator->FlushSegmentsGeometry(tileKey, msg->GetSegments(), m_texMng); break; } diff --git a/drape_frontend/traffic_generator.cpp b/drape_frontend/traffic_generator.cpp index a692852b2b..c731112b4c 100644 --- a/drape_frontend/traffic_generator.cpp +++ b/drape_frontend/traffic_generator.cpp @@ -192,6 +192,7 @@ void TrafficGenerator::FlushSegmentsGeometry(TileKey const & tileKey, TrafficSeg state.SetMaskTexture(textures->GetTrafficArrowTexture()); static vector roadClasses = {RoadClass::Class0, RoadClass::Class1, RoadClass::Class2}; + static const int kGenerateCapsZoomLevel[] = {13, 14, 16}; for (auto geomIt = geom.begin(); geomIt != geom.end(); ++geomIt) { @@ -208,6 +209,10 @@ void TrafficGenerator::FlushSegmentsGeometry(TileKey const & tileKey, TrafficSeg auto segmentColoringIt = coloring.find(sid); if (segmentColoringIt != coloring.end()) { + // We do not generate geometry for unknown segments. + if (segmentColoringIt->second == traffic::SpeedGroup::Unknown) + continue; + TrafficSegmentGeometry const & g = geomIt->second[i].second; ref_ptr batcher = m_batchersPool->GetBatcher(TrafficBatcherKey(geomIt->first, tileKey, g.m_roadClass)); @@ -216,7 +221,7 @@ void TrafficGenerator::FlushSegmentsGeometry(TileKey const & tileKey, TrafficSeg vector staticGeometry; vector dynamicGeometry; - bool const generateCaps = (tileKey.m_zoomLevel > kOutlineMinZoomLevel); + bool const generateCaps = (tileKey.m_zoomLevel > kGenerateCapsZoomLevel[static_cast(g.m_roadClass)]); GenerateSegment(colorRegion, g.m_polyline, tileKey.GetGlobalRect().Center(), generateCaps, staticGeometry, dynamicGeometry); ASSERT_EQUAL(staticGeometry.size(), dynamicGeometry.size(), ()); diff --git a/drape_frontend/traffic_generator.hpp b/drape_frontend/traffic_generator.hpp index 3703285bc6..0ca9ff274c 100644 --- a/drape_frontend/traffic_generator.hpp +++ b/drape_frontend/traffic_generator.hpp @@ -35,8 +35,7 @@ enum class RoadClass : uint8_t int constexpr kRoadClass0ZoomLevel = 10; int constexpr kRoadClass1ZoomLevel = 12; -int constexpr kRoadClass2ZoomLevel = 14; -int constexpr kOutlineMinZoomLevel = 13; +int constexpr kRoadClass2ZoomLevel = 15; struct TrafficSegmentID { diff --git a/drape_frontend/traffic_renderer.cpp b/drape_frontend/traffic_renderer.cpp index 7d9ed2b914..8d26416998 100644 --- a/drape_frontend/traffic_renderer.cpp +++ b/drape_frontend/traffic_renderer.cpp @@ -19,8 +19,9 @@ namespace df namespace { -int const kMinVisibleArrowZoomLevel = 16; -int const kRoadClass2MinVisibleArrowZoomLevel = 17; +int constexpr kMinVisibleArrowZoomLevel = 16; +int constexpr kRoadClass2MinVisibleArrowZoomLevel = 17; +int constexpr kOutlineMinZoomLevel = 13; float const kTrafficArrowAspect = 24.0f / 8.0f; @@ -53,7 +54,7 @@ float const kRoadClass2WidthScalar[] = // 1 2 3 4 5 6 7 8 9 10 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, //11 12 13 14 15 16 17 18 19 20 - 0.0f, 0.0f, 0.0f, 0.2f, 0.3f, 0.5f, 0.7f, 0.8f, 0.9f, 1.0f + 0.0f, 0.0f, 0.0f, 0.0f, 0.3f, 0.5f, 0.7f, 0.8f, 0.9f, 1.0f }; float CalculateHalfWidth(ScreenBase const & screen, RoadClass const & roadClass, bool left)