• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Waypoints类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Replace

void
OrderedTask::CheckDuplicateWaypoints(Waypoints& waypoints,
                                     OrderedTaskPointVector& points,
                                     const bool is_task)
{
  for (auto begin = points.cbegin(), end = points.cend(), i = begin;
       i != end; ++i) {
    auto wp = waypoints.CheckExistsOrAppend((*i)->GetWaypointPtr());

    const OrderedTaskPoint *new_tp =
      (*i)->Clone(task_behaviour, ordered_settings, std::move(wp));
    if (is_task)
      Replace(*new_tp, std::distance(begin, i));
    else
      ReplaceOptionalStart(*new_tp, std::distance(begin, i));
    delete new_tp;
  }
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:18,代码来源:OrderedTask.cpp


示例2: FillLastUsedList

static void
FillLastUsedList(WaypointSelectInfoVector &list,
                 const std::list<unsigned int> &last_used_ids,
                 const Waypoints &waypoints, const GeoPoint location)
{
  list.clear();

  if (last_used_ids.empty())
    return;

  for (auto it = last_used_ids.rbegin(); it != last_used_ids.rend(); it++) {
    const Waypoint* waypoint = waypoints.LookupId(*it);
    if (waypoint == NULL)
      continue;

    list.push_back(*waypoint, location);
  }
}
开发者ID:mobotics,项目名称:XCSoar,代码行数:18,代码来源:dlgWaypointSelect.cpp


示例3: test_copy

unsigned test_copy(Waypoints& waypoints)
{
    const Waypoint *r = waypoints.lookup_id(5);
    if (!r) {
        return false;
    }
    unsigned size_old = waypoints.size();
    Waypoint wp = *r;
    wp.id = waypoints.size()+1;
    waypoints.append(wp);
    waypoints.optimise();
    unsigned size_new = waypoints.size();
    return (size_new == size_old+1);
}
开发者ID:,项目名称:,代码行数:14,代码来源:


示例4: TestCopy

static unsigned
TestCopy(Waypoints& waypoints)
{
  const WaypointPtr wp = waypoints.LookupId(5);
  if (!wp)
    return false;

  unsigned size_old = waypoints.size();
  Waypoint wp_copy = *wp;
  wp_copy.id = waypoints.size() + 1;
  waypoints.Append(std::move(wp_copy));
  waypoints.Optimise();
  unsigned size_new = waypoints.size();
  return (size_new == size_old + 1);
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:15,代码来源:TestWaypoints.cpp


示例5: LogStartUp

void
XCSoarInterface::AfterStartup()
{
  LogStartUp(_T("ProgramStarted = 3"));
  StartupLogFreeRamAndStorage();

  status_messages.Startup(true);

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

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

  task_manager->Resume();

  main_window.Fullscreen();
  InfoBoxManager::SetDirty();

  TriggerGPSUpdate();

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


示例6: TestLookups

static void
TestLookups(const Waypoints &waypoints, const GeoPoint &center)
{
  WaypointPtr waypoint;

  ok1((waypoint = waypoints.LookupId(0)) == NULL);
  ok1((waypoint = waypoints.LookupId(1)) != NULL);
  ok1(waypoint->original_id == 0);
  ok1((waypoint = waypoints.LookupId(151)) != NULL);
  ok1(waypoint->original_id == 150);
  ok1((waypoint = waypoints.LookupId(152)) == NULL);
  ok1((waypoint = waypoints.LookupId(160)) == NULL);

  ok1((waypoint = waypoints.LookupLocation(center, fixed(0))) != NULL);
  ok1(waypoint->original_id == 0);

  ok1((waypoint = waypoints.LookupName(_T("Waypoint #5"))) != NULL);
  ok1(waypoint->original_id == 4);

  ok1((waypoint = waypoints.LookupLocation(waypoint->location, fixed(10000))) != NULL);
  ok1(waypoint->original_id == 4);
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:22,代码来源:TestWaypoints.cpp


示例7: main

int main(int argc, char** argv)
{
  if (!parse_args(argc,argv)) {
    return 0;
  }

  plan_tests(16);

  Waypoints waypoints;

  ok(setup_waypoints(waypoints),"waypoint setup",0);

  unsigned size = waypoints.size();

  ok(test_lookup(waypoints,3),"waypoint lookup",0);
  ok(!test_lookup(waypoints,5000),"waypoint bad lookup",0);
  ok(test_nearest(waypoints),"waypoint nearest",0);
  ok(test_nearest_landable(waypoints),"waypoint nearest landable",0);
  ok(test_location(waypoints,true),"waypoint location good",0);
  ok(test_location(waypoints,false),"waypoint location bad",0);
  ok(test_range(waypoints,100)==1,"waypoint visit range 100m",0);
  ok(test_radius(waypoints,100)==1,"waypoint radius 100m",0);
  ok(test_range(waypoints,500000)== waypoints.size(),"waypoint range 500000m",0);
  ok(test_radius(waypoints,25000)<= test_range(waypoints,25000),"waypoint radius<range",0);

  // test clear
  waypoints.clear();
  ok(waypoints.size()==0,"waypoint clear",0);
  setup_waypoints(waypoints);
  ok(size == waypoints.size(),"waypoint setup after clear",0);

  ok(test_copy(waypoints),"waypoint copy",0);

  ok(test_erase(waypoints,3),"waypoint erase",0);
  ok(test_replace(waypoints,4),"waypoint replace",0);

  return exit_status();
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:38,代码来源:test_waypoints.cpp


示例8: TestGetNearest

static void
TestGetNearest(const Waypoints &waypoints, const GeoPoint &center)
{
  WaypointPtr waypoint;
  GeoPoint near = GeoVector(fixed(250), Angle::Degrees(15)).EndPoint(center);
  GeoPoint far = GeoVector(fixed(750), Angle::Degrees(15)).EndPoint(center);
  GeoPoint further = GeoVector(fixed(4200), Angle::Degrees(48)).EndPoint(center);

  ok1((waypoint = waypoints.GetNearest(center, fixed(1))) != NULL);
  ok1(waypoint->original_id == 0);

  ok1((waypoint = waypoints.GetNearest(center, fixed(10000))) != NULL);
  ok1(waypoint->original_id == 0);

  ok1((waypoint = waypoints.GetNearest(near, fixed(1))) == NULL);

  ok1((waypoint = waypoints.GetNearest(near, fixed(10000))) != NULL);
  ok1(waypoint->original_id == 0);

  ok1((waypoint = waypoints.GetNearest(far, fixed(1))) == NULL);

  ok1((waypoint = waypoints.GetNearest(far, fixed(10000))) != NULL);
  ok1(waypoint->original_id == 1);

  ok1((waypoint = waypoints.GetNearestLandable(center, fixed(1))) != NULL);
  ok1(waypoint->original_id == 0);

  ok1((waypoint = waypoints.GetNearestLandable(center, fixed(10000))) != NULL);
  ok1(waypoint->original_id == 0);

  ok1((waypoint = waypoints.GetNearestLandable(further, fixed(1))) == NULL);

  ok1((waypoint = waypoints.GetNearestLandable(further, fixed(10000))) != NULL);
  ok1(waypoint->original_id == 3);

  ok1((waypoint = waypoints.GetNearestIf(center, fixed(1), OriginalIDAbove5)) == NULL);

  ok1((waypoint = waypoints.GetNearestIf(center, fixed(10000), OriginalIDAbove5)) != NULL);
  ok1(waypoint->original_id == 6);
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:40,代码来源:TestWaypoints.cpp


示例9: test_task_mat

static bool
test_task_mat(TaskManager &task_manager, const Waypoints &waypoints)
{
    task_manager.SetFactory(TaskFactoryType::MAT);
    AbstractTaskFactory &fact = task_manager.GetFactory();
    const Waypoint *wp;

    task_report(task_manager, "# adding start\n");
    wp = waypoints.LookupId(1);
    if (wp) {
        OrderedTaskPoint *tp = fact.CreateStart(*wp);
        if (!fact.Append(*tp,false)) {
            return false;
        }
        delete tp;
    }

    task_manager.SetActiveTaskPoint(0);
    task_manager.Resume();

    task_report(task_manager, "# adding intermediate\n");
    wp = waypoints.LookupId(2);
    if (wp) {
        OrderedTaskPoint* tp = fact.CreateIntermediate(TaskPointFactoryType::MAT_CYLINDER,*wp);
        if (!fact.Append(*tp,false)) {
            return false;
        }
        delete tp;
    }

    task_report(task_manager, "# adding intermediate\n");
    wp = waypoints.LookupId(3);
    if (wp) {
        OrderedTaskPoint* tp = fact.CreateIntermediate(TaskPointFactoryType::MAT_CYLINDER,*wp);
        if (!fact.Append(*tp,false)) {
            return false;
        }
        delete tp;
    }

    task_report(task_manager, "# adding finish\n");
    wp = waypoints.LookupId(1);
    if (wp) {
        OrderedTaskPoint *tp = fact.CreateFinish(*wp);
        if (!fact.Append(*tp,false)) {
            return false;
        }
        delete tp;
    }

    fact.UpdateStatsGeometry();

    task_report(task_manager, "# checking task..\n");
    if (!fact.Validate()) {
        return false;
    }

    if (!task_manager.CheckOrderedTask()) {
        return false;
    }
    return true;
}
开发者ID:j-konopka,项目名称:XCSoar-TE,代码行数:62,代码来源:harness_task.cpp


示例10: test_task_aat

bool test_task_aat(TaskManager& task_manager,
                   const Waypoints &waypoints)
{
    task_manager.SetFactory(TaskFactoryType::AAT);
    AbstractTaskFactory &fact = task_manager.GetFactory();
    const Waypoint *wp;

    task_report(task_manager, "# adding start\n");
    wp = waypoints.LookupId(1);
    if (wp) {
        OrderedTaskPoint *tp = fact.CreateStart(*wp);
        if (!fact.Append(*tp,false)) {
            return false;
        }
        delete tp;
    }

    task_manager.SetActiveTaskPoint(0);
    task_manager.Resume();

    task_report(task_manager, "# adding intermediate\n");
    wp = waypoints.LookupId(2);
    if (wp) {
        OrderedTaskPoint* tp = fact.CreateIntermediate(TaskPointFactoryType::AAT_CYLINDER,*wp);
        if (tp->GetObservationZone().GetShape() == ObservationZone::Shape::CYLINDER) {
            CylinderZone &cz = (CylinderZone &)tp->GetObservationZone();
            cz.SetRadius(fixed(30000.0));
        }
        if (!fact.Append(*tp,false)) {
            return false;
        }
        delete tp;
    }

    task_report(task_manager, "# adding intermediate\n");
    wp = waypoints.LookupId(3);
    if (wp) {
        OrderedTaskPoint* tp = fact.CreateIntermediate(TaskPointFactoryType::AAT_CYLINDER,*wp);
        if (tp->GetObservationZone().GetShape() == ObservationZone::Shape::CYLINDER) {
            CylinderZone &cz = (CylinderZone &)tp->GetObservationZone();
            cz.SetRadius(fixed(40000.0));
        }
        if (!fact.Append(*tp,false)) {
            return false;
        }
        delete tp;
    }

    task_report(task_manager, "# adding finish\n");
    wp = waypoints.LookupId(1);
    if (wp) {
        OrderedTaskPoint *tp = fact.CreateFinish(*wp);
        if (!fact.Append(*tp,false)) {
            return false;
        }
        delete tp;
    }

    fact.UpdateStatsGeometry();

    task_report(task_manager, "# checking task..\n");
    if (!fact.Validate()) {
        return false;
    }

    if (!task_manager.CheckOrderedTask()) {
        return false;
    }
    return true;
}
开发者ID:j-konopka,项目名称:XCSoar-TE,代码行数:70,代码来源:harness_task.cpp


示例11: test_task_manip

bool test_task_manip(TaskManager& task_manager,
                     const Waypoints &waypoints)
{
    if (!test_task_mixed(task_manager, waypoints)) {
        return false;
    }
    AbstractTaskFactory &fact = task_manager.GetFactory();

    task_report(task_manager, "# removing tp 2\n");
    if (!fact.Remove(2)) {
        return false;
    }

    task_report(task_manager, "# removing tp 0\n");
    if (!fact.Remove(0)) {
        return false;
    }

    task_report(task_manager, "# removing tp -1 (illegal)\n");
    if (fact.Remove(0-1)) {
        return false;
    }

    task_report(task_manager, "# removing tp 50 (illegal)\n");
    if (fact.Remove(50)) {
        return false;
    }

    OrderedTaskPoint *tp;
    const Waypoint *wp;

    task_report(task_manager, "# inserting at 3\n");
    wp = waypoints.LookupId(3);
    if (wp) {
        tp = fact.CreateIntermediate(TaskPointFactoryType::AST_CYLINDER,*wp);
        if (!fact.Insert(*tp,3)) return false;
        delete tp;
    }

    task_report(task_manager, "# auto-replacing at 2 (no morph)\n");
    wp = waypoints.LookupId(9);
    if (wp) {
        tp = fact.CreateIntermediate(TaskPointFactoryType::AST_CYLINDER,*wp);
        if (!fact.Replace(*tp,2)) return false;
        delete tp;
    }

    task_report(task_manager, "# auto-replacing at 2 (morph)\n");
    wp = waypoints.LookupId(9);
    if (wp) {
        tp = fact.CreateStart(*wp);
        if (!fact.Replace(*tp,2)) return false;
        delete tp;
    }

    task_report(task_manager, "# auto-replacing at 0 (morph this)\n");
    wp = waypoints.LookupId(12);
    if (wp) {
        tp = fact.CreateIntermediate(TaskPointFactoryType::AST_CYLINDER,*wp);
        if (!fact.Replace(*tp,0)) return false;
        delete tp;
    }

    task_report(task_manager, "# auto-replacing at end (morph this)\n");
    wp = waypoints.LookupId(14);
    if (wp) {
        tp = fact.CreateIntermediate(TaskPointFactoryType::AST_CYLINDER,*wp);
        if (!fact.Replace(*tp,task_manager.TaskSize()-1)) return false;
        delete tp;
    }

    task_report(task_manager, "# removing finish point\n");
    if (!fact.Remove(task_manager.TaskSize()-1)) {
        return false;
    }

    task_report(task_manager, "# inserting at 50 (equivalent to append)\n");
    wp = waypoints.LookupId(8);
    if (wp) {
        tp = fact.CreateFinish(*wp);
        if (!fact.Insert(*tp,50)) return false;
        delete tp;
    }

    task_report(task_manager, "# inserting at 0 (morph this)\n");
    wp = waypoints.LookupId(3);
    if (wp) {
        tp = fact.CreateFinish(*wp);
        if (!fact.Insert(*tp,0)) return false;
        delete tp;
    }

    task_report(task_manager, "# inserting at 2 (morph this)\n");
    wp = waypoints.LookupId(4);
    if (wp) {
        tp = fact.CreateStart(*wp);
        if (!fact.Insert(*tp,2)) return false;
        delete tp;
    }

//.........这里部分代码省略.........
开发者ID:j-konopka,项目名称:XCSoar-TE,代码行数:101,代码来源:harness_task.cpp


示例12: test_task_mixed

bool test_task_mixed(TaskManager& task_manager,
                     const Waypoints &waypoints)
{
  const TaskProjection &projection =
    task_manager.get_ordered_task().get_task_projection();

  OrderedTaskPoint *tp;
  const Waypoint *wp;

  task_manager.set_factory(TaskBehaviour::FACTORY_MIXED);
  AbstractTaskFactory &fact = task_manager.get_factory();

  task_report(task_manager, "# adding start\n");
  wp = waypoints.lookup_id(1);
  if (wp) {
    tp = fact.createStart(AbstractTaskFactory::START_LINE,*wp);
    if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
      CylinderZone *cz = (CylinderZone *)tp->get_oz();
      cz->setRadius(fixed(5000.0));
      tp->update_oz(projection);
    }
    if (!fact.append(*tp,false)) return false;
    delete tp;
  } else {
    return false;
  }

  task_manager.setActiveTaskPoint(0);
  task_manager.resume();

  task_report(task_manager, "# adding intermdiate\n");
  wp = waypoints.lookup_id(2);
  if (wp) {
    tp = fact.createIntermediate(AbstractTaskFactory::AST_CYLINDER,*wp);
    if (!fact.append(*tp,false)) return false;
    delete tp;
  } else {
    return false;
  }

  task_report(task_manager, "# adding intermdiate\n");
  wp = waypoints.lookup_id(3);
  if (wp) {
    tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
    if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
      CylinderZone *cz = (CylinderZone *)tp->get_oz();
      cz->setRadius(fixed(30000.0));
      tp->update_oz(projection);
    }
    if (!fact.append(*tp,false)) return false;
    delete tp;
  } else {
    return false;
  }

  task_report(task_manager, "# adding intermediate\n");
  wp = waypoints.lookup_id(4);
  if (wp) {
    tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
    if (!fact.append(*tp,false)) return false;
    delete tp;
  } else {
    return false;
  }

  task_report(task_manager, "# adding intermediate\n");
  wp = waypoints.lookup_id(5);
  if (wp) {
    tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
    if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
      CylinderZone *cz = (CylinderZone *)tp->get_oz();
      cz->setRadius(fixed(30000.0));
      tp->update_oz(projection);
    }
    if (!fact.append(*tp,false)) return false;
    delete tp;
  } else {
    return false;
  }

  task_report(task_manager, "# adding finish\n");
  wp = waypoints.lookup_id(1);
  if (wp) {
    tp = fact.createFinish(AbstractTaskFactory::FINISH_LINE,*wp);
    if (!fact.append(*tp,false)) return false;
    delete tp;
  } else {
    return false;
  }

  task_report(task_manager, "# checking task\n");
  if (!fact.validate()) {
    return false;
  }

  if (!task_manager.check_ordered_task()) {
    return false;
  }
  return true;
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:100,代码来源:harness_task.cpp


示例13: SetupWaypoints

/** 
 * Initialises waypoints with random and non-random waypoints
 * for testing
 *
 * @param waypoints waypoints class to add waypoints to
 */
bool SetupWaypoints(Waypoints &waypoints, const unsigned n)
{
  Waypoint wp = waypoints.Create(GeoPoint(Angle::Zero(),
                                          Angle::Zero()));
  wp.type = Waypoint::Type::AIRFIELD;
  wp.elevation = fixed(0.25);
  waypoints.Append(std::move(wp));

  wp = waypoints.Create(GeoPoint(Angle::Zero(),
                                 Angle::Degrees(1)));
  wp.type = Waypoint::Type::AIRFIELD;
  wp.elevation = fixed(0.25);
  waypoints.Append(std::move(wp));

  wp = waypoints.Create(GeoPoint(Angle::Degrees(1),
                                 Angle::Degrees(1)));
  wp.name = _T("Hello");
  wp.type = Waypoint::Type::AIRFIELD;
  wp.elevation = fixed(0.5);
  waypoints.Append(std::move(wp));

  wp = waypoints.Create(GeoPoint(Angle::Degrees(0.8),
                                 Angle::Degrees(0.5)));
  wp.name = _T("Unk");
  wp.type = Waypoint::Type::AIRFIELD;
  wp.elevation = fixed(0.25);
  waypoints.Append(std::move(wp));

  wp = waypoints.Create(GeoPoint(Angle::Degrees(1),
                                 Angle::Zero()));
  wp.type = Waypoint::Type::AIRFIELD;
  wp.elevation = fixed(0.25);
  waypoints.Append(std::move(wp));

  wp = waypoints.Create(GeoPoint(Angle::Zero(),
                                 Angle::Degrees(0.23)));
  wp.type = Waypoint::Type::AIRFIELD;
  wp.elevation = fixed(0.25);
  waypoints.Append(std::move(wp));

  for (unsigned i=0; i<(unsigned)std::max((int)n-6,0); i++) {
    int x = rand()%1200-100;
    int y = rand()%1200-100;
    double z = rand()% std::max(terrain_height,1);
    wp = waypoints.Create(GeoPoint(Angle::Degrees(x / 1000.0),
                                   Angle::Degrees(y / 1000.0)));
    wp.type = Waypoint::Type::NORMAL;
    wp.elevation = fixed(z);
    waypoints.Append(std::move(wp));
  }
  waypoints.Optimise();

  if (verbose) {
    Directory::Create(Path(_T("output/results")));
    std::ofstream fin("output/results/res-wp-in.txt");
    for (unsigned i=1; i<=waypoints.size(); i++) {
      const Waypoint *wpt = waypoints.LookupId(i);
      if (wpt != NULL)
        fin << *wpt;
    }
  }
  return true;
}
开发者ID:Andy-1954,项目名称:XCSoar,代码行数:69,代码来源:harness_waypoints.cpp


示例14: test_replay_retrospective

static bool
test_replay_retrospective()
{
  Directory::Create(_T("output/results"));
  std::ofstream f("output/results/res-sample.txt");

  Waypoints waypoints;
  WaypointReader w(waypoint_file.c_str(), 0);
  if (!ok1(!w.Error())) {
    printf("# waypoint file %s\n", waypoint_file.c_str());
    skip(2, 0, "opening waypoint file failed");
    return false;
  }

  NullOperationEnvironment operation;
  if(!ok1(w.Parse(waypoints, operation))) {
    skip(1, 0, "parsing waypoint file failed");
    return false;
  }

  waypoints.Optimise();

  ok1(!waypoints.IsEmpty());

  Retrospective retro(waypoints);

  retro.search_range = range_threshold;
  retro.angle_tolerance = Angle::Degrees(autopilot_parms.bearing_noise);

  FileLineReaderA *reader = new FileLineReaderA(replay_file.c_str());
  if (reader->error()) {
    delete reader;
    return false;
  }

  waypoints.Optimise();

  IgcReplay sim(reader);

  NMEAInfo basic;
  basic.Reset();

  while (sim.Update(basic)) {
    n_samples++;

    if (retro.UpdateSample(basic.location)) {
      std::ofstream g("output/results/res-retro.txt");

      // report task
      auto candidate_list = retro.getNearWaypointList();
      for (auto it = candidate_list.begin(); it != candidate_list.end(); ++it) {
	const Waypoint& wp = it->waypoint;
	g << (double)wp.location.longitude.Degrees() << " "
	  << (double)wp.location.latitude.Degrees() << " "
	  << "\"" << wp.name << "\"\n";
      }
    }

    f << (double)basic.time << " " 
      <<  (double)basic.location.longitude.Degrees() << " "
      <<  (double)basic.location.latitude.Degrees() << "\n";
    f.flush();
  };

  double d_ach, d_can;
  retro.CalcDistances(d_ach, d_can);
  printf("# distances %f %f\n", (double)d_ach, (double)d_can);
  printf("# size %d\n", retro.getNearWaypointList().size());

  return true;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:71,代码来源:test_replay_retrospective.cpp


示例15: waypoint

bool
WaypointReaderCompeGPS::ParseLine(const TCHAR* line, const unsigned linenum,
                                  Waypoints &waypoints)
{
  /*
   * G  WGS 84
   * U  1
   * W  IT05FC A 46.9121939503ºN 11.9605922700°E 27-MAR-62 00:00:00 566.000000 Ahornach Sand, Ahornach LP, GS und HG
   * w  Waypoint,0,-1.0,16777215,255,0,0,7,,0.0,
   * W  IT05FB A 46.9260440931ºN 11.9676733017°E 27-MAR-62 00:00:00 1425.000000 Ahornach Sand, Ahornach SP, GS und HG
   * w  Waypoint,0,-1.0,16777215,255,0,0,7,,0.0,
   *
   * W ShortName 31T 318570 4657569 27-MAR-62 00:00:00 0 some Comments
   * W ShortName A 41.234234N 7.234424W 27-MAR-62 00:00:00 0 Comments
   */

  // Skip projection and file encoding information
  if (*line == _T('G') || *line == _T('B'))
    return true;

  // Check for format: UTM or LatLon
  if (*line == _T('U') && _tcsstr(line, _T("U  0")) == line) {
    is_utm = true;
    return true;
  }

  // Skip non-waypoint lines
  if (*line != _T('W'))
    return true;

  // Skip W indicator and whitespace
  line++;
  while (*line == _T(' '))
    line++;

  // Find next space delimiter, skip shortname
  const TCHAR *name = line;
  const TCHAR *space = _tcsstr(line, _T(" "));
  if (space == NULL)
    return false;

  unsigned name_length = space - line;
  if (name_length == 0)
    return false;

  line = space;
  while (*line == _T(' '))
    line++;

  // Parse location
  GeoPoint location;
  if ((!is_utm && !ParseLocation(line, location)) ||
      (is_utm && !ParseLocationUTM(line, location)))
    return false;

  // Skip whitespace
  while (*line == _T(' '))
    line++;

  // Skip unused date field
  line = _tcsstr(line, _T(" "));
  if (line == NULL)
    return false;

  line++;

  // Skip unused time field
  line = _tcsstr(line, _T(" "));
  if (line == NULL)
    return false;

  line++;

  // Create new waypoint instance
  Waypoint waypoint(location);
  waypoint.file_num = file_num;
  waypoint.original_id = 0;
  waypoint.name.assign(name, name_length);

  // Parse altitude
  if (!ParseAltitude(line, waypoint.elevation) &&
      !CheckAltitude(waypoint))
    return false;

  // Skip whitespace
  while (*line == _T(' '))
    line++;

  // Parse waypoint name
  waypoint.comment.assign(line);

  waypoints.Append(std::move(waypoint));
  return true;
}
开发者ID:j-konopka,项目名称:XCSoar-TE,代码行数:94,代码来源:WaypointReaderCompeGPS.cpp


示例16: setup_waypoints

/** 
 * Initialises waypoints with random and non-random waypoints
 * for testing
 *
 * @param waypoints waypoints class to add waypoints to
 */
bool setup_waypoints(Waypoints &waypoints, const unsigned n) 
{

  Waypoint wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed_zero),
                                          Angle::Degrees(fixed_zero)));
  wp.type = Waypoint::Type::AIRFIELD;
  wp.elevation = fixed(0.25);
  waypoints.Append(wp);

  wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed_zero), 
                                 Angle::Degrees(fixed_one)));
  wp.type = Waypoint::Type::AIRFIELD;
  wp.elevation = fixed(0.25);
  waypoints.Append(wp);

  wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed_one), 
                                 Angle::Degrees(fixed_one)));
  wp.name = _T("Hello");
  wp.type = Waypoint::Type::AIRFIELD;
  wp.elevation = fixed_half;
  waypoints.Append(wp);

  wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed(0.8)), 
                                 Angle::Degrees(fixed(0.5))));
  wp.name = _T("Unk");
  wp.type = Waypoint::Type::AIRFIELD;
  wp.elevation = fixed(0.25);
  waypoints.Append(wp);

  wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed_one), 
                                 Angle::Degrees(fixed_zero)));
  wp.type = Waypoint::Type::AIRFIELD;
  wp.elevation = fixed(0.25);
  waypoints.Append(wp);

  wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed_zero), 
                                 Angle::Degrees(fixed(0.23))));
  wp.type = Waypoint::Type::AIRFIELD;
  wp.elevation = fixed(0.25);
  waypoints.Append(wp);

  for (unsigned i=0; i<(unsigned)std::max((int)n-6,0); i++) {
    int x = rand()%1200-100;
    int y = rand()%1200-100;
    double z = rand()% std::max(terrain_height,1);
    wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed(x/1000.0)), 
                                   Angle::Degrees(fixed(y/1000.0))));
    wp.type = Waypoint::Type::NORMAL;
    wp.elevation = fixed(z);
    waypoints.Append(wp);
  }
  waypoints.Optimise();

  if (verbose) {
    std::ofstream fin("results/res-wp-in.txt");
    for (unsigned i=1; i<=waypoints.size(); i++) {
      const Waypoint *wp = waypoints.LookupId(i);
      if (wp != NULL)
        fin << *wp;
    }
  }
  return true;
}
开发者ID:mobotics,项目名称:XCSoar,代码行数:69,代码来源:harness_waypoints.cpp


