-
Notifications
You must be signed in to change notification settings - Fork 88
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
Add SubType
to VisualInstruction.Component
.
#778
Changes from all commits
0cc8df7
3724997
1bbad73
ce56eab
7fe8012
d74aed1
458de0a
fec1a93
bf19d4e
4ae98ec
f0fc3d0
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 |
---|---|---|
|
@@ -51,7 +51,7 @@ public extension VisualInstruction { | |
/** | ||
The component is an image of a zoomed junction, with a fallback text representation. | ||
*/ | ||
case guidanceView(image: GuidanceViewImageRepresentation, alternativeText: TextRepresentation) | ||
case guidanceView(image: GuidanceViewImageRepresentation, alternativeText: TextRepresentation, kind: GuidanceViewKind? = nil) | ||
|
||
/** | ||
The component contains the localized word for “Exit”. | ||
|
@@ -254,6 +254,7 @@ public struct GuidanceViewImageRepresentation: Equatable { | |
extension VisualInstruction.Component: Codable { | ||
private enum CodingKeys: String, CodingKey { | ||
case kind = "type" | ||
case guidanceViewKind = "subType" | ||
case text | ||
case abbreviatedText = "abbr" | ||
case abbreviatedTextPriority = "abbr_priority" | ||
|
@@ -275,6 +276,75 @@ extension VisualInstruction.Component: Codable { | |
case lane | ||
} | ||
|
||
/** | ||
:nodoc: | ||
MaximAlien marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Kind of the guidance view that provides more context about the component guidance view that may help in visual | ||
markup and display choices. | ||
*/ | ||
public enum GuidanceViewKind: String, Codable, CaseIterable { | ||
|
||
/** | ||
Junction view. Bird’s-eye artist’s rendition view of the overhead signage and | ||
preferred road lane arrow on motorways where the road bifurcates into 2 or | ||
more motorway trunk roads. | ||
*/ | ||
case fork = "jct" | ||
Comment on lines
+287
to
+291
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: imo, we should make these doc comments more clear since the naming has changed. Some of @1ec5's suggestions provide some clarity as to what each of these 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. It's a bit hard to provide more clarity at this point, maybe in future we'll be able to extend these docs. Current info regarding sub types was taken from private docs and unfortunately they do not have enough info either. |
||
|
||
/** | ||
Advanced 2D signboard (vendor enhanced detailed signboard). | ||
*/ | ||
case signboard = "signboard" | ||
|
||
/** | ||
Service area/parking area guide map. Vertical artist’s rendition guide map of an SAPA rest area | ||
showing various facilities icons such as restaurants, restrooms and parking areas. | ||
The scale is approximately 1 to 5K. | ||
*/ | ||
case serviceAreaGuideMap = "sapaguidemap" | ||
|
||
/** | ||
Service area/parking area. Bird’s-eye artist’s rendition view of the overhead | ||
signage and preferred road lane arrow at a rest area ramp where the route | ||
leaves the main road. | ||
*/ | ||
case serviceArea = "sapa" | ||
|
||
/** | ||
Sign image after a toll gate. Used immediately after exiting a toll gate containing just the | ||
overhead signboard. The preferred road (not the lane) arrow is highlighted on the signboard. | ||
*/ | ||
case afterToll = "aftertoll" | ||
|
||
/** | ||
3D city real. Bird’s-eye artist’s rendition view of a general road intersection | ||
and preferred road lane arrow. There is no overhead signage. | ||
*/ | ||
case realisticUrbanIntersection = "cityreal" | ||
|
||
/** | ||
Motorway entrance. Bird’s-eye artist’s rendition view of the overhead signage and | ||
preferred road lane arrow at an entrance ramp onto a motorway. | ||
*/ | ||
case motorwayEntrance = "entrance" | ||
|
||
/** | ||
Motorway exit. Bird’s-eye artist’s rendition view of the overhead signage and | ||
preferred road lane arrow at an exit ramp from a motorway. | ||
*/ | ||
case motorwayExit = "exit" | ||
|
||
/** | ||
Branched image after a toll gate. Bird’s-eye artist’s rendition view of the overhead | ||
signage and preferred road lane arrow immediately after exiting a toll gate. | ||
*/ | ||
case tollBranch = "tollbranch" | ||
|
||
/** | ||
Direction signboard guidance view. | ||
*/ | ||
case directionBoard = "directionboard" | ||
} | ||
|
||
public init(from decoder: Decoder) throws { | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
let kind = (try? container.decode(Kind.self, forKey: .kind)) ?? .text | ||
|
@@ -317,7 +387,8 @@ extension VisualInstruction.Component: Codable { | |
imageURL = URL(string: imageURLString) | ||
} | ||
let guidanceViewImageRepresentation = GuidanceViewImageRepresentation(imageURL: imageURL) | ||
self = .guidanceView(image: guidanceViewImageRepresentation, alternativeText: textRepresentation) | ||
let guidanceViewKind = try container.decodeIfPresent(GuidanceViewKind.self, forKey: .guidanceViewKind) | ||
self = .guidanceView(image: guidanceViewImageRepresentation, alternativeText: textRepresentation, kind: guidanceViewKind) | ||
} | ||
} | ||
|
||
|
@@ -349,10 +420,11 @@ extension VisualInstruction.Component: Codable { | |
try container.encode(indications, forKey: .directions) | ||
try container.encode(isUsable, forKey: .isActive) | ||
try container.encodeIfPresent(preferredDirection, forKey: .activeDirection) | ||
case .guidanceView(let image, let alternativeText): | ||
case .guidanceView(let image, let alternativeText, let kind): | ||
try container.encode(Kind.guidanceView, forKey: .kind) | ||
textRepresentation = alternativeText | ||
try container.encodeIfPresent(image.imageURL?.absoluteString, forKey: .imageURL) | ||
try container.encodeIfPresent(kind, forKey: .guidanceViewKind) | ||
} | ||
|
||
if let textRepresentation = textRepresentation { | ||
|
@@ -375,10 +447,11 @@ extension VisualInstruction.Component: Equatable { | |
let .image(rhsURL, rhsAlternativeText)): | ||
return lhsURL == rhsURL | ||
&& lhsAlternativeText == rhsAlternativeText | ||
case (let .guidanceView(lhsURL, lhsAlternativeText), | ||
let .guidanceView(rhsURL, rhsAlternativeText)): | ||
case (let .guidanceView(lhsURL, lhsAlternativeText, lhsKind), | ||
let .guidanceView(rhsURL, rhsAlternativeText, rhsKind)): | ||
return lhsURL == rhsURL | ||
&& lhsAlternativeText == rhsAlternativeText | ||
&& lhsKind == rhsKind | ||
case (let .lane(lhsIndications, lhsIsUsable, lhsPreferredDirection), | ||
let .lane(rhsIndications, rhsIsUsable, rhsPreferredDirection)): | ||
return lhsIndications == rhsIndications | ||
|
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.
This entry should not be public just yet.