-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix traffic congestion rendering issues. #2580
Conversation
…ds which allow to create route lines if needed. Fixed defect which was calling incorrect delegate method for alternateRoutesCasingLayer.
…ring route line gradient calculation.
… already added route layer.
|
||
@discardableResult func addAlternateRoutesLayer(_ style: MGLStyle, source: MGLSource, below layer: MGLStyleLayer) -> MGLStyleLayer { | ||
let customAlternateRoutesLayer = navigationMapViewDelegate?.navigationMapView(self, | ||
alternativeRouteStyleLayerWithIdentifier: StyleLayerIdentifier.alternateRoutes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point we use NavigationMapViewDelegate.navigationMapView(_:alternativeRouteStyleLayerWithIdentifier:source:)
and NavigationMapViewDelegate.navigationMapView(_:alternateRouteCasingStyleLayerWithIdentifier:source:)
. @1ec5, maybe it'd be better to use the same convention here? As I can see alternate
is mostly used in NavigationMapView
, maybe we should use the same naming in public API method?
alternativeRouteStyleLayerWithIdentifier: StyleLayerIdentifier.alternateRoutes, | |
alternateRouteStyleLayerWithIdentifier: StyleLayerIdentifier.alternateRoutes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be “alternative” consistently. “Alternate” is easily read as a verb in this context, and it has a slightly different meaning anyways.
let mainRouteCasingShape = navigationMapViewDelegate?.navigationMapView(self, shapeFor: [mainRoute]) ?? shape(for: [mainRoute], legIndex: legIndex) | ||
let mainRouteCasingSource = addMainRouteCasingSource(style, shape: mainRouteCasingShape) | ||
|
||
let mainRouteLayer = addMainRouteLayer(style, source: allRoutesSource, lineGradient: routeLineGradient(mainRoute, fractionTraveled: 0.0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new helper methods make this method much easier to follow, thanks!
Fix traffic congestion rendering issues. (cherry picked from commit 4aaf88c)
* Update to MapboxDirections v0.33.2. (#2585) (cherry picked from commit 6e54f9d) * Merge pull request #2586 from mapbox/maxim/2584-update-navigation-styles Update day/night style URLs. (cherry picked from commit 24c83ea) * Merge pull request #2580 from mapbox/maxim/2574-fix-traffic-congestion Fix traffic congestion rendering issues. (cherry picked from commit 4aaf88c) * Merge pull request #2581 from mapbox/maxim/2526-make-fade-route-public Make updateRoute(_:) public. (cherry picked from commit bfed4ac)
Closing #2574.
I've slightly re-worked original implementation. Now there are such methods which allow to add route layers:
Such methods are used to create line gradient:
In case if route layer was already added route line gradient with congestion segments will be retrieved out of it.
For route casing color is always the same (without congestions), but fading is also added depending on route progress.
Current PR also fixes #2423 and #2512.