Ejemplo n.º 1
0
bool
AbstractTaskFactory::validate()
{
  clearValidationErrors();

  bool valid = true;

  if (!m_task.has_start()) {
    addValidationError(NO_VALID_START);
    valid = false;
  }
  if (!m_task.has_finish()) {
    addValidationError(NO_VALID_FINISH);
    valid = false;
  }

  if (get_ordered_task_behaviour().is_closed && !is_closed()) {
    addValidationError(TASK_NOT_CLOSED);
    valid = false;
  }

  if (get_ordered_task_behaviour().is_fixed_size()) {
    if (m_task.TaskSize() != get_ordered_task_behaviour().max_points) {
      addValidationError(INCORRECT_NUMBER_TURNPOINTS);
      valid = false;
    }
  } else {
    if (m_task.TaskSize() < get_ordered_task_behaviour().min_points) {
      addValidationError(UNDER_MIN_TURNPOINTS);
      valid = false;
    }
    if (m_task.TaskSize() > get_ordered_task_behaviour().max_points) {
      addValidationError(EXCEEDS_MAX_TURNPOINTS);
      valid = false;
    }
  }

  if (get_ordered_task_behaviour().homogeneous_tps && !is_homogeneous()) {
    addValidationError(TASK_NOT_HOMOGENEOUS);
    valid = false;
  }

  return valid;
}
Ejemplo n.º 2
0
bool
AbstractTaskFactory::validateFAIOZs()
{
  clearValidationErrors();
  bool valid = true;

  for (unsigned i = 0; i < m_task.TaskSize() && valid; i++) {
    const OrderedTaskPoint *tp = m_task.get_tp(i);
    const fixed ozsize = GetOZSize(tp->get_oz());

    switch (getType(*tp)) {
    case  START_BGA:
    case  START_CYLINDER:
      valid = false;
      break;

    case  START_SECTOR:
      if (ozsize > fixed(1000.01))
        valid = false;

      break;
    case  START_LINE:
      if (ozsize > fixed(2000.01))
        valid = false;

      break;

    case  FAI_SECTOR:
      break;

    case  AST_CYLINDER:
      if (ozsize > fixed(500.01))
        valid = false;

      break;

    case  KEYHOLE_SECTOR:
    case  BGAFIXEDCOURSE_SECTOR:
    case  BGAENHANCEDOPTION_SECTOR:
    case  AAT_CYLINDER:
    case  AAT_SEGMENT:
    case  AAT_ANNULAR_SECTOR:
      valid = false;
      break;

    case  FINISH_SECTOR:
      break;
    case  FINISH_LINE:
      if (ozsize > fixed(2000.01))
        valid = false;

      break;

    case  FINISH_CYLINDER:
      valid = false;
      break;
    }
  }

  if (!valid)
    addValidationError(NON_FAI_OZS);

  return valid;
}
Ejemplo n.º 3
0
bool
AbstractTaskFactory::validateFAIOZs()
{
  clearValidationErrors();
  bool valid = true;

  for (unsigned i = 0; i < m_task.task_size() && valid; i++) {
    const OrderedTaskPoint *tp = m_task.get_tp(i);
    const ObservationZonePoint* oz = tp->get_oz();
    UserSizeObservationZone soz;
    ObservationZoneConstVisitor &oz_visitor = soz;
    oz_visitor.Visit(*oz);
    const fixed ozsize = soz.get_user_size();

    switch (getType(*tp)) {
    case  START_BGA:
    case  START_CYLINDER:
      valid = false;
      break;

    case  START_SECTOR:
      if (ozsize > fixed(1000.01)) {
        valid = false;
      }
      break;
    case  START_LINE:
      if (ozsize > fixed(2000.01)) {
        valid = false;
      }
      break;

    case  FAI_SECTOR:
      break;

    case  AST_CYLINDER:
      if (ozsize > fixed(500.01)) {
        valid = false;
      }
      break;

    case  KEYHOLE_SECTOR:
    case  BGAFIXEDCOURSE_SECTOR:
    case  BGAENHANCEDOPTION_SECTOR:
    case  AAT_CYLINDER:
    case  AAT_SEGMENT:
    case  AAT_ANNULAR_SECTOR:
      valid = false;
      break;

    case  FINISH_SECTOR:
      break;
    case  FINISH_LINE:
      if (ozsize > fixed(2000.01)) {
        valid = false;
      }
      break;

    case  FINISH_CYLINDER:
      valid = false;
      break;
    }
  }
  if (!valid)
    addValidationError(NON_FAI_OZS);

  return valid;
}