Пример #1
0
AirspaceInterceptSolution 
AirspaceSoonestSort::solve_intercept(const AbstractAirspace &a) const
{
  const GeoPoint loc = a.closest_point(m_state.Location);

  AirspaceInterceptSolution sol;
  bool valid = a.intercept(m_state, m_perf, sol, loc, loc);

  if (sol.elapsed_time > m_max_time) {
    valid = false;
  }
  if (!valid) {
    sol.elapsed_time = -fixed_one;
  }
  return sol;
}
Пример #2
0
  virtual void closest(const AbstractAirspace& as) {
    GeoPoint c = as.closest_point(state.Location);
#ifdef DO_PRINT
    *fout << "# closest point\n";
    *fout << c.Longitude << " " << c.Latitude << " " << "\n";
    *fout << state.Location.Longitude << " " << state.Location.Latitude << " " << "\n\n";
#endif
    AirspaceInterceptSolution solution;
    GeoVector vec(state.Location, c);
    vec.Distance = fixed(20000); // set big distance (for testing)
    if (as.intercept(state, vec, m_perf, solution)) {
#ifdef DO_PRINT
      *fout << "# intercept in " << solution.elapsed_time << " h " << solution.altitude << "\n";
#endif
    }
  }
Пример #3
0
AirspaceInterceptSolution 
AirspaceIntersectionVisitor::intercept(const AbstractAirspace& as,
                                       const AIRCRAFT_STATE& state,
                                       const AirspaceAircraftPerformance &perf,
                                       bool all) const
{
  AirspaceInterceptSolution solution;
  if (m_intersections.empty()) {
    return solution;
  }

  for (AirspaceIntersectionVector::const_iterator it = m_intersections.begin();
       it != m_intersections.end(); ++it) {

    as.intercept(state, perf, solution, it->first, it->second);

    if (!all) {
      return solution;
    }
  }
  return solution;
}