Ejemplo n.º 1
0
void
AirspaceWarningManager::Acknowledge(const AbstractAirspace &airspace)
{
  auto *w = GetWarningPtr(airspace);
  if (w != nullptr)
    w->Acknowledge();
}
Ejemplo n.º 2
0
AirspaceWarning& 
AirspaceWarningManager::GetWarning(const AbstractAirspace &airspace)
{
  AirspaceWarning* warning = GetWarningPtr(airspace);
  if (warning)
    return *warning;

  // not found, create new entry
  warnings.push_back(AirspaceWarning(airspace));
  return warnings.back();
}
Ejemplo n.º 3
0
AirspaceWarning& 
AirspaceWarningManager::GetWarning(const AbstractAirspace &airspace)
{
  AirspaceWarning* warning = GetWarningPtr(airspace);
  if (warning)
    return *warning;

  // not found, create new entry
  ++serial;
  warnings.emplace_back(airspace);
  return warnings.back();
}
Ejemplo n.º 4
0
bool 
AirspaceWarningManager::UpdateInside(const AircraftState& state,
                                     const GlidePolar &glide_polar)
{
  if (!glide_polar.IsValid())
    return false;

  bool found = false;

  AirspacePredicateAircraftInside condition(state);

  Airspaces::AirspaceVector results = airspaces.FindInside(state, condition);
  for (const auto &i : results) {
    const AbstractAirspace &airspace = i.GetAirspace();

    if (!airspace.IsActive())
      continue; // ignore inactive airspaces

    if (!config.IsClassEnabled(airspace.GetType()))
      continue;

    AirspaceWarning *warning = GetWarningPtr(airspace);

    if (warning == nullptr ||
        warning->IsStateAccepted(AirspaceWarning::WARNING_INSIDE)) {
      GeoPoint c = airspace.ClosestPoint(state.location, GetProjection());
      const AirspaceAircraftPerformance perf_glide(glide_polar);
      AirspaceInterceptSolution solution;
      airspace.Intercept(state, c, GetProjection(), perf_glide, solution);

      if (warning == nullptr)
        warning = GetNewWarningPtr(airspace);

      warning->UpdateSolution(AirspaceWarning::WARNING_INSIDE, solution);
      found = true;
    }
  }

  return found;
}
Ejemplo n.º 5
0
bool
AirspaceWarningManager::GetAckDay(const AbstractAirspace &airspace) const
{
  const AirspaceWarning *warning = GetWarningPtr(airspace);
  return (warning != NULL ? warning->GetAckDay() : false);
}
Ejemplo n.º 6
0
bool
AirspaceWarningManager::GetAckDay(const AbstractAirspace &airspace) const
{
  const AirspaceWarning *warning = GetWarningPtr(airspace);
  return warning != nullptr && warning->GetAckDay();
}