From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sat, 12 Nov 2022 22:34:19 +0000 (-0700) Subject: relax time constraints on trackfilter move. (#945) X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~1^2~164 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=659734ae4fc0229102ebea13db417a69c3a9384f;p=gpsbabel.git relax time constraints on trackfilter move. (#945) 1. don't require all track points to have time, just leave timeless track points alone. 2. don't require track points to be ordered by time for move. This also results in the tracks not being sorted by time for move only operations. Instead the original order is preserved. --- diff --git a/trackfilter.cc b/trackfilter.cc index d157249b2..f60371f26 100644 --- a/trackfilter.cc +++ b/trackfilter.cc @@ -574,11 +574,22 @@ void TrackFilter::trackfilter_move() return; } + int timeless_points = 0; + for (auto* track : qAsConst(track_list)) { foreach (Waypoint* wpt, track->waypoint_list) { - wpt->creation_time = wpt->creation_time.addSecs(delta); + if (wpt->creation_time.isValid()) { + wpt->creation_time = wpt->creation_time.addSecs(delta); + } else { + ++timeless_points; + } } } + if (timeless_points > 0) { + warning(MYNAME "-move: %d points out of %d total points didn't have " + "time information and could not be moved.\n", + timeless_points, track_waypt_count()); + } } /******************************************************************************* @@ -961,7 +972,7 @@ void TrackFilter::init() */ need_time = ( opt_merge || opt_pack || opt_split || opt_sdistance || - opt_move || opt_fix || opt_speed || + opt_fix || opt_speed || (trackfilter_opt_count() == 0) /* do pack by default */ ); /* in case of a formatted title we also need valid timestamps */