本文整理汇总了C++中OrderedTask::HasOptionalStarts方法的典型用法代码示例。如果您正苦于以下问题:C++ OrderedTask::HasOptionalStarts方法的具体用法?C++ OrderedTask::HasOptionalStarts怎么用?C++ OrderedTask::HasOptionalStarts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderedTask
的用法示例。
在下文中一共展示了OrderedTask::HasOptionalStarts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsFAITriangleApplicable
gcc_pure
static bool
IsFAITriangleApplicable(const OrderedTask &task)
{
return IsFAITriangleApplicable(task.GetFactoryType()) &&
!task.HasOptionalStarts() &&
// TODO: allow start on first leg
task.TaskSize() >= 2 && task.TaskSize() <= 4;
}
示例2: ReverseTask
void TaskEditPanel::ReverseTask()
{
if (ordered_task->TaskSize() < 2)
return;
const unsigned start_index = 0;
const unsigned finish_index = ordered_task->TaskSize() - 1;
const Waypoint start_wp = ordered_task->GetTaskPoint(start_index).GetWaypoint();
const Waypoint finish_wp = ordered_task->GetTaskPoint(finish_index).GetWaypoint();
if (start_wp.location != finish_wp.location) {
// swap start/finish TP if at different location but leave OZ type intact
ordered_task->Relocate(start_index, finish_wp);
ordered_task->Relocate(finish_index, start_wp);
// remove optional start points
while (ordered_task->HasOptionalStarts())
ordered_task->RemoveOptionalStart(0);
}
// reverse intermediate TPs order keeping the OZ type with the respective TP
unsigned length = ordered_task->TaskSize()-1;
for (unsigned i = 1; i < length - 1; ++i) {
const OrderedTaskPoint &otp = ordered_task->GetTaskPoint(length - 1);
if (!ordered_task->GetFactory().Insert(otp, i, false))
return;
if (!ordered_task->GetFactory().Remove(length, false))
return;
}
*task_modified = true;
ordered_task->ClearName();
ordered_task->GetFactory().CheckAddFinish();
ordered_task->UpdateStatsGeometry();
ordered_task->UpdateGeometry();
RefreshView();
}
示例3: PanelWidget
void
TaskPointWidget::RefreshView()
{
map.Invalidate();
OrderedTaskPoint &tp = ordered_task->GetPoint(active_index);
properties_dock.SetWidget(new PanelWidget());
ObservationZonePoint &oz = tp.GetObservationZone();
const bool is_fai_general =
ordered_task->GetFactoryType() == TaskFactoryType::FAI_GENERAL;
properties_widget = CreateObservationZoneEditWidget(oz, is_fai_general);
if (properties_widget != nullptr) {
properties_widget->SetListener(this);
properties_dock.SetWidget(properties_widget);
}
type_label.SetCaption(OrderedTaskPointName(ordered_task->GetFactory().GetType(tp)));
previous_button->SetEnabled(active_index > 0);
next_button->SetEnabled(active_index < (ordered_task->TaskSize() - 1));
optional_starts.SetVisible(active_index == 0);
if (!ordered_task->HasOptionalStarts())
optional_starts.SetCaption(_("Enable Alternate Starts"));
else {
StaticString<50> tmp;
tmp.Format(_T("%s (%d)"), _("Edit Alternates"),
ordered_task->GetOptionalStartPointCount());
optional_starts.SetCaption(tmp);
}
if (tp.GetType() == TaskPointType::AST) {
const ASTPoint &ast = (const ASTPoint &)tp;
score_exit.Show();
score_exit.SetState(ast.GetScoreExit());
} else
score_exit.Hide();
StaticString<100> name_prefix_buffer, type_buffer;
switch (tp.GetType()) {
case TaskPointType::START:
type_buffer = _("Start point");
name_prefix_buffer = _T("Start: ");
break;
case TaskPointType::AST:
type_buffer = _("Task point");
name_prefix_buffer.Format(_T("%d: "), active_index);
break;
case TaskPointType::AAT:
type_buffer = _("Assigned area point");
name_prefix_buffer.Format(_T("%d: "), active_index);
break;
case TaskPointType::FINISH:
type_buffer = _("Finish point");
name_prefix_buffer = _T("Finish: ");
break;
default:
gcc_unreachable();
}
dialog.SetCaption(type_buffer);
{
StaticString<100> buffer;
buffer.Format(_T("%s %s"), name_prefix_buffer.c_str(),
tp.GetWaypoint().name.c_str());
waypoint_name.SetCaption(buffer);
}
}