Ejemplo n.º 1
0
  static bool
  CompareType(const Waypoint &waypoint, TypeFilter type)
  {
    switch (type) {
    case TF_ALL:
      return true;

    case TF_AIRPORT:
      return waypoint.IsAirport();

    case TF_LANDABLE:
      return waypoint.IsLandable();

    case TF_TURNPOINT:
      return waypoint.IsTurnpoint();

    case TF_START:
      return waypoint.IsStartpoint();

    case TF_FINISH:
      return waypoint.IsFinishpoint();

    case TF_FAI_TRIANGLE_LEFT:
      return triangle_validator->IsFAITrianglePoint(waypoint, fixed(-1));

    case TF_FAI_TRIANGLE_RIGHT:
      return triangle_validator->IsFAITrianglePoint(waypoint, fixed_one);

    case TF_FILE_1:
      return waypoint.file_num == 1;

    case TF_FILE_2:
      return waypoint.file_num == 2;

    case TF_LAST_USED:
      return false;
    }

    /* not reachable */
    return false;
  }
Ejemplo n.º 2
0
bool
CAI302Device::WriteNavpoint(unsigned id, const Waypoint &wp,
                            OperationEnvironment &env)
{
  if (!DownloadMode(env))
    return false;

  char name[64], remark[64];
  ToASCII(name, ARRAY_SIZE(name), wp.name.c_str());
  ToASCII(remark, ARRAY_SIZE(remark), wp.comment.c_str());

  if (!CAI302::DownloadNavpoint(port, wp.location, (int)wp.elevation, id,
                                wp.IsTurnpoint(), wp.IsAirport(), false,
                                wp.IsLandable(), wp.IsStartpoint(),
                                wp.IsFinishpoint(), wp.flags.home,
                                false, wp.IsTurnpoint(), false,
                                name, remark, env)) {
    mode = Mode::UNKNOWN;
    return false;
  }

  return true;
}