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


C++ OrderedTaskPoint::Clone方法代码示例

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


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

示例1: SetNeighbours

bool 
OrderedTask::Replace(const OrderedTaskPoint &new_tp, const unsigned position)
{
  if (position >= task_points.size())
    return false;

  if (task_points[position]->Equals(new_tp))
    // nothing to do
    return true;

  /* is the new_tp allowed in this context? */
  if ((position > 0 && !new_tp.IsPredecessorAllowed()) ||
      (position + 1 < task_points.size() && !new_tp.IsSuccessorAllowed()))
    return false;

  delete task_points[position];
  task_points[position] = new_tp.Clone(task_behaviour, ordered_behaviour);

  if (position)
    SetNeighbours(position - 1);

  SetNeighbours(position);
  if (position + 1 < task_points.size())
    SetNeighbours(position + 1);

  UpdateGeometry();
  return true;
}
开发者ID:damianob,项目名称:xcsoar,代码行数:28,代码来源:OrderedTask.cpp

示例2: Append

bool 
OrderedTask::Insert(const OrderedTaskPoint &new_tp, const unsigned position)
{
  if (position >= task_points.size())
    return Append(new_tp);

  if (/* is the new_tp allowed in this context? */
      (position > 0 && !new_tp.IsPredecessorAllowed()) ||
      !new_tp.IsSuccessorAllowed() ||
      /* can a tp be inserted at this position? */
      (position > 0 && !task_points[position - 1]->IsSuccessorAllowed()) ||
      !task_points[position]->IsPredecessorAllowed())
    return false;

  if (active_task_point >= position)
    active_task_point++;

  task_points.insert(task_points.begin() + position,
                     new_tp.Clone(task_behaviour, ordered_behaviour));

  if (position)
    SetNeighbours(position - 1);

  SetNeighbours(position);
  SetNeighbours(position + 1);

  UpdateGeometry();
  return true;
}
开发者ID:damianob,项目名称:xcsoar,代码行数:29,代码来源:OrderedTask.cpp

示例3: SetNeighbours

bool
OrderedTask::AppendOptionalStart(const OrderedTaskPoint &new_tp)
{
  optional_start_points.push_back(new_tp.Clone(task_behaviour,
                                               ordered_settings));
  if (task_points.size() > 1)
    SetNeighbours(0);
  return true;
}
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:9,代码来源:OrderedTask.cpp

示例4: SetNeighbours

bool
OrderedTask::Append(const OrderedTaskPoint &new_tp)
{
  if (/* is the new_tp allowed in this context? */
      (!task_points.empty() && !new_tp.IsPredecessorAllowed()) ||
      /* can a tp be appended after the last one? */
      (task_points.size() >= 1 &&
       !task_points[task_points.size() - 1]->IsSuccessorAllowed()))
    return false;

  task_points.push_back(new_tp.Clone(task_behaviour, ordered_settings));
  if (task_points.size() > 1)
    SetNeighbours(task_points.size() - 2);
  else {
    // give it a value when we have one tp so it is not uninitialised
    last_min_location = new_tp.GetLocation();
  }

  SetNeighbours(task_points.size() - 1);
  return true;
}
开发者ID:EkzoMan,项目名称:XCSoar,代码行数:21,代码来源:OrderedTask.cpp


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