示例17: if

bool
WaypointReaderSeeYou::ParseLine(const TCHAR* line, const unsigned linenum,
                              Waypoints &waypoints)
{
  enum {
    iName = 0,
    iLatitude = 3,
    iLongitude = 4,
    iElevation = 5,
    iStyle = 6,
    iRWDir = 7,
    iRWLen = 8,
    iFrequency = 9,
    iDescription = 10,
  };

  if (linenum == 0)
    ignore_following = false;

  // If (end-of-file or comment)
  if (StringIsEmpty(line) ||
      StringStartsWith(line, _T("**")) ||
      StringStartsWith(line, _T("*")))
    // -> return without error condition
    return true;

  TCHAR ctemp[4096];
  if (_tcslen(line) >= ARRAY_SIZE(ctemp))
    /* line too long for buffer */
    return false;

  // Skip first line if it doesn't begin with a quotation character
  // (usually the field order line)
  if (linenum == 0 && line[0] != _T('\"'))
    return true;

  // If task marker is reached ignore all following lines
  if (_tcsstr(line, _T("-----Related Tasks-----")) == line)
    ignore_following = true;
  if (ignore_following)
    return true;

  // Get fields
  const TCHAR *params[20];
  size_t n_params = ExtractParameters(line, ctemp, params,
                                      ARRAY_SIZE(params), true, _T('"'));

  // Check if the basic fields are provided
  if (iName >= n_params ||
      iLatitude >= n_params ||
      iLongitude >= n_params)
    return false;

  Waypoint new_waypoint;

  // Latitude (e.g. 5115.900N)
  if (!ParseAngle(params[iLatitude], new_waypoint.location.latitude, true))
    return false;

  // Longitude (e.g. 00715.900W)
  if (!ParseAngle(params[iLongitude], new_waypoint.location.longitude, false))
    return false;

  new_waypoint.location.Normalize(); // ensure longitude is within -180:180

  new_waypoint.file_num = file_num;
  new_waypoint.original_id = 0;

  // Name (e.g. "Some Turnpoint")
  if (*params[iName] == _T('\0'))
    return false;
  new_waypoint.name = params[iName];

  // Elevation (e.g. 458.0m)
  /// @todo configurable behaviour
  if ((iElevation >= n_params ||
      !ParseAltitude(params[iElevation], new_waypoint.elevation)) &&
      !CheckAltitude(new_waypoint))
    return false;

  // Style (e.g. 5)
  if (iStyle < n_params)
    ParseStyle(params[iStyle], new_waypoint.type);

  new_waypoint.flags.turn_point = true;

  // Frequency & runway direction/length (for airports and landables)
  // and description (e.g. "Some Description")
  if (new_waypoint.IsLandable()) {
    if (iFrequency < n_params)
      new_waypoint.radio_frequency = RadioFrequency::Parse(params[iFrequency]);

    // Runway length (e.g. 546.0m)
    fixed rwlen = fixed_minus_one;
    if (iRWLen < n_params && ParseDistance(params[iRWLen], rwlen) &&
        positive(rwlen))
      new_waypoint.runway.SetLength(uround(rwlen));

    if (iRWDir < n_params && *params[iRWDir]) {
      TCHAR *end;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


示例18: test_task_aat

bool test_task_aat(TaskManager& task_manager,
                   const Waypoints &waypoints)
{
  const TaskProjection &projection =
    task_manager.get_ordered_task().get_task_projection();

  task_manager.set_factory(OrderedTask::FACTORY_AAT);
  AbstractTaskFactory &fact = task_manager.get_factory();
  const Waypoint *wp;

  task_report(task_manager, "# adding start\n");
  wp = waypoints.lookup_id(1);
  if (wp) {
    if (!fact.append(fact.createStart(*wp),false)) {
      return false;
    }
  }

  task_manager.setActiveTaskPoint(0);
  task_manager.resume();

  task_report(task_manager, "# adding intermediate\n");
  wp = waypoints.lookup_id(2);
  if (wp) {
    OrderedTaskPoint* tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
    if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
      CylinderZone *cz = (CylinderZone *)tp->get_oz();
      cz->setRadius(fixed(30000.0));
      tp->update_oz(projection);
    }
    if (!fact.append(tp,false)) {
      return false;
    }
  }

  task_report(task_manager, "# adding intermediate\n");
  wp = waypoints.lookup_id(3);
  if (wp) {
    OrderedTaskPoint* tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp);
    if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) {
      CylinderZone *cz = (CylinderZone *)tp->get_oz();
      cz->setRadius(fixed(40000.0));
      tp->update_oz(projection);
    }
    if (!fact.append(tp,false)) {
      return false;
    }
  }

  task_report(task_manager, "# adding finish\n");
  wp = waypoints.lookup_id(1);
  if (wp) {
    if (!fact.append(fact.createFinish(*wp),false)) {
      return false;
    }
  }

  task_report(task_manager, "# checking task..\n");
  if (!fact.validate()) {
    return false;
  }

  if (!task_manager.check_ordered_task()) {
    return false;
  }
  return true;
}
开发者ID:galippi,项目名称:xcsoar,代码行数:67,代码来源:harness_task.cpp


