示例#1
0
  /**
   * Check whether this intersection should be added to, or updated in, the warning manager
   *
   * @param airspace Airspace corresponding to current intersection
   */
  void Intersection(const AbstractAirspace& airspace) {
    if (!airspace.IsActive())
      return; // ignore inactive airspaces completely

    if (!warning_manager.GetConfig().IsClassEnabled(airspace.GetType()) ||
        ExcludeAltitude(airspace))
      return;

    AirspaceWarning *warning = warning_manager.GetWarningPtr(airspace);
    if (warning == NULL || warning->IsStateAccepted(warning_state)) {

      AirspaceInterceptSolution solution;

      if (mode_inside) {
        airspace.Intercept(state, perf, solution, state.location, state.location);
      } else {
        solution = Intercept(airspace, state, perf);
      }
      if (!solution.IsValid())
        return;
      if (solution.elapsed_time > max_time)
        return;

      if (warning == NULL)
        warning = warning_manager.GetNewWarningPtr(airspace);

      warning->UpdateSolution(warning_state, solution);
      found = true;
    }
  }
示例#2
0
bool
ActiveAirspacePredicate::operator()(const AbstractAirspace &airspace) const
{
  if (warnings != nullptr) {
    ProtectedAirspaceWarningManager::Lease lease(*warnings);
    return lease->IsActive(airspace);
  } else
    /* fallback */
    return airspace.IsActive();
}
示例#3
0
 bool IsInside(const AbstractAirspace &as) const {
   return as.IsActive() && Find(as, ids_inside);
 }
示例#4
0
 bool IsAcked(const AbstractAirspace &as) const {
   return (!as.IsActive()) || Find(as, ids_acked);
 }
示例#5
0
 bool HasWarning(const AbstractAirspace &as) const {
   return as.IsActive() && Find(as, ids_warning);
 }
示例#6
0
bool
AirspaceWarningManager::IsActive(const AbstractAirspace &airspace) const
{
  return airspace.IsActive() && config.IsClassEnabled(airspace.GetType()) &&
    !GetAckDay(airspace);
}