go through gps data backwards
This commit is contained in:
parent
c0ac67103f
commit
3d4ad61f5e
14
Program.cs
14
Program.cs
@ -704,16 +704,18 @@ public class Game : GameWindow {
|
||||
|
||||
allPhotos.Sort(ComparePhotosByDate);
|
||||
|
||||
// Fix up photos with missing GPS.
|
||||
// Fix up photos with missing GPS. We start at the end and work our way
|
||||
// backwards, because if one photo is missing GPS, it's probably because
|
||||
// the camera was turned off for a while, and whichever photo *after* it
|
||||
// has GPS data is probably more accurate.
|
||||
GpsInfo? lastGps = null;
|
||||
foreach (Photo p in allPhotos) {
|
||||
if (p.Gps != null) {
|
||||
lastGps = p.Gps;
|
||||
}
|
||||
for (int i = allPhotos.Count - 1; i >= 0; i--) {
|
||||
Photo p = allPhotos[i];
|
||||
if (p.Gps == null) {
|
||||
// FIXME: should we take from the photo immediately _before_, or after?
|
||||
Console.WriteLine("fixing GPS for " + p.Filename);
|
||||
p.Gps = lastGps;
|
||||
} else {
|
||||
lastGps = p.Gps;
|
||||
}
|
||||
}
|
||||
photos = allPhotos;
|
||||
|
Loading…
Reference in New Issue
Block a user