43 lines
1.3 KiB
Dart
43 lines
1.3 KiB
Dart
// ignore_for_file: constant_identifier_names
|
|
|
|
import 'parser.dart';
|
|
import 'sentence.dart';
|
|
|
|
import 'types.dart';
|
|
|
|
const TypeBOD = "BOD";
|
|
|
|
class BOD {
|
|
double bearingTrue; // true bearing in degrees
|
|
String bearingTrueType; // is type of true bearing
|
|
double bearingMagnetic; // magnetic bearing in degrees
|
|
String bearingMagneticType; // is type of magnetic bearing
|
|
String destinationWaypointID; // destination waypoint ID
|
|
String originWaypointID; // origin waypoint ID
|
|
BOD(
|
|
{required this.bearingTrue,
|
|
required this.bearingTrueType,
|
|
required this.bearingMagnetic,
|
|
required this.bearingMagneticType,
|
|
required this.destinationWaypointID,
|
|
required this.originWaypointID});
|
|
|
|
static BOD newBOD(BaseSentence s) {
|
|
var p = Parser(s);
|
|
|
|
var bod = BOD(
|
|
bearingTrue: p.float64(0, "true bearing"),
|
|
bearingTrueType: p.enumString(1, "true bearing type", [BearingTrue]),
|
|
bearingMagnetic: p.float64(2, "magnetic bearing"),
|
|
bearingMagneticType:
|
|
p.enumString(3, "magnetic bearing type", [BearingMagnetic]),
|
|
destinationWaypointID: p.string(4, "destination waypoint ID"),
|
|
originWaypointID: "",
|
|
);
|
|
if (s.fields.length > 5) {
|
|
bod.originWaypointID = p.string(5, "origin waypoint ID");
|
|
}
|
|
return bod;
|
|
}
|
|
}
|