コード例 #1
0
ファイル: TestWaypoints.cpp プロジェクト: kwtskran/XCSoar
static void
TestNamePrefixVisitor(const Waypoints &waypoints, const TCHAR *prefix,
                      unsigned expected_results)
{
  WaypointPredicateCounter::Predicate predicate = BeginsWith(prefix);
  WaypointPredicateCounter prefix_counter(predicate);
  waypoints.VisitNamePrefix(prefix, prefix_counter);
  ok1(prefix_counter.GetCounter() == expected_results);
}
コード例 #2
0
static void
FillList(WaypointList &list, const Waypoints &src,
         GeoPoint location, Angle heading, const WaypointFilterData &filter)
{
  list.clear();

  if (!filter.IsDefined() && src.size() >= 500)
    return;

  FilterWaypointVisitor visitor(filter, location, heading, list);

  if (filter.distance_index > 0)
    src.VisitWithinRange(location, Units::ToSysDistance(
        distance_filter_items[filter.distance_index]), visitor);
  else
    src.VisitNamePrefix(filter.name, visitor);

  if (filter.distance_index > 0 || filter.direction_index > 0)
    std::sort(list.begin(), list.end(), WaypointDistanceCompare(location));
}
コード例 #3
0
ファイル: WaypointListBuilder.cpp プロジェクト: Advi42/XCSoar
void WaypointListBuilder::Visit(const Waypoints &waypoints) {
  if (filter.distance > 0)
    waypoints.VisitWithinRange(location, filter.distance, *this);
  else
    waypoints.VisitNamePrefix(filter.name, *this);
}