BMFMassTransitSubStep.fromMap constructor

BMFMassTransitSubStep.fromMap(
  1. Map map
)

map => BMFMassTransitSubStep

Implementation

BMFMassTransitSubStep.fromMap(Map map) : super.fromMap(map) {
  entraceCoor = map['entraceCoor'] == null
      ? null
      : BMFCoordinate.fromMap(map['entraceCoor']);
  exitCoor =
      map['exitCoor'] == null ? null : BMFCoordinate.fromMap(map['exitCoor']);
  instructions = map['instructions'];
  stepType = BMFMassTransitType.values[map['stepType'] as int];

  switch (stepType) {
    case BMFMassTransitType.BUSLINE:
    case BMFMassTransitType.SUBWAY:
      vehicleInfo = BMFBusVehicleInfo.fromMap(map['busAndSubwayVehicleInfo']);
      break;
    case BMFMassTransitType.COACH:
      vehicleInfo = BMFCoachVehicleInfo.fromMap(map['coachVehicleInfo']);
      break;
    case BMFMassTransitType.PLANE:
      vehicleInfo = BMFPlaneVehicleInfo.fromMap(map['planeVehicleInfo']);
      break;
    case BMFMassTransitType.TRAIN:
      vehicleInfo = BMFTrainVehicleInfo.fromMap(map['trainVehicleInfo']);
      break;
    default:
      break;
  }

  if (map['trafficConditions'] != null) {
    trafficConditions = new List<BMFTrafficCondition>();
    map['trafficConditions'].forEach((v) {
      trafficConditions.add(BMFTrafficCondition.fromMap(v as Map));
    });
  }
}