-
Notifications
You must be signed in to change notification settings - Fork 312
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
Don't use ceremonial name when way is interstate #291
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>us-interstate</key> | ||
<string>I</string> | ||
<key>us-interstate-business</key> | ||
<string>I</string> | ||
<key>us-interstate-duplex</key> | ||
<string>I</string> | ||
<key>us-interstate-truck</key> | ||
<string>I</string> | ||
<key>us-highway</key> | ||
<string>US</string> | ||
<key>us-highway-duplex</key> | ||
<string>US</string> | ||
<key>us-highway-alternate</key> | ||
<string>US</string> | ||
<key>us-highway-business</key> | ||
<string>US</string> | ||
<key>us-highway-bypass</key> | ||
<string>US</string> | ||
<key>us-highway-truck</key> | ||
<string>US</string> | ||
</dict> | ||
</plist> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -336,18 +336,34 @@ extension RouteMapViewController: NavigationMapViewDelegate { | |
if minDistanceBetweenPoints < smallestLabelDistance { | ||
smallestLabelDistance = minDistanceBetweenPoints | ||
|
||
if let line = feature as? MGLPolylineFeature, 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 { | ||
currentName = name | ||
if let line = feature as? MGLPolylineFeature { | ||
if let name = line.attribute(forKey: "name") as? String, !name.isFreeway { | ||
currentName = name | ||
} else if let ref = line.attribute(forKey: "ref") as? String, let shield = line.attribute(forKey: "shield") as? String { | ||
if let highwayName = HighwayNamesByPrefix[shield] { | ||
currentName = "\(highwayName) \(ref)" | ||
} else { | ||
currentName = ref | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For any country outside the U.S., this logic would display only the number. Even inside the U.S., something like a county road would get just the number, which is opposite what I would expect. I think it would be preferable in all these cases to either show the name and number or to show nothing at all. |
||
} | ||
} | ||
} else if let line = feature as? MGLMultiPolylineFeature { | ||
if let name = line.attribute(forKey: "name") as? String, !name.isFreeway { | ||
currentName = name | ||
} else if let ref = line.attribute(forKey: "ref") as? String, let shield = line.attribute(forKey: "shield") as? String { | ||
if let highwayName = HighwayNamesByPrefix[shield] { | ||
currentName = "\(highwayName) \(ref)" | ||
} else { | ||
currentName = ref | ||
} | ||
} | ||
} else { | ||
currentName = nil | ||
} | ||
} | ||
} | ||
} | ||
|
||
if smallestLabelDistance < 5 && currentName != nil { | ||
if smallestLabelDistance < 10 && currentName != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Heh, nope. |
||
wayNameLabel.text = currentName | ||
wayNameView.isHidden = false | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,10 +10,7 @@ extension String { | |
return NSRange(location: 0, length: characters.count) | ||
} | ||
} | ||
} | ||
|
||
|
||
extension String { | ||
typealias Replacement = (of: String, with: String) | ||
|
||
func byReplacing(_ replacements: [Replacement]) -> String { | ||
|
@@ -28,4 +25,10 @@ extension String { | |
("'", "'") | ||
]) | ||
} | ||
|
||
var isFreeway: Bool { | ||
return self.components(separatedBy: " ").filter { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: drop |
||
["freeway", "expressway", "highway", "fwy", "hwy"].contains($0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Mapbox Streets source abbreviates “expressway” as “Expy”. |
||
}.isEmpty | ||
} | ||
} |
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.
Given:
the label will incorrectly say “US 50”, whereas it would be more accurate to say “US 50 Alt” or “Alt US 50”. Same for the other banners below.