-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement anschlussgleise, anschlussweichen und Zahnstangen (#136…
…) (#447)
- Loading branch information
Showing
41 changed files
with
710 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
das_client/lib/app/pages/journey/train_journey/widgets/table/connection_track_row.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:das_client/app/i18n/i18n.dart'; | ||
import 'package:das_client/app/pages/journey/train_journey/widgets/table/base_row_builder.dart'; | ||
import 'package:das_client/app/widgets/table/das_table_cell.dart'; | ||
import 'package:das_client/model/journey/connection_track.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class ConnectionTrackRow extends BaseRowBuilder<ConnectionTrack> { | ||
ConnectionTrackRow({ | ||
required super.metadata, | ||
required super.data, | ||
}); | ||
|
||
@override | ||
DASTableCell informationCell(BuildContext context) { | ||
return DASTableCell( | ||
child: Text(data.text ?? context.l10n.c_connection_track_weiche), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
das_client/lib/app/pages/journey/train_journey/widgets/table/speed_change_row.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'package:das_client/app/pages/journey/train_journey/widgets/table/base_row_builder.dart'; | ||
import 'package:das_client/app/widgets/table/das_table_cell.dart'; | ||
import 'package:das_client/model/journey/speed_change.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class SpeedChangeRow extends BaseRowBuilder<SpeedChange> { | ||
SpeedChangeRow({ | ||
required super.metadata, | ||
required super.data, | ||
}); | ||
|
||
@override | ||
DASTableCell informationCell(BuildContext context) { | ||
return DASTableCell( | ||
child: Text(data.text ?? ''), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import 'package:das_client/model/journey/base_data.dart'; | ||
import 'package:das_client/model/journey/datatype.dart'; | ||
|
||
class ConnectionTrack extends BaseData { | ||
ConnectionTrack({required super.order, required super.kilometre, this.text, super.speedData}) | ||
: super(type: Datatype.connectionTrack); | ||
|
||
final String? text; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
import 'package:das_client/model/journey/additional_speed_restriction.dart'; | ||
import 'package:das_client/model/journey/base_data.dart'; | ||
import 'package:das_client/model/journey/service_point.dart'; | ||
import 'package:das_client/model/journey/train_series.dart'; | ||
|
||
class Metadata { | ||
Metadata( | ||
{this.nextStop, | ||
this.currentPosition, | ||
this.routeStart, | ||
this.routeEnd, | ||
List<AdditionalSpeedRestriction>? additionalSpeedRestrictions}) | ||
List<AdditionalSpeedRestriction>? additionalSpeedRestrictions, | ||
this.trainSeries = TrainSeries.R, | ||
this.breakSeries = 150}) | ||
: additionalSpeedRestrictions = additionalSpeedRestrictions ?? []; | ||
|
||
final ServicePoint? nextStop; | ||
final BaseData? currentPosition; | ||
final List<AdditionalSpeedRestriction> additionalSpeedRestrictions; | ||
final BaseData? routeStart; | ||
final BaseData? routeEnd; | ||
final TrainSeries trainSeries; | ||
final int breakSeries; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import 'package:das_client/model/journey/base_data.dart'; | ||
import 'package:das_client/model/journey/datatype.dart'; | ||
|
||
class SpeedChange extends BaseData { | ||
SpeedChange({required super.order, required super.kilometre, required super.speedData, this.text}) | ||
: super(type: Datatype.speedChange); | ||
|
||
final String? text; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:collection/collection.dart'; | ||
import 'package:das_client/model/journey/train_series.dart'; | ||
import 'package:das_client/model/journey/velocity.dart'; | ||
|
||
class SpeedData { | ||
SpeedData({this.velocities = const []}); | ||
|
||
final List<Velocity> velocities; | ||
|
||
String? resolvedSpeed(TrainSeries trainSeries, int breakSeries) { | ||
final trainSeriesVelocities = velocities.where((it) => it.trainSeries == trainSeries); | ||
final exactMatchingVelocity = trainSeriesVelocities.firstWhereOrNull((it) => it.breakSeries == breakSeries); | ||
return exactMatchingVelocity?.speed ?? | ||
trainSeriesVelocities.firstWhereOrNull((it) => it.breakSeries == null)?.speed; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
enum TrainSeries { | ||
A, | ||
D, | ||
N, | ||
O, | ||
R, | ||
W, | ||
S; | ||
|
||
factory TrainSeries.from(String value) { | ||
return values.firstWhere( | ||
(e) => e.name.toLowerCase() == value.toLowerCase(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:das_client/model/journey/train_series.dart'; | ||
|
||
class Velocity { | ||
Velocity({ | ||
required this.trainSeries, | ||
required this.reduced, | ||
this.breakSeries, | ||
this.speed, | ||
}); | ||
|
||
final TrainSeries trainSeries; | ||
final int? breakSeries; | ||
final String? speed; | ||
final bool reduced; | ||
} |
Oops, something went wrong.