예제 #1
0
static void
RefreshView()
{
    WndFrame* wSummary = (WndFrame *)wf->FindByName(_T("frmSummary"));
    if (wSummary) {
        const TCHAR* text = OrderedTaskFactoryDescription(get_cursor_type());
        wSummary->SetCaption(text);
    }
}
예제 #2
0
void
TaskPropertiesPanel::InitView()
{
  WndProperty* wp;

  static gcc_constexpr_data StaticEnumChoice start_max_height_ref_list[] = {
    { (unsigned)HeightReferenceType::AGL, N_("AGL"), N_("Reference AGL for start maximum height rule (above start point).") },
    { (unsigned)HeightReferenceType::MSL, N_("MSL"), N_("Reference MSL for start maximum height rule (above sea level).") },
    { 0 }
  };
  LoadFormProperty(form, _T("prpStartHeightRef"), start_max_height_ref_list,
                   (unsigned)HeightReferenceType::AGL);

  static gcc_constexpr_data StaticEnumChoice finish_min_height_ref_list[] = {
    { (unsigned)HeightReferenceType::AGL, N_("AGL"), N_("Reference AGL for finish minimum height rule (above finish point).") },
    { (unsigned)HeightReferenceType::MSL, N_("MSL"), N_("Reference MSL for finish minimum height rule (above sea level).") },
    { 0 }
  };
  LoadFormProperty(form, _T("prpFinishHeightRef"), finish_min_height_ref_list,
                   (unsigned)HeightReferenceType::AGL);

  wp = (WndProperty *)form.FindByName(_T("prpTaskType"));
  if (wp) {
    const std::vector<TaskFactoryType> factory_types =
        ordered_task->GetFactoryTypes();
    DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->EnableItemHelp(true);

    for (unsigned i = 0; i < factory_types.size(); i++) {
      dfe->addEnumText(OrderedTaskFactoryName(factory_types[i]),
          (unsigned)factory_types[i], OrderedTaskFactoryDescription(
              factory_types[i]));
      if (factory_types[i] == ordered_task->GetFactoryType())
        dfe->Set((unsigned)factory_types[i]);
    }
    wp->RefreshDisplay();
  }
}
예제 #3
0
static void 
InitView()
{
  WndProperty* wp;

  static const StaticEnumChoice start_max_height_ref_list[] = {
    { hrAGL, N_("AGL"), N_("Reference AGL for start maximum height rule (above start point)") },
    { hrMSL, N_("MSL"), N_("Reference MSL for start maximum height rule (above sea level)") },
    { 0 }
  };
  LoadFormProperty(*wf, _T("prpStartHeightRef"), start_max_height_ref_list, hrAGL);

  static const StaticEnumChoice finish_min_height_ref_list[] = {
    { hrAGL, N_("AGL"), N_("Reference AGL for finish minimum height rule (above finish point)") },
    { hrMSL, N_("MSL"), N_("Reference MSL for finish minimum height rule (above sea level)") },
    { 0 }
  };
  LoadFormProperty(*wf, _T("prpFinishHeightRef"), finish_min_height_ref_list, hrAGL);

  wp = (WndProperty*)wf->FindByName(_T("prpTaskType"));
  if (wp) {
    const std::vector<TaskBehaviour::Factory_t> factory_types =
        ordered_task->get_factory_types();
    DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->EnableItemHelp(true);

    for (unsigned i = 0; i < factory_types.size(); i++) {
      dfe->addEnumText(OrderedTaskFactoryName(factory_types[i]),
          (unsigned)factory_types[i], OrderedTaskFactoryDescription(
              factory_types[i]));
      if (factory_types[i] == ordered_task->get_factory_type())
        dfe->Set((unsigned)factory_types[i]);
    }
    wp->RefreshDisplay();
  }
}
void
TaskDefaultsConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
    WndProperty *wp;
    const ComputerSettings &settings_computer = XCSoarInterface::GetComputerSettings();
    const TaskBehaviour &task_behaviour = settings_computer.task;
    OrderedTask temptask(task_behaviour);
    temptask.SetFactory(TaskFactoryType::RACING);

    RowFormWidget::Prepare(parent, rc);

    wp = AddEnum(_("Start point"),
                 _("Default start type for new tasks you create."),
                 this);
    if (wp) {
        const auto point_types = temptask.GetFactory().GetValidStartTypes();
        DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
        dfe->EnableItemHelp(true);

        for (auto i = point_types.begin(), end = point_types.end();
                i != end; ++i) {
            const AbstractTaskFactory::LegalPointType type = *i;
            dfe->addEnumText(OrderedTaskPointName(type), (unsigned)type,
                             OrderedTaskPointDescription(type));
            if (type == task_behaviour.sector_defaults.start_type)
                dfe->Set((unsigned)type);
        }
        wp->RefreshDisplay();
    }

    AddFloat(Caption_GateWidth, _("Default radius or gate width of the start zone for new tasks."),
             _T("%.1f %s"), _T("%.1f"), fixed(0.1), fixed(100), fixed(1.0), true, UnitGroup::DISTANCE,
             task_behaviour.sector_defaults.start_radius);

    AddSpacer();

    wp = AddEnum(_("Finish point"),
                 _("Default finish type for new tasks you create."),
                 this);
    if (wp) {
        const auto point_types = temptask.GetFactory().GetValidFinishTypes();
        DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
        dfe->EnableItemHelp(true);

        for (auto i = point_types.begin(), end = point_types.end();
                i != end; ++i) {
            const AbstractTaskFactory::LegalPointType type = *i;
            dfe->addEnumText(OrderedTaskPointName(type), (unsigned)type,
                             OrderedTaskPointDescription(type));
            if (type == task_behaviour.sector_defaults.finish_type)
                dfe->Set((unsigned)type);
        }
        wp->RefreshDisplay();
    }

    AddFloat(Caption_GateWidth, _("Default radius or gate width of the finish zone in new tasks."),
             _T("%.1f %s"), _T("%.1f"), fixed(0.1), fixed(100), fixed(1.0), true, UnitGroup::DISTANCE,
             task_behaviour.sector_defaults.finish_radius);

    AddSpacer();

    wp = AddEnum(_("Turn point"), _("Default turn point type for new tasks you create."));
    if (wp) {
        const auto point_types = temptask.GetFactory().GetValidIntermediateTypes();
        DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
        dfe->EnableItemHelp(true);

        for (auto i = point_types.begin(), end = point_types.end();
                i != end; ++i) {
            const AbstractTaskFactory::LegalPointType type = *i;
            dfe->addEnumText(OrderedTaskPointName(type), (unsigned)type,
                             OrderedTaskPointDescription(type));
            if (type == task_behaviour.sector_defaults.turnpoint_type) {
                dfe->Set((unsigned)type);
            }
        }
        wp->RefreshDisplay();
    }

    AddFloat(Caption_Radius, _("Default radius of turnpoint cylinders and sectors in new tasks."),
             _T("%.1f %s"), _T("%.1f"), fixed(0.1), fixed(100), fixed(1.0), true, UnitGroup::DISTANCE,
             task_behaviour.sector_defaults.turnpoint_radius);

    AddSpacer();

    wp = AddEnum(_("Task"), _("Default task type for new tasks you create."));
    if (wp) {
        const std::vector<TaskFactoryType> factory_types =
            temptask.GetFactoryTypes();
        DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
        dfe->EnableItemHelp(true);

        for (unsigned i = 0; i < factory_types.size(); i++) {
            dfe->addEnumText(OrderedTaskFactoryName(factory_types[i]),
                             (unsigned)factory_types[i], OrderedTaskFactoryDescription(
                                 factory_types[i]));
            if (factory_types[i] == task_behaviour.task_type_default)
                dfe->Set((unsigned)factory_types[i]);
        }
        wp->RefreshDisplay();
    }

    AddTime(_("AAT min. time"), _("Default AAT min. time for new AAT tasks."),
            60, 10 * 60 * 60, 60, (unsigned)task_behaviour.ordered_defaults.aat_min_time);

    AddTime(_("Optimisation margin"),
            _("Safety margin for AAT task optimisation.  Optimisation "
              "seeks to complete the task at the minimum time plus this margin time."),
            0, 30 * 60, 60, (unsigned)task_behaviour.optimise_targets_margin);
    SetExpertRow(AATTimeMargin);

    SetStartLabel();
    SetFinishLabel();
}
예제 #5
0
void
TaskDefaultsConfigPanel::Init(WndForm *_wf)
{
  assert(_wf != NULL);
  wf = _wf;
  WndProperty *wp;
  const SETTINGS_COMPUTER &settings_computer = XCSoarInterface::SettingsComputer();
  OrderedTask* temptask = protected_task_manager->task_blank();
  temptask->set_factory(TaskBehaviour::FACTORY_RT);


  wp = (WndProperty*)wf->FindByName(_T("prpStartType"));
  if (wp) {
    const AbstractTaskFactory::LegalPointVector point_types =
        temptask->get_factory().getValidStartTypes();
    DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->EnableItemHelp(true);

    for (unsigned i = 0; i < point_types.size(); i++) {
      dfe->addEnumText(OrderedTaskPointName(point_types[i]), (unsigned)point_types[i],
          OrderedTaskPointDescription(point_types[i]));
      if (point_types[i] == settings_computer.sector_defaults.start_type)
        dfe->Set((unsigned)point_types[i]);
    }
    wp->RefreshDisplay();
  }

  LoadFormProperty(*wf, _T("prpStartRadius"), ugDistance,
                   settings_computer.sector_defaults.start_radius);

  wp = (WndProperty*)wf->FindByName(_T("prpFinishType"));
  if (wp) {
    const AbstractTaskFactory::LegalPointVector point_types =
        temptask->get_factory().getValidFinishTypes();
    DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->EnableItemHelp(true);

    for (unsigned i = 0; i < point_types.size(); i++) {
      dfe->addEnumText(OrderedTaskPointName(point_types[i]), (unsigned)point_types[i],
          OrderedTaskPointDescription(point_types[i]));
      if (point_types[i] == settings_computer.sector_defaults.finish_type)
        dfe->Set((unsigned)point_types[i]);
    }
    wp->RefreshDisplay();
  }

  LoadFormProperty(*wf, _T("prpFinishRadius"), ugDistance,
                   settings_computer.sector_defaults.finish_radius);

  wp = (WndProperty*)wf->FindByName(_T("prpTurnpointType"));
  if (wp) {
    const AbstractTaskFactory::LegalPointVector point_types =
        temptask->get_factory().getValidIntermediateTypes();
    DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->EnableItemHelp(true);

    for (unsigned i = 0; i < point_types.size(); i++) {
      dfe->addEnumText(OrderedTaskPointName(point_types[i]),
          (unsigned)point_types[i],
          OrderedTaskPointDescription(point_types[i]));
      if (point_types[i] == settings_computer.sector_defaults.turnpoint_type) {
        dfe->Set((unsigned)point_types[i]);
      }
    }
    wp->RefreshDisplay();
  }

  LoadFormProperty(*wf, _T("prpTurnpointRadius"), ugDistance,
                   settings_computer.sector_defaults.turnpoint_radius);

  wp = (WndProperty*)wf->FindByName(_T("prpTaskType"));
  if (wp) {
    const std::vector<TaskBehaviour::Factory_t> factory_types =
        temptask->get_factory_types();
    DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
    dfe->EnableItemHelp(true);

    for (unsigned i = 0; i < factory_types.size(); i++) {
      dfe->addEnumText(OrderedTaskFactoryName(factory_types[i]),
          (unsigned)factory_types[i], OrderedTaskFactoryDescription(
              factory_types[i]));
      if (factory_types[i] == settings_computer.task_type_default)
        dfe->Set((unsigned)factory_types[i]);
    }
    wp->RefreshDisplay();
  }

  LoadFormProperty(*wf, _T("prpAATMinTime"),
                   (unsigned)(settings_computer.ordered_defaults.aat_min_time / 60));

  LoadFormProperty(*wf, _T("prpAATTimeMargin"),
                   (unsigned)(settings_computer.optimise_targets_margin / 60));

  delete temptask;
}
예제 #6
0
void
TaskPropertiesPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  AddTime(_("AAT min. time"), _("Minimum AAT task time in minutes."),
          0, 36000, 60, 180);

  AddFloat(_("Start max. speed"),
           _("Maximum speed allowed in start observation zone.  Set to 0 for no limit."),
           _T("%.0f %s"), _T("%.0f"),
           fixed_zero, fixed(300), fixed(5), false, fixed_zero);

  AddFloat(_("Start max. height"),
           _("Maximum height based on start height reference (AGL or MSL) while starting the task.  Set to 0 for no limit."),
           _T("%.0f %s"), _T("%.0f"),
           fixed_zero, fixed(10000), fixed(25), false, fixed_zero);

  static gcc_constexpr_data StaticEnumChoice start_max_height_ref_list[] = {
    { (unsigned)HeightReferenceType::AGL, N_("AGL"), N_("Reference AGL for start maximum height rule (above start point).") },
    { (unsigned)HeightReferenceType::MSL, N_("MSL"), N_("Reference MSL for start maximum height rule (above sea level).") },
    { 0 }
  };

  AddEnum(_("Start height ref."),
          _("Reference used for start max height rule\n"
            "[MSL] Reference is altitude above mean sea level\n"
            "[AGL] Reference is the height above the start point"),
          start_max_height_ref_list);

  AddFloat(_("Finish min. height"),
           _("Minimum height based on finish height reference (AGL or MSL) while finishing the task.  Set to 0 for no limit."),
           _T("%.0f %s"), _T("%.0f"),
           fixed_zero, fixed(10000), fixed(25), false, fixed_zero);

  static gcc_constexpr_data StaticEnumChoice finish_min_height_ref_list[] = {
    { (unsigned)HeightReferenceType::AGL, N_("AGL"), N_("Reference AGL for finish minimum height rule (above finish point).") },
    { (unsigned)HeightReferenceType::MSL, N_("MSL"), N_("Reference MSL for finish minimum height rule (above sea level).") },
    { 0 }
  };
  AddEnum(_("Finish height ref."),
          _("Reference used for finish min height rule\n"
            "[MSL] Reference is altitude above mean sea level\n"
            "[AGL] Reference is the height above the finish point"),
          finish_min_height_ref_list);

  AddBoolean(_("FAI start / finish rules"),
             _("If enabled, has no max start height or max start speed and requires the minimum height above ground for finish to be greater than 1000m below the start height."),
             false, this);

  DataFieldEnum *dfe = new DataFieldEnum(NULL);
  dfe->SetListener(this);
  dfe->EnableItemHelp(true);
  const std::vector<TaskFactoryType> factory_types =
    ordered_task->GetFactoryTypes();
  for (unsigned i = 0; i < factory_types.size(); i++) {
    dfe->addEnumText(OrderedTaskFactoryName(factory_types[i]),
                     (unsigned)factory_types[i],
                     OrderedTaskFactoryDescription(factory_types[i]));
    if (factory_types[i] == ordered_task->GetFactoryType())
      dfe->Set((unsigned)factory_types[i]);
  }
  Add(_("Task type"), _("Sets the behaviour for the current task."), dfe);
}