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);
|
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;
|
GpsInfo? lastGps = null;
|
||||||
foreach (Photo p in allPhotos) {
|
for (int i = allPhotos.Count - 1; i >= 0; i--) {
|
||||||
if (p.Gps != null) {
|
Photo p = allPhotos[i];
|
||||||
lastGps = p.Gps;
|
|
||||||
}
|
|
||||||
if (p.Gps == null) {
|
if (p.Gps == null) {
|
||||||
// FIXME: should we take from the photo immediately _before_, or after?
|
|
||||||
Console.WriteLine("fixing GPS for " + p.Filename);
|
Console.WriteLine("fixing GPS for " + p.Filename);
|
||||||
p.Gps = lastGps;
|
p.Gps = lastGps;
|
||||||
|
} else {
|
||||||
|
lastGps = p.Gps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
photos = allPhotos;
|
photos = allPhotos;
|
||||||
|
Loading…
Reference in New Issue
Block a user