Beispiel #1
0
static bool
ParseArcTNP(const TCHAR *buffer, TempAirspaceType &temp_area)
{
  if (temp_area.points.empty())
    return false;

  // (ANTI-)CLOCKWISE RADIUS=34.95 CENTRE=N523333 E0131603 TO=N522052 E0122236

  GeoPoint from = temp_area.points.back();

  const TCHAR* parameter;
  if ((parameter = _tcsstr(buffer, _T(" "))) == nullptr)
    return false;
  if ((parameter = StringAfterPrefixCI(parameter, _T(" CENTRE="))) == nullptr)
    return false;

  if (!ParseCoordsTNP(parameter, temp_area.center))
    return false;

  if ((parameter = _tcsstr(parameter, _T(" "))) == nullptr)
    return false;
  parameter++;
  if ((parameter = _tcsstr(parameter, _T(" "))) == nullptr)
    return false;
  if ((parameter = StringAfterPrefixCI(parameter, _T(" TO="))) == nullptr)
    return false;

  GeoPoint to;
  if (!ParseCoordsTNP(parameter, to))
    return false;

  temp_area.AppendArc(from, to);

  return true;
}
Beispiel #2
0
static void
ParseArcBearings(const TCHAR *buffer, TempAirspaceType &temp_area)
{
  // Determine radius and start/end bearing
  TCHAR *endptr;
  temp_area.radius = Units::ToSysUnit(fixed(_tcstod(&buffer[2], &endptr)), Unit::NAUTICAL_MILES);
  Angle start_bearing = Angle::Degrees(_tcstod(&endptr[1], &endptr)).AsBearing();
  Angle end_bearing = Angle::Degrees(_tcstod(&endptr[1], &endptr)).AsBearing();

  temp_area.AppendArc(start_bearing, end_bearing);
}
Beispiel #3
0
static bool
ParseArcPoints(const TCHAR *buffer, TempAirspaceType &temp_area)
{
  // Read start coordinates
  GeoPoint start;
  if (!ReadCoords(&buffer[3], start))
    return false;

  // Skip comma character
  const TCHAR* comma = _tcschr(buffer, ',');
  if (!comma)
    return false;

  // Read end coordinates
  GeoPoint end;
  if (!ReadCoords(&comma[1], end))
    return false;

  temp_area.AppendArc(start, end);
  return true;
}