Example #1
0
unsigned test_radius(const Waypoints& waypoints, const double range)
{
    const Waypoint *r = waypoints.lookup_id(3);
    if (r) {
        WaypointVisitorPrint v;
        waypoints.visit_within_radius(r->Location, fixed(range), v);
        return v.count;
    } else {
        return 0;
    }
}
Example #2
0
static void
FillList(WaypointSelectInfoVector &dest, const Waypoints &src,
         GeoPoint location, Angle heading, const WayPointFilterData &filter)
{
  dest.clear();

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

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

  if (filter.distance_index > 0)
    src.visit_within_radius(location, Units::ToSysDistance(
        DistanceFilter[filter.distance_index]), visitor);
  else
    src.visit_name_prefix(filter.name, visitor);

  if (filter.distance_index > 0 || filter.direction_index > 0)
    std::sort(dest.begin(), dest.end(), WaypointDistanceCompare);
}