Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lovettchris committed Mar 22, 2018
1 parent 7983eff commit 39934fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LogViewer/LogViewer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ void ShowMap()
{
try
{
myMap.SetView(GetBoundingBox(last.Locations), new Thickness(20.0), 0);
myMap.SetView(last.Locations, new Thickness(20.0), 0);
}
catch (Exception ex)
{
Expand Down
16 changes: 12 additions & 4 deletions LogViewer/LogViewer/Model/KmlDataLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void Load(XDocument doc)
endTime = time;
break;
case "coord":
AddGpsData(current, startTime, (string)child, ' ');
AddGpsData(current, startTime, (string)child, ' ', "OrderLatLong");
break;
}
}
Expand All @@ -97,7 +97,7 @@ public void Load(XDocument doc)
// fake time, since this format has no time.
current = current + TimeSpan.FromMilliseconds(1);
endTime = current;
AddGpsData(current, startTime, line, ',');
AddGpsData(current, startTime, line, ',', "OrderLongLat");
}
}

Expand All @@ -118,7 +118,7 @@ public void Load(XDocument doc)

}

private void AddGpsData(DateTime current, DateTime startTime, string row, char separator)
private void AddGpsData(DateTime current, DateTime startTime, string row, char separator, string order)
{
string[] parts = row.Split(separator);
if (parts.Length == 3)
Expand All @@ -128,13 +128,21 @@ private void AddGpsData(DateTime current, DateTime startTime, string row, char s
double.TryParse(parts[1], out lng);
double.TryParse(parts[2], out alt);

if (order == "OrderLongLat")
{
// switch them.
double temp = lng;
lng = lat;
lat = temp;
}

var gps = new LogEntry()
{
Name = "GPS",
Timestamp = (ulong)current.Ticks
};
gps.SetField("TimeMS", (UInt32)((current - startTime).Milliseconds));
gps.SetField("Lat", lat);
gps.SetField("Lat", lat);
gps.SetField("Lng", lng);
gps.SetField("Alt", alt);
log.Add(gps);
Expand Down

0 comments on commit 39934fa

Please sign in to comment.