示例19: test_task_manip

bool test_task_manip(TaskManager& task_manager,
                     const Waypoints &waypoints)
{
  if (!test_task_mixed(task_manager, waypoints)) {
    return false;
  }
  AbstractTaskFactory &fact = task_manager.get_factory();

  task_report(task_manager, "# removing tp 2\n");
  if (!fact.remove(2)) {
    return false;
  }

  task_report(task_manager, "# removing tp 0\n");
  if (!fact.remove(0)) {
    return false;
  }

  task_report(task_manager, "# removing tp -1 (illegal)\n");
  if (fact.remove(0-1)) {
    return false;
  }

  task_report(task_manager, "# removing tp 50 (illegal)\n");
  if (fact.remove(50)) {
    return false;
  }

  OrderedTaskPoint *tp;
  const Waypoint *wp;

  task_report(task_manager, "# inserting at 3\n");
  wp = waypoints.lookup_id(3);
  if (wp) {
    tp = fact.createIntermediate(AbstractTaskFactory::AST_CYLINDER,*wp);
    if (!fact.insert(tp,3)) return false;
  }

  task_report(task_manager, "# auto-replacing at 2 (no morph)\n");
  wp = waypoints.lookup_id(9);
  if (wp) {
    tp = fact.createIntermediate(AbstractTaskFactory::AST_CYLINDER,*wp);
    if (!fact.replace(tp,2)) return false;
  }

  task_report(task_manager, "# auto-replacing at 2 (morph)\n");
  wp = waypoints.lookup_id(9);
  if (wp) {
    tp = fact.createStart(*wp);
    if (!fact.replace(tp,2)) return false;
  }

  task_report(task_manager, "# auto-replacing at 0 (morph this)\n");
  wp = waypoints.lookup_id(12);
  if (wp) {
    tp = fact.createIntermediate(AbstractTaskFactory::AST_CYLINDER,*wp);
    if (!fact.replace(tp,0)) return false;
  }

  task_report(task_manager, "# auto-replacing at end (morph this)\n");
  wp = waypoints.lookup_id(14);
  if (wp) {
    tp = fact.createIntermediate(AbstractTaskFactory::AST_CYLINDER,*wp);
    if (!fact.replace(tp,task_manager.task_size()-1)) return false;
  }

  task_report(task_manager, "# removing finish point\n");
  if (!fact.remove(task_manager.task_size()-1)) {
    return false;
  }

  task_report(task_manager, "# inserting at 50 (equivalent to append)\n");
  wp = waypoints.lookup_id(8);
  if (wp) {
    tp = fact.createFinish(*wp);
    if (!fact.insert(tp,50)) return false;
  }

  task_report(task_manager, "# inserting at 0 (morph this)\n");
  wp = waypoints.lookup_id(3);
  if (wp) {
    tp = fact.createFinish(*wp);
    if (!fact.insert(tp,0)) return false;
  }

  task_report(task_manager, "# inserting at 2 (morph this)\n");
  wp = waypoints.lookup_id(4);
  if (wp) {
    tp = fact.createStart(*wp);
    if (!fact.insert(tp,2)) return false;
  }

  task_report(task_manager, "# inserting at 2 (direct)\n");
  wp = waypoints.lookup_id(6);
  if (wp) {
    tp = fact.createIntermediate(*wp);
    if (!fact.insert(tp,2,false)) return false;
  }

  task_report(task_manager, "# checking task\n");
//.........这里部分代码省略.........
开发者ID:galippi,项目名称:xcsoar,代码行数:101,代码来源:harness_task.cpp


示例20: waypoint_list_builder

void
MapItemListBuilder::AddWaypoints(const Waypoints &waypoints)
{
  WaypointListBuilderVisitor waypoint_list_builder(list);
  waypoints.VisitWithinRange(location, range, waypoint_list_builder);
}
开发者ID:rkohel,项目名称:XCSoar,代码行数:6,代码来源:Builder.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WcharMbcsConvertor类代码示例发布时间:2022-05-31
下一篇:
C++ WaypointPath类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap