private void ElevationProfile_Load(object sender, EventArgs e)
{
if (planlocs.Count <= 1)
{
this.Close();
return;
}
// GE plot
double a = 0;
double increment = (distance/(float)(gelocs.Count - 1));
foreach (PointLatLngAlt geloc in gelocs)
{
if (geloc == null)
continue;
list2.Add(a, geloc.Alt);
Console.WriteLine("GE " + geloc.Lng + "," + geloc.Lat + "," + geloc.Alt);
a += increment;
}
// Planner Plot
a = 0;
int count = 0;
PointLatLngAlt lastloc = null;
foreach (PointLatLngAlt planloc in planlocs)
{
if (planloc == null)
continue;
if (lastloc != null)
{
a += planloc.GetDistance(lastloc);
}
// deal with at mode
if (altmode == GCSViews.FlightPlanner.altmode.Terrain)
{
list1 = list4terrain;
break;
}
else if (altmode == GCSViews.FlightPlanner.altmode.Relative)
{
// already includes the home alt
list1.Add(a, (planloc.Alt/CurrentState.multiplierdist), 0, planloc.Tag);
}
else
{
// abs
// already absolute
list1.Add(a, (planloc.Alt/CurrentState.multiplierdist), 0, planloc.Tag);
}
lastloc = planloc;
count++;
}
// draw graph
CreateChart(zg1);
}