RideFile data points now include lon and lat members for the longitude
degrees and latitute degrees from the source ride files. As a result
most of the RideFile readers now set longitude and latitude to zero for
each data point, except for:
* Gc Format Files - now support read/write
* Wko Format Files - now support read
* Tcx Format Files - now support read (smoothed if smart recording)
Although there are no features within GC at this point in time that use
positioning data this may change over time. Critically, as users save
files to the new GC file format whilst adding interval data it is
important that this positioning data is not discarded before new
features arrive.
The find peak powers functions was previously adding peak intervals for
durations that were longer than the entire ride, for example a 20 minute
ride would still have a 30min and 60min peak power interval added.
The duration of the ride is now checked and only peak intervals that
are shorter or equal to the length of the ride are added.
When a user creates a new interval by selecting a section of a ride
on AllPlotWindow the newly created selection now has the average power
for the selection placed at the end of the selection name in brackets.
Replace handcoded binary search in RideFiletimeToDistance() method
in RideFile with lower_bounds, since it is more efficient. The
distanceToTime() method has been removed since it is not used.
The class member IntervalItem::name is redundant since it is a duplicate
of the text() member of the base class QTreeWidgetItem. By removing it
we both simplify the code and remove the need to keep name and text in
sync when renaming and creating intervals.
As a result the itemChanged signal that was connected for renames and
then disconnected when the items are cleared can be connected once
and no disconnect is neccessary.
This connect/disconnect oddity was originally to avoid a SEGV that
resulted from accessing text() whilst the QTreeWidgetItem was being
destroyed. The code for removing intervals when a new ride is selected
no longer destroys and recreats MainWindow::allIntervals (which was also an
artefact of the original code to avoid a SEGV).
The ConfigDialog is modal, so it needs to delete itself. However, the
existing code contained a bunch of destructors with calls to delete on
widgets. That's wrong. Widgets are automatically parented on being added to
layouts, the parent widgets delete their children in their own destructors.
So remove all the explicit deletes.
The new intervals code removed some replots() to stop flickering but
they also removed critical refreshes after CP and Cadence values
are updated by the user using the entry fields on PfPvWindow.
Additionally, the setData() function was used to refresh all curves
when intervals were selected which caused user entries to be reset.
This patch introduces PfPvPlot::showIntervals() to only refresh the
intervals curve and fixes replots() to a) replot when neccessary
after a user entry but b) to not replot mid-refresh in the zones
background function.
The PfpvPlot::setData() function only sets the main curve (all the
black points).
When the user changes CP, CAD, CL in the window dialog they call
replot() explicitly rather than assuming the utility functions will
do it for them, since the utility functions are called within
setData (amongst others) and results in multiple replots() that are
ugly, but more importantly make it difficult to spot the deltas on
the plot as new intervals are overlayed because they all disappear
for a split second.
This change allows us to connect the zonesChanged signal to the ride summary,
so that we don't have to call ride->htmlSummary as a special case whenever
we call zonesChanged. It will also come in useful later when I introduce a
rideSelected signal.