Skip to content

Retrieve additional map attributes to display reliable current road name. - #1576

Merged
vincethecoder merged 24 commits into
masterfrom
navigation/reliable_current_roadname_label
Aug 2, 2018
Merged

vincethecoder merged 24 commits into
masterfrom
navigation/reliable_current_roadname_label

Conversation

@vincethecoder

@vincethecoder vincethecoder commented Jul 24, 2018 •

Copy link
Copy Markdown
Contributor

Uses the shield and reflen 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 associated textColor based on factors such as Locale, RoadType and/or RoadClass.

(FYI: The style images provided already look crisp at the size needed for the navigationView.wayNameView's label).

TODO - Screenshots:

  • interstate
  • interstate-business
  • highway
  • state
  • communal
  • county
  • voivodeship
  • regional
  • trunk
  • primary
  • secondary
  • road
  • main
  • federal
  • national
  • expressway
  • motorway

Addresses #1440
shield-pl-voivodeship-50
shield-ro-county-50
shield-sk-highway-50
shield-us-highway-50
shield-us-interstate-business-50
shield-za-national-50
shield-za-regional-50
shield-at-state-b-50
shield-dk-primary-50
shield-dk-secondary-50
shield-e-road
shield-fi-main-50
shield-fi-trunk-50
shield-gr-motorway-50
shield-us-interstate-50
shield-ro-communal-50

@vincethecoder vincethecoder self-assigned this Jul 24, 2018
… Updated route map view controller to integrate the new changes in the highway shield struct.
@vincethecoder vincethecoder changed the title [WIP] - Reliability of current road name label Reliability of current road name label Jul 26, 2018
vincethecoder and others added 5 commits July 26, 2018 11:31
… 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
@vincethecoder vincethecoder changed the title Reliability of current road name label Retrieve additional map attributes to display reliable current road name. Jul 26, 2018

@bsudekum bsudekum left a comment

Copy link
Copy Markdown
Contributor

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.

currentName = nil
}

if let line = feature as? MGLPolylineFeature {

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

@vincethecoder vincethecoder removed the wip label Jul 27, 2018
…f text and image for road name label attachment. Refactor to retrieve the appropriate attachment for current shields on a road along the route.
@bsudekum

Copy link
Copy Markdown
Contributor

The text should be .white here I think.

@vincethecoder

vincethecoder commented Jul 30, 2018 •

Copy link
Copy Markdown
Contributor Author

@bsudekum yes, that's correct! The textColor should be .white as indicated here. The captured image uploaded in the summary was the wrong file. It's been updated ✅

@akitchen
akitchen requested a review from 1ec5 July 30, 2018 18:26
…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 {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line smells suspicious to me. It's existing logic that checks for line = feature as? MGLPolylineFeature and line = feature as? MGLMultiPolylineFeature within its scope. Needs further investigation why this exists.
/cc @bsudekum @1ec5

@vincethecoder
vincethecoder requested a review from bsudekum July 31, 2018 15:58
@vincethecoder vincethecoder removed the wip label Jul 31, 2018

@JThramer JThramer left a comment

Copy link
Copy Markdown
Contributor

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! 🦁

@bsudekum

Copy link
Copy Markdown
Contributor

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 🛡us-101.

@1ec5

1ec5 commented Jul 31, 2018

Copy link
Copy Markdown
Contributor

🛡US 101 would look pretty redundant and not easy to come up with reliably, as we discovered in the original PR. However, I think something like 🛡Bayshore Highway would be reasonable (with the street name), even if normally we avoid freeway names in the UI. At least it would make the label look more consistent with a banner instruction.

@bsudekum

Copy link
Copy Markdown
Contributor

@1ec5 the problem with that is the ol' ceremonial name problem. Junipero Serra Fwy is not helpful.

@vincethecoder

Copy link
Copy Markdown
Contributor Author

@bsudekum, @1ec5 we should probably bring a designer to this conversation too.

/cc @taraniduncan @cjballard

@bsudekum

bsudekum commented Aug 1, 2018

Copy link
Copy Markdown
Contributor

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

if name and ref
  display name and ref
else if name and !ref
  display name
else if !name and ref
  display ref
else 
  hide

@vincethecoder

vincethecoder commented Aug 1, 2018 •

Copy link
Copy Markdown
Contributor Author

@bsudekum sure thing. Can do

@vincethecoder

Copy link
Copy Markdown
Contributor Author

shield-280-junipero-serra-fwy-screenshot

shield-82-w-el-camino-real-screenshot

shield-84-woodside-rd-screenshot

/cc @bsudekum @1ec5 @cjballard

@JThramer

JThramer commented Aug 1, 2018

Copy link
Copy Markdown
Contributor

Wow, looks great @vincethecoder!

@bsudekum

bsudekum commented Aug 1, 2018

Copy link
Copy Markdown
Contributor

Yeah, I think this is looking much better @vincethecoder.

@Cjballard-zz

Copy link
Copy Markdown

Looks good to me @vincethecoder 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants