コード例 #1
0
ファイル: AirspaceRoute.cpp プロジェクト: Mrdini/XCSoar
AirspaceRoute::ClearingPair
AirspaceRoute::find_clearing_pair(const SearchPointVector& spv,
                                  const SearchPointVector::const_iterator start,
                                  const SearchPointVector::const_iterator end,
                                  const RoutePoint &dest) const
{
  bool backwards = false;
  ClearingPair p(dest, dest);

  bool check_others = false;

  SearchPointVector::const_iterator i= start;

  int j=0;
  while ((i != end)&&(j<2)) {
    AFlatGeoPoint pborder(i->get_flatLocation(), dest.altitude); // @todo alt!
    const FlatRay ray(pborder, dest);

    if (intersects(spv, ray)) {
      j++;
      if (j==1) {
        i = start;
        backwards = true;
        continue;
      }
    } else {
      AGeoPoint gborder(task_projection.unproject(pborder), dest.altitude); // @todo alt!
      if (!check_others || !inside_others(gborder)) {
        if (j==0) {
          p.first = pborder;
        } else if (j==1) {
          p.second = pborder;
        }
      }
    }

    if (backwards)
      circular_previous(i, spv);
    else
      circular_next(i, spv);
  }
  return p;
}
コード例 #2
0
ファイル: AirspaceRoute.cpp プロジェクト: Tjeerdm/XCSoarDktjm
AirspaceRoute::ClearingPair
AirspaceRoute::FindClearingPair(const SearchPointVector& spv,
                                const SearchPointVector::const_iterator start,
                                const SearchPointVector::const_iterator end,
                                const RoutePoint &dest) const
{
  bool backwards = false;
  ClearingPair p(dest, dest);

  bool check_others = false;

  SearchPointVector::const_iterator i= start;

  int j=0;
  while ((i != end)&&(j<2)) {
    AFlatGeoPoint pborder(i->GetFlatLocation(), dest.altitude); // @todo alt!
    const FlatRay ray(pborder, dest);

    if (spv.IntersectsWith(ray)) {
      j++;
      if (j==1) {
        i = start;
        backwards = true;
        continue;
      }
    } else {
      AGeoPoint gborder(task_projection.Unproject(pborder), dest.altitude); // @todo alt!
      if (!check_others || !InsideOthers(gborder)) {
        if (j==0) {
          p.first = pborder;
        } else if (j==1) {
          p.second = pborder;
        }
      }
    }

    i = backwards ? spv.PreviousCircular(i) : spv.NextCircular(i);
  }

  return p;
}