-
Notifications
You must be signed in to change notification settings - Fork 318
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
Retrieve additional map attributes to display reliable current road name. #1576
Retrieve additional map attributes to display reliable current road name. #1576
Conversation
…tails for textColor and fillColor for current road feature.
… Updated route map view controller to integrate the new changes in the highway shield struct.
… Updated route map view controller to integrate the new changes in the highway shield struct. Co-authored-by: Jerrad Thramer <[email protected]> Co-authored-by: Vincent Sam <[email protected]>
…om:mapbox/mapbox-navigation-ios into navigation/reliable_current_roadname_label
…lass used within the highway shield struct.
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.
Looking @vincethecoder. I'm having a hard time getting a shield to show up, where can I test this? When simulating freeway drive in the sim, it still shows Junipero Serra Fwy
.
@@ -808,18 +809,56 @@ extension RouteMapViewController: NavigationViewDelegate { | |||
} else { | |||
currentName = nil | |||
} | |||
|
|||
if let line = feature as? MGLPolylineFeature { |
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.
We've already pulled this value out above. See if you can combine these if let statements.
private func attributedString(withFont font: UIFont, shieldImage: UIImage, text: String, color: UIColor?) -> NSAttributedString { | ||
let attachment = RoadNameLabelAttachment() | ||
attachment.font = font | ||
attachment.text = text |
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.
What are we getting out of RoadNameLabelAttachment
over NSAttributedString
directly? Having a new text prop sounds a little funny when there is already an initializer for string.
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.
RoadNameLabelAttachment
should handle the text and image composition. Our primary goal was to use the text prop as the accessibility text/hint for that road name label attachment image. However, it has been revised to allow the RoadNameLabelAttachment
to handle the task of inserting the text in the image.
…f text and image for road name label attachment. Refactor to retrieve the appropriate attachment for current shields on a road along the route.
…the current polyline and multipolyline features. Updates to return the original full format of the rawValue init with HighwayShield.
if let line = feature as? MGLPolylineFeature { | ||
if let name = line.attribute(forKey: "name") as? String { | ||
currentName = name | ||
} else if let line = feature as? MGLMultiPolylineFeature, let name = line.attribute(forKey: "name") as? String { |
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.
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.
Excited to get this into the wild! 🦁
I'm slightly concerned with design here. I think it's difficult to quickly understand what the little bubble with a shield means. It'd be interesting to see what this would look like where we spell out the ref as well to make this more understandable. It'd look something like |
|
@1ec5 the problem with that is the ol' ceremonial name problem. |
To build on the prior comment, I have the same feeling about the single shield in the way name label as I would about a top banner that only has a single shield in it. IMO, when the top banner has only one element, it almost feels like a bug as it's not descriptive enough for the driver to fully understand what we're trying to tell them. @vincethecoder do you want to give @1ec5's suggestion a try? It'd look something like
|
@bsudekum sure thing. Can do |
/cc @bsudekum @1ec5 @cjballard |
Wow, looks great @vincethecoder! |
Yeah, I think this is looking much better @vincethecoder. |
Looks good to me @vincethecoder 👌 |
Uses the
shield
andreflen
attributes to get the shield image from the map style and inserts it into the current road name label as part of an attributed string. Includes a data model for the shields with the associatedtextColor
based on factors such asLocale
,RoadType
and/orRoadClass
.(FYI: The style images provided already look crisp at the size needed for the
navigationView.wayNameView
's label).TODO - Screenshots:
Addresses #1440
![shield-pl-voivodeship-50](https://user-images.githubusercontent.com/2340650/43345479-a86c0de2-91bb-11e8-89e4-46e6c58f9e83.png)
![shield-ro-county-50](https://user-images.githubusercontent.com/2340650/43345481-a8b518c0-91bb-11e8-8362-c3f5cde52215.png)
![shield-sk-highway-50](https://user-images.githubusercontent.com/2340650/43345482-a8d75e1c-91bb-11e8-8ad7-cec3b56c092e.png)
![shield-us-highway-50](https://user-images.githubusercontent.com/2340650/43345483-a8f98f78-91bb-11e8-98ad-e2c433c7585d.png)
![shield-us-interstate-business-50](https://user-images.githubusercontent.com/2340650/43345485-a93f3ffa-91bb-11e8-80b9-a29a3d93a22c.png)
![shield-za-national-50](https://user-images.githubusercontent.com/2340650/43345488-a960fe74-91bb-11e8-8d1f-fc287b135c87.png)
![shield-za-regional-50](https://user-images.githubusercontent.com/2340650/43345489-a9817596-91bb-11e8-9401-6111e5e8c8b8.png)
![shield-at-state-b-50](https://user-images.githubusercontent.com/2340650/43345467-a7498c1e-91bb-11e8-8170-9a0268584b78.png)
![shield-dk-primary-50](https://user-images.githubusercontent.com/2340650/43345473-a78e851c-91bb-11e8-87b5-23c3bea812a6.png)
![shield-dk-secondary-50](https://user-images.githubusercontent.com/2340650/43345474-a7af4f7c-91bb-11e8-81d8-81c57fa1d78a.png)
![shield-e-road](https://user-images.githubusercontent.com/2340650/43345475-a7d8e1c0-91bb-11e8-836a-eec3b3a327b5.png)
![shield-fi-main-50](https://user-images.githubusercontent.com/2340650/43345476-a7fe464a-91bb-11e8-8ae0-0815b6e5fcaa.png)
![shield-fi-trunk-50](https://user-images.githubusercontent.com/2340650/43345477-a81cd524-91bb-11e8-90fa-9d92b4eab1ab.png)
![shield-gr-motorway-50](https://user-images.githubusercontent.com/2340650/43345478-a8448588-91bb-11e8-9537-a5aa68fefb3b.png)
![shield-us-interstate-50](https://user-images.githubusercontent.com/2340650/43412525-84e1596c-93fb-11e8-8b9d-08579c29b1e8.png)
![shield-ro-communal-50](https://user-images.githubusercontent.com/2340650/43345480-a8866cbe-91bb-11e8-8cfa-94299e6fbc84.png)