mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-16 17:39:49 +00:00
AbstractHafasClientInterfaceProvider: Parse 'lineId' of 'prodCtx' and use it.
This commit is contained in:
parent
e1568f32e5
commit
9b34b91ad4
3 changed files with 19 additions and 17 deletions
|
@ -1015,14 +1015,16 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
|
|||
final int oprIndex = prod.optInt("oprX", -1);
|
||||
final String operator = oprIndex != -1 ? operators.get(oprIndex) : null;
|
||||
final int cls = prod.optInt("cls", -1);
|
||||
final JSONObject prodCtx = prod.optJSONObject("prodCtx");
|
||||
final String id = prodCtx != null ? prodCtx.optString("lineId", null) : null;
|
||||
final Product product = cls != -1 ? intToProduct(cls) : null;
|
||||
lines.add(newLine(operator, product, name, nameS, number, style));
|
||||
lines.add(newLine(id, operator, product, name, nameS, number, style));
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
protected Line newLine(final String operator, final Product product, final @Nullable String name,
|
||||
protected Line newLine(final String id, final String operator, final Product product, final @Nullable String name,
|
||||
final @Nullable String shortName, final @Nullable String number, final Style style) {
|
||||
final String longName;
|
||||
if (name != null)
|
||||
|
@ -1041,10 +1043,10 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
|
|||
label = number;
|
||||
else
|
||||
label = name;
|
||||
return new Line(null, operator, product, label, longName, lineStyle(operator, product, label));
|
||||
return new Line(id, operator, product, label, longName, lineStyle(operator, product, label));
|
||||
} else {
|
||||
// Otherwise the longer label is fine
|
||||
return new Line(null, operator, product, name, longName, lineStyle(operator, product, name));
|
||||
return new Line(id, operator, product, name, longName, lineStyle(operator, product, name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,32 +109,32 @@ public final class BvgProvider extends AbstractHafasClientInterfaceProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Line newLine(final String operator, final Product product, final @Nullable String name,
|
||||
protected Line newLine(final String id, final String operator, final Product product, final @Nullable String name,
|
||||
final @Nullable String shortName, final @Nullable String number, final Style style) {
|
||||
final Line line = super.newLine(operator, product, name, shortName, number, style);
|
||||
final Line line = super.newLine(id, operator, product, name, shortName, number, style);
|
||||
|
||||
if (line.product == Product.SUBURBAN_TRAIN) {
|
||||
if ("S41".equals(line.label))
|
||||
return new Line(null, line.network, line.product, line.label, line.name, line.style,
|
||||
return new Line(id, line.network, line.product, line.label, line.name, line.style,
|
||||
Sets.newHashSet(Attr.CIRCLE_CLOCKWISE), line.message);
|
||||
if ("S42".equals(line.label))
|
||||
return new Line(null, line.network, line.product, line.label, line.name, line.style,
|
||||
return new Line(id, line.network, line.product, line.label, line.name, line.style,
|
||||
Sets.newHashSet(Attr.CIRCLE_ANTICLOCKWISE), line.message);
|
||||
if ("S9".equals(line.label))
|
||||
return new Line(null, line.network, line.product, line.label, line.name, line.style,
|
||||
return new Line(id, line.network, line.product, line.label, line.name, line.style,
|
||||
Sets.newHashSet(Attr.LINE_AIRPORT), line.message);
|
||||
if ("S45".equals(line.label))
|
||||
return new Line(null, line.network, line.product, line.label, line.name, line.style,
|
||||
return new Line(id, line.network, line.product, line.label, line.name, line.style,
|
||||
Sets.newHashSet(Attr.LINE_AIRPORT), line.message);
|
||||
} else if (line.product == Product.BUS) {
|
||||
if ("S41".equals(line.label))
|
||||
return new Line(null, line.network, line.product, line.label, line.name, line.style,
|
||||
return new Line(id, line.network, line.product, line.label, line.name, line.style,
|
||||
Sets.newHashSet(Attr.SERVICE_REPLACEMENT, Attr.CIRCLE_CLOCKWISE), line.message);
|
||||
if ("S42".equals(line.label))
|
||||
return new Line(null, line.network, line.product, line.label, line.name, line.style,
|
||||
return new Line(id, line.network, line.product, line.label, line.name, line.style,
|
||||
Sets.newHashSet(Attr.SERVICE_REPLACEMENT, Attr.CIRCLE_ANTICLOCKWISE), line.message);
|
||||
if ("TXL".equals(line.label))
|
||||
return new Line(null, line.network, line.product, line.label, line.name, line.style,
|
||||
return new Line(id, line.network, line.product, line.label, line.name, line.style,
|
||||
Sets.newHashSet(Attr.LINE_AIRPORT), line.message);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,16 +90,16 @@ public class VbnProvider extends AbstractHafasClientInterfaceProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Line newLine(final String operator, final Product product, final @Nullable String name,
|
||||
protected Line newLine(final String id, final String operator, final Product product, final @Nullable String name,
|
||||
final @Nullable String shortName, final @Nullable String number, final Style style) {
|
||||
final Line line = super.newLine(operator, product, name, shortName, number, style);
|
||||
final Line line = super.newLine(id, operator, product, name, shortName, number, style);
|
||||
|
||||
if (line.product == Product.BUS) {
|
||||
if ("57".equals(line.label))
|
||||
return new Line(null, line.network, line.product, line.label, line.name, line.style,
|
||||
return new Line(id, line.network, line.product, line.label, line.name, line.style,
|
||||
Sets.newHashSet(Attr.SERVICE_REPLACEMENT, Attr.CIRCLE_CLOCKWISE), line.message);
|
||||
if ("58".equals(line.label))
|
||||
return new Line(null, line.network, line.product, line.label, line.name, line.style,
|
||||
return new Line(id, line.network, line.product, line.label, line.name, line.style,
|
||||
Sets.newHashSet(Attr.SERVICE_REPLACEMENT, Attr.CIRCLE_ANTICLOCKWISE), line.message);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue