Gary Walborn wrote:
Can you supply the format of the IFP file? That might help. Perhaps I could write a converter.
Thanks,
Gary Walborn
N9732J
Hi Gary, we don't have a published spec for IFP, as it's not meant to be interpreted by other programs. But if your flight plan doesn't include IFR procedures or airways, it's fairly simple. Just parse the final line of each FP, and split it on the ";" (semi-colon). Here is the code that we use to generate this line of text, which encodes the flight plan. As you can see there isn't much to it, so you should be able to write a parser without too much headache.
Note that "wp" means "Waypoint" variable.
string flyOverPrefix = (wp.IsFlyOverPoint) ? "+" : "";
switch (wp.Type)
{
case Waypoint.WaypointType.Airport:
if (wp.IsTakeOffLocation)
{
if (wp.IsRealPlanPoint)
sb.Append("AB:");
else
sb.Append("AA:");
}
else
sb.Append("AP:");
sb.Append(flyOverPrefix);
sb.Append(wp.ObjectCode);
sb.Append(";");
break;
case Waypoint.WaypointType.Geo:
if (wp.IsDirectToInsertion)
sb.Append("D2:");
else if (wp.IsRealPlanPoint)
sb.Append("RP:");
else
sb.Append("AG:");
sb.Append(flyOverPrefix);
sb.Append(wp.Location.ToDecimalString());
sb.Append(";");
break;
case Waypoint.WaypointType.Navaid:
sb.Append("AN:");
sb.Append(flyOverPrefix);
sb.Append(wp.ObjectCode);
sb.Append(";");
break;
case Waypoint.WaypointType.Fix:
sb.Append("AF:");
sb.Append(flyOverPrefix);
sb.Append(wp.ObjectCode);
sb.Append(";");
break;
case Waypoint.WaypointType.Custom:
if (wp.IsTakeOffLocation)
sb.Append("AM:"); // specify Custom Location by Lat/Lon -- we'll find it by location.
else
{
sb.Append("AL:"); // specify Custom Location by Lat/Lon -- we'll find it by location.
sb.Append(flyOverPrefix);
}
sb.Append(wp.Location.ToDecimalString());
sb.Append(";");
break;
case Waypoint.WaypointType.NamedPoint:
sb.Append("AX:"); // specify Named Point, from KML/GPX flight plan
sb.Append(flyOverPrefix);
sb.Append(wp.DisplayName + "@" + wp.Location.ToDecimalString());
sb.Append(";");
break;
default:
Log.Error("FlightPlan.ToSaveString() - called where a waypoint does not have a 'Type' defined: {0}", wp);
break;
}
//if this waypoint has an altitude specifier, save that now
Altitude targetAltitude = wp._TargetAltitudeSet;
if (targetAltitude.IsValid)
{
sb.Append("SA:");
string altPrefix = (wp.IsTargetAltitudeForLeg) ? "+" : "";
sb.Append(altPrefix + targetAltitude.ToString());
sb.Append(";");
}
if (wp.IsFuelStop)
{
sb.Append("FS:+;");
}
if (wp.UserName != null)
{
sb.Append("NM:");
sb.Append(wp.UserName);
sb.Append(";");
}