Exemplo n.º 1
0
void
WaypointWriter::WriteWaypoint(TextWriter &writer, const Waypoint& wp)
{
  // Write the waypoint id
  writer.printf("%u,", wp.original_id > 0 ? wp.original_id : wp.id);

  // Write the latitude
  WriteAngle(writer, wp.location.latitude, true);
  writer.write(',');

  // Write the longitude id
  WriteAngle(writer, wp.location.longitude, false);
  writer.write(',');

  // Write the altitude id
  WriteAltitude(writer, wp.altitude);
  writer.write(',');

  // Write the waypoint flags
  WriteFlags(writer, wp);
  writer.write(',');

  // Write the waypoint name
  writer.write(wp.name.c_str());
  writer.write(',');

  // Write the waypoint description
  writer.writeln(wp.comment.c_str());
}
Exemplo n.º 2
0
void
WaypointWriter::WriteAngle(TextWriter &writer, const Angle &angle,
                           bool is_latitude)
{
  // Calculate degrees, minutes and seconds
  int deg, min, sec;
  bool is_positive;
  angle.ToDMS(deg, min, sec, is_positive);

  // Save them into the buffer string
  writer.printf(is_latitude ? "%02d:%02d:%02d" : "%03d:%02d:%02d", deg, min, sec);

  // Attach the buffer string to the output
  if (is_latitude)
    writer.write(is_positive ? "N" : "S");
  else
    writer.write(is_positive ? "E" : "W");
}
Exemplo n.º 3
0
void
WayPointFileWinPilot::composeAngle(TextWriter &writer,
                                   const Angle& src, const bool lat)
{
  // Calculate degrees, minutes and seconds
  int deg, min, sec;
  bool is_positive;
  if (lat)
    Units::LatitudeToDMS(src, &deg, &min, &sec, &is_positive);
  else
    Units::LongitudeToDMS(src, &deg, &min, &sec, &is_positive);

  // Save them into the buffer string
  writer.printf(lat ? "%02d:%02d:%02d" : "%03d:%02d:%02d",
            deg, min, sec);

  // Attach the buffer string to the output
  if (lat)
    writer.write(is_positive ? "N" : "S");
  else
    writer.write(is_positive ? "E" : "W");
}
Exemplo n.º 4
0
void
WayPointFileWinPilot::composeLine(TextWriter &writer, const Waypoint& wp)
{
  // Attach the waypoint id to the output
  writer.printf("%u,", wp.id);
  // Attach the latitude to the output
  composeAngle(writer, wp.Location.Latitude, true);
  writer.write(',');
  // Attach the longitude id to the output
  composeAngle(writer, wp.Location.Longitude, false);
  writer.write(',');
  // Attach the altitude id to the output
  composeAltitude(writer, wp.Altitude);
  writer.write(',');
  // Attach the waypoint flags to the output
  composeFlags(writer, wp.Flags);
  writer.write(',');
  // Attach the waypoint name to the output
  writer.write(wp.Name.c_str());
  writer.write(',');
  // Attach the waypoint description to the output
  writer.writeln(wp.Comment.c_str());
}
Exemplo n.º 5
0
void
WaypointWriter::WriteAltitude(TextWriter &writer, fixed altitude)
{
  writer.printf("%dM", (int)altitude);
}
Exemplo n.º 6
0
void
WayPointFileWinPilot::composeAltitude(TextWriter &writer, const fixed src)
{
  writer.printf("%dM", (int)src);
}