本文整理汇总了C++中TaskManager::GetOrderedTask方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskManager::GetOrderedTask方法的具体用法?C++ TaskManager::GetOrderedTask怎么用?C++ TaskManager::GetOrderedTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskManager
的用法示例。
在下文中一共展示了TaskManager::GetOrderedTask方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static void
DrawLegs(ChartRenderer &chart,
const TaskManager &task_manager,
const NMEAInfo& basic,
const DerivedInfo& calculated,
const bool task_relative)
{
const TaskStats &task_stats = calculated.ordered_task_stats;
if (!task_stats.start.task_started)
return;
const auto start_time = task_relative
? basic.time - task_stats.total.time_elapsed
: calculated.flight.takeoff_time;
const OrderedTask &task = task_manager.GetOrderedTask();
for (unsigned i = 0, n = task.TaskSize(); i < n; ++i) {
const OrderedTaskPoint &tp = task.GetTaskPoint(i);
if (!IsTaskLegVisible(tp))
continue;
auto x = tp.GetEnteredState().time - start_time;
if (x >= 0) {
x /= 3600;
chart.DrawLine(x, chart.GetYMin(), x, chart.GetYMax(),
ChartLook::STYLE_REDTHICK);
}
}
}
示例2: if
void
RenderTaskLegs(ChartRenderer &chart,
const TaskManager &task_manager,
const NMEAInfo& basic,
const DerivedInfo& calculated,
const double y)
{
const TaskStats &task_stats = calculated.ordered_task_stats;
if (!task_stats.start.task_started)
return;
TCHAR sTmp[5];
const OrderedTask &task = task_manager.GetOrderedTask();
for (unsigned i = 0, n = task.TaskSize(); i < n; ++i) {
const OrderedTaskPoint &tp = task.GetTaskPoint(i);
if (!IsTaskLegVisible(tp))
continue;
auto x = tp.GetEnteredState().time - calculated.flight.takeoff_time;
if (x >= 0) {
x /= 3600;
if (y>=0) {
if (i==0) {
chart.DrawBlankRectangle(chart.GetXMin(), chart.GetYMin(),
x, chart.GetYMax());
} else if (i+1 == task.TaskSize()) {
chart.DrawBlankRectangle(x, chart.GetYMin(),
chart.GetXMax(), chart.GetYMax());
}
chart.DrawLine(x, chart.GetYMin(), x, chart.GetYMax(),
ChartLook::STYLE_GRIDZERO);
}
if (y>=0) {
StringFormatUnsafe(sTmp, _T("%d"), i);
chart.DrawLabel(sTmp, x, chart.GetYMax()*y + chart.GetYMin()*(1-y));
}
}
}
}
示例3: switch
void
PrintHelper::taskmanager_print(const TaskManager &task,
const AircraftState &state)
{
switch (task.GetMode()) {
case TaskType::NONE:
break;
case TaskType::ABORT:
aborttask_print(*(const AbortTask *)task.GetActiveTask(), state);
break;
case TaskType::GOTO:
gototask_print(*(const GotoTask *)task.GetActiveTask(), state);
break;
case TaskType::ORDERED:
orderedtask_print(task.GetOrderedTask(), state);
break;
}
}
示例4: test_task_random_RT_AAT_FAI
bool test_task_random_RT_AAT_FAI(TaskManager& task_manager,
const Waypoints &waypoints,
const unsigned _num_points)
{
const Waypoint *wp;
OrderedTaskPoint *tp;
char tmp[255];
char tskType[20];
tskType[0] = '\0';
switch (rand() %3) {
case 0:
task_manager.SetFactory(TaskFactoryType::AAT);
strcpy(tskType,"AAT");
test_note("# creating random AAT task\n");
break;
case 1:
task_manager.SetFactory(TaskFactoryType::RACING);
strcpy(tskType,"RT");
test_note("# creating random RT task\n");
break;
case 2:
task_manager.SetFactory(TaskFactoryType::FAI_GENERAL);
strcpy(tskType,"FAI");
test_note("# creating random FAI GENERAL\n");
break;
}
AbstractTaskFactory &fact = task_manager.GetFactory();
//max points includes start & finish
const TaskFactoryConstraints &constraints =
task_manager.GetOrderedTask().GetFactoryConstraints();
const unsigned num_points_total =
std::max(constraints.min_points,
_num_points % constraints.max_points) + 1;
const unsigned num_int_points = num_points_total - 2;
test_note("# adding start\n");
wp = random_waypoint(waypoints);
if (wp) {
const TaskPointFactoryType s = GetRandomType(fact.GetStartTypes());
tp = fact.CreateStart(s,*wp);
if (!fact.Append(*tp,false)) {
return false;
}
delete tp;
}
for (unsigned i=0; i<num_int_points; i++) {
test_note("# adding intermediate\n");
wp = random_waypoint(waypoints);
if (wp) {
const TaskPointFactoryType s = GetRandomType(fact.GetIntermediateTypes());
tp = fact.CreateIntermediate(s,*wp);
if (!fact.Append(*tp,false)) {
return false;
}
delete tp;
}
}
test_note("# adding finish\n");
wp = random_waypoint(waypoints);
if (wp) {
const TaskPointFactoryType s = GetRandomType(fact.GetFinishTypes());
tp = fact.CreateFinish(s,*wp);
if (!fact.Append(*tp,false)) {
return false;
}
delete tp;
}
fact.UpdateStatsGeometry();
test_note("# validating task..\n");
if (!fact.Validate()) {
return false;
}
if (task_manager.GetOrderedTask().GetFactoryType()
== TaskFactoryType::FAI_GENERAL)
{
test_note("# checking OZs for FAI General..\n");
if (!fact.ValidateFAIOZs())
return false;
}
if (task_manager.GetOrderedTask().GetFactoryType()
== TaskFactoryType::MAT)
{
test_note("# checking OZs for MAT General..\n");
if (!fact.ValidateMATOZs())
return false;
}
task_manager.Resume();
//.........这里部分代码省略.........
示例5: test_task_type_manip
bool test_task_type_manip(TaskManager& task_manager,
const Waypoints &waypoints, unsigned n_points)
{
if (!test_task_random_RT_AAT_FAI(task_manager, waypoints, n_points))
return false;
switch (rand() %4) {
case 0:
task_manager.SetFactory(TaskFactoryType::AAT);
test_note("# switched FACTORY TYPE to AAT\n");
break;
case 1:
task_manager.SetFactory(TaskFactoryType::RACING);
test_note("# switched FACTORY TYPE to RT\n");
break;
case 2:
task_manager.SetFactory(TaskFactoryType::FAI_GENERAL);
test_note("# switched FACTORY TYPE to FAI GENERAL\n");
break;
case 3:
task_manager.SetFactory(TaskFactoryType::MAT);
test_note("# switched FACTORY TYPE to MAT\n");
break;
default:
test_note("# unknown task type\n");
}
AbstractTaskFactory &fact = task_manager.GetFactory();
fact.MutateTPsToTaskType();
fact.UpdateStatsGeometry();
test_note("# checking mutated start..\n");
if (!fact.IsValidStartType(fact.GetType(task_manager.GetOrderedTask().GetTaskPoint(0))))
return false;
char tmp[255];
sprintf(tmp, "# checking mutated intermediates. task_size():%d..\n",
task_manager.TaskSize());
test_note(tmp);
for (unsigned i = 1; i < (task_manager.TaskSize() - 1); i++) {
sprintf(tmp, "# checking mutated intermediate point %d..\n", i);
test_note(tmp);
if (!fact.IsValidIntermediateType(fact.GetType(task_manager.GetOrderedTask().GetTaskPoint(i))))
return false;
}
test_note("# checking mutated finish..\n");
if (!fact.IsValidFinishType(
fact.GetType(task_manager.GetOrderedTask().GetTaskPoint(task_manager.TaskSize() - 1))))
return false;
test_note("# validating task..\n");
if (!fact.Validate()) {
return false;
}
test_note("# checking task..\n");
if (!task_manager.CheckOrderedTask()) {
return false;
}
if (task_manager.GetOrderedTask().GetFactoryType() ==
TaskFactoryType::FAI_GENERAL) {
test_note("# checking OZs for FAI task..\n");
if (!fact.ValidateFAIOZs())
return false;
}
if (task_manager.GetOrderedTask().GetFactoryType() ==
TaskFactoryType::MAT) {
test_note("# checking OZs for MAT task..\n");
if (!fact.ValidateMATOZs())
return false;
}
return true;
}