当前位置: 首页>>代码示例>>C++>>正文


C++ OrderedTask类代码示例

本文整理汇总了C++中OrderedTask的典型用法代码示例。如果您正苦于以下问题:C++ OrderedTask类的具体用法?C++ OrderedTask怎么用?C++ OrderedTask使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了OrderedTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Deserialise

void 
Deserialiser::Deserialise(OrderedTask &task)
{
  task.Clear();
  task.SetFactory(GetTaskFactoryType());
  task.Reset();

  OrderedTaskBehaviour beh = task.GetOrderedTaskBehaviour();
  Deserialise(beh);
  task.SetOrderedTaskBehaviour(beh);

  const DataNode::List children = node.ListChildrenNamed(_T("Point"));
  for (const auto &i : children) {
    std::unique_ptr<DataNode> point_node(i);
    Deserialiser pser(*point_node, waypoints);
    pser.DeserialiseTaskpoint(task);
  }
}
开发者ID:rjsikarwar,项目名称:XCSoar,代码行数:18,代码来源:Deserialiser.cpp

示例2: LoadTask2

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;
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:18,代码来源:TaskInfo.cpp

示例3: LoadTask

void
LoadTask(OrderedTask &task, const ConstDataNode &node,
         const Waypoints *waypoints)
{
  task.Clear();
  task.SetFactory(GetTaskFactoryType(node));
  task.Reset();

  OrderedTaskSettings beh = task.GetOrderedTaskSettings();
  Deserialise(beh, node);
  task.SetOrderedTaskSettings(beh);

  const auto children = node.ListChildrenNamed(_T("Point"));
  for (const auto &i : children) {
    std::unique_ptr<ConstDataNode> point_node(i);
    DeserialiseTaskpoint(task, *point_node, waypoints);
  }
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:18,代码来源:Deserialiser.cpp

示例4: pser

void 
Serialiser::deserialise(OrderedTask& data)
{
  data.clear();
  data.set_factory(task_factory_type());
  data.reset();

  OrderedTaskBehaviour beh = data.get_ordered_task_behaviour();
  deserialise(beh);
  data.set_ordered_task_behaviour(beh);

  DataNode* point_node;
  unsigned i=0;
  while ((point_node = m_node.get_child_by_name(_T("Point"),i)) != NULL) {
    Serialiser pser(*point_node);
    pser.deserialise_point(data);
    delete point_node;
    i++;
  }
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:20,代码来源:Serialiser.cpp

示例5:

bool
TaskPointWidget::ReadValues()
{
  OrderedTaskPoint &tp = ordered_task->GetPoint(active_index);

  if (tp.GetType() == TaskPointType::AST) {
    const bool new_score_exit = score_exit.GetState();

    ASTPoint &ast = (ASTPoint &)tp;

    if (new_score_exit != ast.GetScoreExit()) {
      ast.SetScoreExit(new_score_exit);
      ordered_task->ClearName();
      task_modified = true;
    }
  }

  return properties_widget == nullptr ||
    properties_widget->Save(task_modified);
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例6: GetIndexInTask

static int
GetIndexInTask(const OrderedTask &task, const Waypoint &waypoint)
{
  if (task.TaskSize() == 0)
    return -1;

  unsigned i = task.GetActiveIndex();
  if (i >= task.TaskSize())
    return -1;

  int TPindex = -1;
  for (unsigned i = task.TaskSize(); i--;) {
    const OrderedTaskPoint &tp = task.GetPoint(i);

    if (tp.GetWaypoint() == waypoint) {
      TPindex = i;
      break;
    }
  }
  return TPindex;
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:21,代码来源:MapTaskManager.cpp

示例7:

void 
TaskRenderer::Draw(const OrderedTask &task)
{
  tpv.SetBoundingBox(task.GetBoundingBox(screen_bounds));
  tpv.SetActiveIndex(task.GetActiveIndex());
  for (unsigned i = 0; i < 4; i++) {
    tpv.ResetIndex();

    if (i != TaskPointRenderer::LAYER_SYMBOLS &&
        i != TaskPointRenderer::LAYER_LEG) {
      tpv.SetModeOptional(true);

      for (const auto &tp : task.GetOptionalStartPoints())
        tpv.Draw(tp, (TaskPointRenderer::Layer)i);
    }

    tpv.SetModeOptional(false);
    for (const auto &tp : task.GetPoints())
      tpv.Draw(tp, (TaskPointRenderer::Layer)i);
  }
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:21,代码来源:TaskRenderer.cpp

示例8: RefreshView

void
TaskEditPanel::EditTaskPoint(unsigned ItemIndex)
{
  if (ItemIndex < ordered_task->TaskSize()) {
    if (dlgTaskPointShowModal(*ordered_task, ItemIndex)) {
      *task_modified = true;
      ordered_task->ClearName();
      ordered_task->UpdateGeometry();
      RefreshView();
    }
  } else if (!ordered_task->IsFull()) {

    OrderedTaskPoint* point = nullptr;
    AbstractTaskFactory &factory = ordered_task->GetFactory();
    const Waypoint* way_point =
      ShowWaypointListDialog(ordered_task->TaskSize() > 0
                             ? ordered_task->GetPoint(ordered_task->TaskSize() - 1).GetLocation()
                             : CommonInterface::Basic().location,
                        ordered_task, ItemIndex);
    if (!way_point)
      return;

    if (ItemIndex == 0) {
      point = (OrderedTaskPoint*)factory.CreateStart(*way_point);
    } else {
      point = (OrderedTaskPoint*)factory.CreateIntermediate(*way_point);
     }
    if (point == nullptr)
      return;

    if (factory.Append(*point, true)) {
      *task_modified = true;
      ordered_task->ClearName();
      ordered_task->UpdateGeometry();
      RefreshView();
    }

    delete point;
  }
}
开发者ID:Andy-1954,项目名称:XCSoar,代码行数:40,代码来源:TaskEditPanel.cpp

示例9:

void 
TaskRenderer::Draw(const OrderedTask &task)
{
  tpv.SetBoundingBox(task.GetBoundingBox(screen_bounds));
  tpv.SetActiveIndex(task.GetActiveIndex());
  for (unsigned i = 0; i < 4; i++) {
    tpv.ResetIndex();

    if (i != TaskPointRenderer::LAYER_SYMBOLS &&
        i != TaskPointRenderer::LAYER_LEG) {
      tpv.SetModeOptional(true);

      for (const auto &tp : task.GetOptionalStartPoints())
        tpv.Draw(tp, (TaskPointRenderer::Layer)i);
    }

    tpv.SetModeOptional(false);
    for (const auto &tp : task.GetPoints())
      tpv.Draw(tp, (TaskPointRenderer::Layer)i);
  }

  if (task.GetFactoryType() == TaskFactoryType::MAT) {
    // now draw MAT circles
    tpv.ResetIndex();
    tpv.SetModeOptional(false);

    for (const auto *i : task.GetMatPoints())
      tpv.Draw(*i, (TaskPointRenderer::Layer)2);
  }
}
开发者ID:rjsikarwar,项目名称:XCSoar,代码行数:30,代码来源:TaskRenderer.cpp

示例10: LoadTask

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;
}
开发者ID:,项目名称:,代码行数:22,代码来源:

示例11: AfterStartup

static void
AfterStartup()
{
  StartupLogFreeRamAndStorage();

#ifdef USE_LUA
  {
    Error error;
    const auto lua_path = LocalPath(_T("lua"));
    if (!Lua::StartFile(AllocatedPath::Build(lua_path, _T("init.lua")), error))
      LogError(error);
  }
#endif

  if (is_simulator()) {
    InputEvents::processGlideComputer(GCE_STARTUP_SIMULATOR);
  } else {
    InputEvents::processGlideComputer(GCE_STARTUP_REAL);
  }

  OrderedTask *defaultTask = LoadDefaultTask(CommonInterface::GetComputerSettings().task,
                                             &way_points);
  if (defaultTask) {
    {
      ScopeSuspendAllThreads suspend;
      defaultTask->CheckDuplicateWaypoints(way_points);
      way_points.Optimise();
    }

    protected_task_manager->TaskCommit(*defaultTask);
    delete defaultTask;
  }

  task_manager->Resume();

  InfoBoxManager::SetDirty();

  ForceCalculation();
}
开发者ID:nkgautam,项目名称:XCSoar,代码行数:39,代码来源:Startup.cpp

示例12: UpdateButtons

void
TaskEditPanel::RefreshView()
{
  UpdateButtons();

  dialog.InvalidateTaskView();

  unsigned length = ordered_task->TaskSize();
  if (!ordered_task->IsFull())
    ++length;
  GetList().SetLength(length);
  GetList().Invalidate();

  {
    TCHAR text[300];
    OrderedTaskSummary(ordered_task, text, false);
    summary.SetText(text);
  }

  if (GetList().IsVisible() && two_widgets != nullptr)
    two_widgets->UpdateLayout();
}
开发者ID:Andy-1954,项目名称:XCSoar,代码行数:22,代码来源:TaskEditPanel.cpp

示例13: OrderedTaskSave

bool
OrderedTaskSave(OrderedTask &task)
{
  TCHAR fname[69] = _T("");
  if (!TextEntryDialog(fname, 64, _("Enter a task name")))
    return false;

  const auto tasks_path = MakeLocalPath(_T("tasks"));

  _tcscat(fname, _T(".tsk"));
  task.SetName(StaticString<64>(fname));
  SaveTask(AllocatedPath::Build(tasks_path, fname), task);
  return true;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:14,代码来源:dlgTaskHelpers.cpp

示例14: SetPointType

/**
 * @return true if the task was modified
 */
static bool
SetPointType(OrderedTask &task, unsigned index,
             TaskPointFactoryType type)
{
  AbstractTaskFactory &factory = task.GetFactory();
  const auto &old_point = task.GetPoint(index);
  const auto current_type = factory.GetType(old_point);
  if (type == current_type)
    // no change
    return false;

  bool task_modified = false;

  auto point = factory.CreateMutatedPoint(old_point, type);
  if (point == nullptr)
    return false;

  if (factory.Replace(*point, index, true))
    task_modified = true;
  delete point;

  return task_modified;
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:26,代码来源:MutateTaskPointDialog.cpp

示例15: AfterStartup

static void
AfterStartup()
{
  StartupLogFreeRamAndStorage();

  CommonInterface::status_messages.Startup(true);

  if (is_simulator()) {
    InputEvents::processGlideComputer(GCE_STARTUP_SIMULATOR);
  } else {
    InputEvents::processGlideComputer(GCE_STARTUP_REAL);
  }

  const TaskFactoryType task_type_default =
    CommonInterface::GetComputerSettings().task.task_type_default;
  OrderedTask *defaultTask =
    protected_task_manager->TaskCreateDefault(&way_points, task_type_default);
  if (defaultTask) {
    {
      ScopeSuspendAllThreads suspend;
      defaultTask->CheckDuplicateWaypoints(way_points);
      way_points.Optimise();
    }

    protected_task_manager->TaskCommit(*defaultTask);
    delete defaultTask;
  }

  task_manager->Resume();

  CommonInterface::main_window->Fullscreen();
  InfoBoxManager::SetDirty();

  ForceCalculation();

  CommonInterface::status_messages.Startup(false);
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:37,代码来源:Startup.cpp


注:本文中的OrderedTask类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。