Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions SampleApp/OJPSampleApp/Views/StopEventView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,38 @@ struct StopEventView: View {
extension Pictograms {
static func picto(mode: OJPv2.Mode) -> Image {
switch mode.ptMode {
case .air:
Pictograms.aeroplane_right_framed
case .bus:
Pictograms.bus_right_framed
case .coach:
Pictograms.remote_bus_right_framed
case .ferry:
Pictograms.car_ferry_right_framed
case .metro:
Pictograms.metro_left_de_framed
case .rail:
Pictograms.train_right_framed
case .bus:
case .taxi:
Pictograms.taxi_right_framed
case .telecabin:
Pictograms.gondola_lift_right_framed
case .trolleyBus:
Pictograms.bus_right_framed
case .tram:
Pictograms.tram_right_framed
case .water:
Pictograms.jetty_right_framed
case .telecabin:
case .cableway:
Pictograms.cableway_right_framed
case .underground:
Pictograms.metro_right_de_framed
case .funicular:
Pictograms.funicular_railway_right_framed
case .lift:
Pictograms.lift
case .snowAndIce:
Pictograms.ski_lift_right_framed
case .unknown:
Pictograms.information_framed
}
Expand Down
17 changes: 15 additions & 2 deletions Sources/OJP/Models/OJPv2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,11 @@ public struct OJPv2: Codable, Sendable {
public struct Mode: Codable, Sendable, Hashable {
public let ptMode: PtMode

public init(ptMode: PtMode, busSubmode: String?, railSubmode: String?, name: InternationalText?, shortName: InternationalText?) {
public init(ptMode: PtMode, busSubmode: String? = nil, railSubmode: String? = nil, funicularSubmode: String? = nil, name: InternationalText? = nil, shortName: InternationalText?) {
self.ptMode = ptMode
self.busSubmode = busSubmode
self.railSubmode = railSubmode
self.funicularSubmode = funicularSubmode
self.name = name
self.shortName = shortName
}
Expand All @@ -207,6 +208,7 @@ public struct OJPv2: Codable, Sendable {
// keep busSubmode, railSubmode for now
public let busSubmode: String?
public let railSubmode: String?
public let funicularSubmode: String?

public let name: InternationalText?
public let shortName: InternationalText?
Expand All @@ -215,17 +217,28 @@ public struct OJPv2: Codable, Sendable {
case ptMode = "PtMode"
case busSubmode = "siri:BusSubmode"
case railSubmode = "siri:RailSubmode"
case funicularSubmode = "siri:FunicularSubmode"
case name = "Name"
case shortName = "ShortName"
}

public enum PtMode: String, Codable, Sendable {
case rail
case air
case bus
case coach
case ferry
case metro
case rail
case trolleyBus
case tram
case water
case cableway
case telecabin
case underground
case taxi
case funicular
case lift
case snowAndIce
case unknown

public init(from decoder: Decoder) throws {
Expand Down
Loading