Beispiel #1
0
static OrderedTask *
LoadTask2(const TCHAR *path, const TaskBehaviour &task_behaviour)
{
  OrderedTask *task = LoadTask(path, task_behaviour);
  if (task == nullptr) {
    fprintf(stderr, "Failed to parse XML\n");
    return nullptr;
  }

  task->UpdateGeometry();
  if (!task->CheckTask()) {
    fprintf(stderr, "Failed to load task from XML\n");
    delete task;
    return NULL;
  }

  return task;
}
Beispiel #2
0
static OrderedTask *
LoadTask(const TCHAR *path, const TaskBehaviour &task_behaviour)
{
  DataNode *node = DataNodeXML::Load(path);
  if (node == NULL) {
    fprintf(stderr, "Failed to parse XML\n");
    return NULL;
  }

  Deserialiser des(*node);
  OrderedTask *task = new OrderedTask(task_behaviour);
  des.Deserialise(*task);
  delete node;

  if (!task->CheckTask()) {
    fprintf(stderr, "Failed to load task from XML\n");
    delete task;
    return NULL;
  }

  return task;
}
Beispiel #3
0
void
PrintHelper::orderedtask_print(const OrderedTask &task,
                               const AircraftState &state)
{
    abstracttask_print(task, state);
    if (!task.CheckTask())
        return;

    std::ofstream fi("output/results/res-isolines.txt");
    for (unsigned i = 0; i < task.TaskSize(); ++i) {
        const OrderedTaskPoint &tp = task.GetPoint(i);
        fi << "## point " << i << "\n";
        if (tp.GetType() == TaskPointType::AAT) {
            aatpoint_print(fi, (const AATPoint &)tp, state,
                           task.GetTaskProjection(), 1);
        } else {
            orderedtaskpoint_print(fi, tp, state, 1);
        }
        fi << "\n";
    }

    std::ofstream f1("output/results/res-task.txt");

    f1 << "#### Task points\n";
    for (unsigned i = 0; i < task.TaskSize(); ++i) {
        f1 << "## point " << i << " ###################\n";
        const OrderedTaskPoint &tp = task.GetPoint(i);
        if (tp.GetType() == TaskPointType::AAT) {
            aatpoint_print(f1, (const AATPoint &)tp, state,
                           task.GetTaskProjection(), 0);
        } else {
            orderedtaskpoint_print(f1, tp, state, 0);
        }
        f1 << "\n";
    }

    std::ofstream f5("output/results/res-ssample.txt");
    f5 << "#### Task sampled points\n";
    for (unsigned i =0 ; i < task.TaskSize(); ++i) {
        const OrderedTaskPoint &tp = task.GetPoint(i);
        f5 << "## point " << i << "\n";
        sampledtaskpoint_print_samples(f5, tp, state);
        f5 << "\n";
    }

    std::ofstream f2("output/results/res-max.txt");
    f2 << "#### Max task\n";
    for (unsigned i = 0; i < task.TaskSize(); ++i) {
        const OrderedTaskPoint &tp = task.GetPoint(i);
        f2 << tp.GetLocationMax().longitude << " "
           << tp.GetLocationMax().latitude << "\n";
    }

    std::ofstream f3("output/results/res-min.txt");
    f3 << "#### Min task\n";
    for (unsigned i = 0; i < task.TaskSize(); ++i) {
        const OrderedTaskPoint &tp = task.GetPoint(i);
        f3 << tp.GetLocationMin().longitude << " "
           << tp.GetLocationMin().latitude << "\n";
    }

    std::ofstream f4("output/results/res-rem.txt");
    f4 << "#### Remaining task\n";
    for (unsigned i = 0; i < task.TaskSize(); ++i) {
        const OrderedTaskPoint &tp = task.GetPoint(i);
        f4 << tp.GetLocationRemaining().longitude << " "
           << tp.GetLocationRemaining().latitude << "\n";
    }
}
Beispiel #4
0
 /**
  * Check whether ordered task is valid
  *
  * @return True if task is valid
  */
 gcc_pure
 bool CheckOrderedTask() const {
     return task_ordered.CheckTask();
 }