Skip to content

Commit

Permalink
[Tour Chart] Show "Moving time without breaks" in the value point too…
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgang-ch committed Mar 25, 2023
1 parent f4832fb commit 6f0bb1e
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 45 deletions.
2 changes: 2 additions & 0 deletions bundles/net.tourbook/src/net/tourbook/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -2483,11 +2483,13 @@ public class Messages extends NLS {
public static String Tooltip_ValuePoint_Action_Value_Speed_Summarized;
public static String Tooltip_ValuePoint_Action_Value_Temperature;
public static String Tooltip_ValuePoint_Action_Value_TimeDuration;
public static String Tooltip_ValuePoint_Action_Value_TimeMoving;
public static String Tooltip_ValuePoint_Action_Value_TimeOfDay;
public static String Tooltip_ValuePoint_Action_Value_TimeSlices;
public static String Tooltip_ValuePoint_Action_Value_TourCompareResult;
public static String Tooltip_ValuePoint_Format_Pace;
public static String Tooltip_ValuePoint_Label_ChartZoomFactor_Tooltip;
public static String Tooltip_ValuePoint_Label_MovingTime_Tooltip;
public static String Tooltip_ValuePoint_Label_NoData;
public static String Tooltip_ValuePoint_Label_NoData_Tooltip;
public static String Tooltip_ValuePoint_Label_SlicesCurrent_Tooltip;
Expand Down
111 changes: 84 additions & 27 deletions bundles/net.tourbook/src/net/tourbook/data/TourData.java
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,12 @@ public class TourData implements Comparable<Object>, IXmlSerializable, Serializa
@Transient
private boolean[] pausedTimeSerie;

/**
* This is a time serie like {@link #timeSerie} but contains only moving times, break times are 0
*/
@Transient
private int[] movingTimeSerie;

/**
* Contains the temperature in the metric measurement system.
*/
Expand Down Expand Up @@ -2172,6 +2178,7 @@ public void clearComputedSeries() {

breakTimeSerie = null;
pausedTimeSerie = null;
movingTimeSerie = null;

_pulseSerie_Smoothed = null;
pulseSerie_FromTime = null;
Expand Down Expand Up @@ -2638,7 +2645,7 @@ public boolean computeAltitudeUpDown() {
}

public ElevationGainLoss computeAltitudeUpDown(final ArrayList<AltitudeUpDownSegment> segmentSerieIndexParameter,
final float selectedMinAltiDiff) {
final float selectedMinAltiDiff) {

return computeAltitudeUpDown_30_Algorithm_9_08(segmentSerieIndexParameter, selectedMinAltiDiff);
}
Expand Down Expand Up @@ -2788,9 +2795,9 @@ public ElevationGainLoss computeAltitudeUpDown(final int startIndex, final int e
* @return Returns <code>null</code> when altitude up/down cannot be computed
*/
private ElevationGainLoss computeAltitudeUpDown_20_Algorithm_DP(final float[] elevationSerie,
final float dpTolerance,
final int startIndex,
final int endIndex) {
final float dpTolerance,
final int startIndex,
final int endIndex) {

// check if all necessary data are available
if (elevationSerie == null
Expand Down Expand Up @@ -2857,7 +2864,7 @@ private ElevationGainLoss computeAltitudeUpDown_20_Algorithm_DP(final float[] el
* @return Returns <code>null</code> when altitude up/down cannot be computed
*/
private ElevationGainLoss computeAltitudeUpDown_30_Algorithm_9_08(final ArrayList<AltitudeUpDownSegment> segmentSerie,
final float minAltiDiff) {
final float minAltiDiff) {

// check if all necessary data are available
if ((altitudeSerie == null) || (timeSerie == null) || (timeSerie.length < 2)) {
Expand Down Expand Up @@ -3295,7 +3302,7 @@ public float computeAvg_FromValues(final float[] valueSerie, final int firstInde
int nextTime = timeSerie[firstIndex + 1];

/**
* a break is set from the previous to the current time slice
* A break is set from the previous to the current time slice
*/
final boolean hasBreakTime = breakTimeSerie != null;
boolean isPrevBreak = hasBreakTime ? breakTimeSerie[firstIndex] : false;
Expand Down Expand Up @@ -7336,29 +7343,29 @@ public void dumpTourTotal() {

out.println("Tour distance (m): " + getTourDistance()); //$NON-NLS-1$

out.println(
"Tour time: " //$NON-NLS-1$
+ (tourDeviceTime_Elapsed / 3600)
+ UI.SYMBOL_COLON
+ ((tourDeviceTime_Elapsed % 3600) / 60)
+ UI.SYMBOL_COLON
+ (tourDeviceTime_Elapsed % 3600) % 60);
out.println("Tour time: " //$NON-NLS-1$

out.println(
"Recorded time: " //$NON-NLS-1$
+ (getTourDeviceTime_Recorded() / 3600)
+ UI.SYMBOL_COLON
+ ((getTourDeviceTime_Recorded() % 3600) / 60)
+ UI.SYMBOL_COLON
+ (getTourDeviceTime_Recorded() % 3600) % 60);
+ (tourDeviceTime_Elapsed / 3600)
+ UI.SYMBOL_COLON
+ ((tourDeviceTime_Elapsed % 3600) / 60)
+ UI.SYMBOL_COLON
+ (tourDeviceTime_Elapsed % 3600) % 60);

out.println(
"Moving time: " //$NON-NLS-1$
+ (getTourComputedTime_Moving() / 3600)
+ UI.SYMBOL_COLON
+ ((getTourComputedTime_Moving() % 3600) / 60)
+ UI.SYMBOL_COLON
+ (getTourComputedTime_Moving() % 3600) % 60);
out.println("Recorded time: " //$NON-NLS-1$

+ (getTourDeviceTime_Recorded() / 3600)
+ UI.SYMBOL_COLON
+ ((getTourDeviceTime_Recorded() % 3600) / 60)
+ UI.SYMBOL_COLON
+ (getTourDeviceTime_Recorded() % 3600) % 60);

out.println("Moving time: " //$NON-NLS-1$

+ (getTourComputedTime_Moving() / 3600)
+ UI.SYMBOL_COLON
+ ((getTourComputedTime_Moving() % 3600) / 60)
+ UI.SYMBOL_COLON
+ (getTourComputedTime_Moving() % 3600) % 60);

out.println("Altitude up (m): " + getTourAltUp()); //$NON-NLS-1$
out.println("Altitude down (m): " + getTourAltDown()); //$NON-NLS-1$
Expand Down Expand Up @@ -8480,6 +8487,56 @@ public float[] getMetricDistanceSerie() {
return distanceSerie;
}

public int[] getMovingTimeSerie() {

if (movingTimeSerie != null) {
return movingTimeSerie;
}

// check if data are available
if (timeSerie == null || timeSerie.length == 0) {
return null;
}

// get break time when not yet set
if (breakTimeSerie == null) {
getBreakTime();
}

// check again, a break needs a distance serie
if (breakTimeSerie == null) {
return null;
}

final int numTimeSlices = timeSerie.length;

movingTimeSerie = new int[numTimeSlices];

int sumBreakTimes = 0;

final int[] timeSerie2 = timeSerie;
final boolean[] breakTimeSerie2 = breakTimeSerie;

for (int serieIndex = 1; serieIndex < numTimeSlices; serieIndex++) {

final int currentTime = timeSerie2[serieIndex];

final boolean isBreakTime = breakTimeSerie2[serieIndex];

if (isBreakTime) {

final int prevTime = timeSerie2[serieIndex - 1];
final int timeDiff = currentTime - prevTime;

sumBreakTimes += timeDiff;
}

movingTimeSerie[serieIndex] = currentTime - sumBreakTimes;
}

return movingTimeSerie;
}

/**
* @param geoAccuracy
* @param distanceAccuracy
Expand Down
2 changes: 2 additions & 0 deletions bundles/net.tourbook/src/net/tourbook/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3093,11 +3093,13 @@ Tooltip_ValuePoint_Action_Value_Speed = &Speed
Tooltip_ValuePoint_Action_Value_Speed_Summarized = &Speed \u2211 \u00D8
Tooltip_ValuePoint_Action_Value_Temperature = Te&mperature
Tooltip_ValuePoint_Action_Value_TimeDuration = &Time Duration
Tooltip_ValuePoint_Action_Value_TimeMoving=&Moving Time
Tooltip_ValuePoint_Action_Value_TimeOfDay = &Time of Day
Tooltip_ValuePoint_Action_Value_TimeSlices = Ti&me Slices
Tooltip_ValuePoint_Action_Value_TourCompareResult = Tour Com&pare Result
Tooltip_ValuePoint_Format_Pace = %d:%02d
Tooltip_ValuePoint_Label_ChartZoomFactor_Tooltip = Chart zoom factor
Tooltip_ValuePoint_Label_MovingTime_Tooltip=Moving time without breaks
Tooltip_ValuePoint_Label_NoData = No required data
Tooltip_ValuePoint_Label_NoData_Tooltip = This tooltip cannot display any values because\n\
required data are not available.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public class ValuePoint_ToolTip_MenuManager {
static final long VALUE_ID_RUN_DYN_VERTICAL_RATIO = 1 << 21;
static final long VALUE_ID_PACE_SUMMARIZED = 1 << 22;
static final long VALUE_ID_SPEED_SUMMARIZED = 1 << 23;
static final long VALUE_ID_TIME_MOVING = 1 << 24;

static final long DEFAULT_GRAPHS =

Expand Down Expand Up @@ -110,6 +111,7 @@ public class ValuePoint_ToolTip_MenuManager {
private ActionValueItem _actionValue_Temperature;
private ActionValueItem _actionValue_TimeDuration;
private ActionValueItem _actionValue_TimeOfDay;
private ActionValueItem _actionValue_TimeMoving;
private ActionValueItem _actionValue_TimeSlices;
private ActionValueItem _actionValue_TourCompareResult;

Expand Down Expand Up @@ -372,6 +374,12 @@ private void createGraphActions() {
null,
null);

_actionValue_TimeMoving = new ActionValueItem(
VALUE_ID_TIME_MOVING,
Messages.Tooltip_ValuePoint_Action_Value_TimeMoving,
null,
null);

_actionValue_TimeOfDay = new ActionValueItem(
VALUE_ID_TIME_OF_DAY,
Messages.Tooltip_ValuePoint_Action_Value_TimeOfDay,
Expand Down Expand Up @@ -546,30 +554,31 @@ private void enableActions() {

_actionValue_Header .setEnabled(false);

_actionValue_Altimeter .setState((_allVisibleValueIds & VALUE_ID_ALTIMETER) > 0, _tourData.getAltimeterSerie() != null);
_actionValue_Altitude .setState((_allVisibleValueIds & VALUE_ID_ALTITUDE) > 0, _tourData.getAltitudeSerie() != null);
_actionValue_Cadence .setState((_allVisibleValueIds & VALUE_ID_CADENCE) > 0, _tourData.getCadenceSerie() != null);
_actionValue_Altimeter .setState((_allVisibleValueIds & VALUE_ID_ALTIMETER) > 0, _tourData.getAltimeterSerie() != null);
_actionValue_Altitude .setState((_allVisibleValueIds & VALUE_ID_ALTITUDE) > 0, _tourData.getAltitudeSerie() != null);
_actionValue_Cadence .setState((_allVisibleValueIds & VALUE_ID_CADENCE) > 0, _tourData.getCadenceSerie() != null);
_actionValue_ChartZoomFactor .setState((_allVisibleValueIds & VALUE_ID_CHART_ZOOM_FACTOR) > 0, true);
_actionValue_Distance .setState((_allVisibleValueIds & VALUE_ID_DISTANCE) > 0, _tourData.distanceSerie != null);
_actionValue_Gears .setState((_allVisibleValueIds & VALUE_ID_GEARS) > 0, _tourData.getGears() != null);
_actionValue_Gradient .setState((_allVisibleValueIds & VALUE_ID_GRADIENT) > 0, _tourData.getGradientSerie() != null);
_actionValue_Pace .setState((_allVisibleValueIds & VALUE_ID_PACE) > 0, _tourData.getPaceSerie() != null);
_actionValue_Distance .setState((_allVisibleValueIds & VALUE_ID_DISTANCE) > 0, _tourData.distanceSerie != null);
_actionValue_Gears .setState((_allVisibleValueIds & VALUE_ID_GEARS) > 0, _tourData.getGears() != null);
_actionValue_Gradient .setState((_allVisibleValueIds & VALUE_ID_GRADIENT) > 0, _tourData.getGradientSerie() != null);
_actionValue_Pace .setState((_allVisibleValueIds & VALUE_ID_PACE) > 0, _tourData.getPaceSerie() != null);
_actionValue_Pace_Summarized .setState((_allVisibleValueIds & VALUE_ID_PACE_SUMMARIZED) > 0, _tourData.getPaceSerie_Summarized_Seconds() != null);
_actionValue_Power .setState((_allVisibleValueIds & VALUE_ID_POWER) > 0, _tourData.getPowerSerie() != null);
_actionValue_Pulse .setState((_allVisibleValueIds & VALUE_ID_PULSE) > 0, _tourData.pulseSerie != null);
_actionValue_Speed .setState((_allVisibleValueIds & VALUE_ID_SPEED) > 0, _tourData.getSpeedSerie() != null);
_actionValue_Speed_Summarized .setState((_allVisibleValueIds & VALUE_ID_SPEED_SUMMARIZED) > 0, _tourData.getSpeedSerie_Summarized() != null);
_actionValue_Temperature .setState((_allVisibleValueIds & VALUE_ID_TEMPERATURE) > 0, _tourData.temperatureSerie != null);
_actionValue_TimeDuration .setState((_allVisibleValueIds & VALUE_ID_TIME_DURATION) > 0, _tourData.timeSerie != null);
_actionValue_TimeOfDay .setState((_allVisibleValueIds & VALUE_ID_TIME_OF_DAY) > 0, _tourData.timeSerie != null);
_actionValue_Power .setState((_allVisibleValueIds & VALUE_ID_POWER) > 0, _tourData.getPowerSerie() != null);
_actionValue_Pulse .setState((_allVisibleValueIds & VALUE_ID_PULSE) > 0, _tourData.pulseSerie != null);
_actionValue_Speed .setState((_allVisibleValueIds & VALUE_ID_SPEED) > 0, _tourData.getSpeedSerie() != null);
_actionValue_Speed_Summarized .setState((_allVisibleValueIds & VALUE_ID_SPEED_SUMMARIZED) > 0, _tourData.getSpeedSerie_Summarized() != null);
_actionValue_Temperature .setState((_allVisibleValueIds & VALUE_ID_TEMPERATURE) > 0, _tourData.temperatureSerie != null);
_actionValue_TimeDuration .setState((_allVisibleValueIds & VALUE_ID_TIME_DURATION) > 0, _tourData.timeSerie != null);
_actionValue_TimeOfDay .setState((_allVisibleValueIds & VALUE_ID_TIME_OF_DAY) > 0, _tourData.timeSerie != null);
_actionValue_TimeMoving .setState((_allVisibleValueIds & VALUE_ID_TIME_MOVING) > 0, _tourData.getMovingTimeSerie() != null);
_actionValue_TimeSlices .setState((_allVisibleValueIds & VALUE_ID_TIME_SLICES) > 0, true);
_actionValue_TourCompareResult .setState((_allVisibleValueIds & VALUE_ID_TOUR_COMPARE_RESULT) > 0, _tourData.tourCompareSerie != null && _tourData.tourCompareSerie.length > 0);

_actionValue_RunDyn_StanceTime .setState((_allVisibleValueIds & VALUE_ID_RUN_DYN_STANCE_TIME) > 0, _tourData.getRunDyn_StanceTime() != null);
_actionValue_RunDyn_StanceTimeBalance .setState((_allVisibleValueIds & VALUE_ID_RUN_DYN_STANCE_TIME_BALANCED) > 0, _tourData.getRunDyn_StanceTimeBalance() != null);
_actionValue_RunDyn_StepLength .setState((_allVisibleValueIds & VALUE_ID_RUN_DYN_STEP_LENGTH) > 0, _tourData.getRunDyn_StepLength() != null);
_actionValue_RunDyn_StanceTime .setState((_allVisibleValueIds & VALUE_ID_RUN_DYN_STANCE_TIME) > 0, _tourData.getRunDyn_StanceTime() != null);
_actionValue_RunDyn_StanceTimeBalance .setState((_allVisibleValueIds & VALUE_ID_RUN_DYN_STANCE_TIME_BALANCED) > 0, _tourData.getRunDyn_StanceTimeBalance() != null);
_actionValue_RunDyn_StepLength .setState((_allVisibleValueIds & VALUE_ID_RUN_DYN_STEP_LENGTH) > 0, _tourData.getRunDyn_StepLength() != null);
_actionValue_RunDyn_VerticalOscillation .setState((_allVisibleValueIds & VALUE_ID_RUN_DYN_VERTICAL_OSCILLATION) > 0, _tourData.getRunDyn_VerticalOscillation() != null);
_actionValue_RunDyn_VerticalRatio .setState((_allVisibleValueIds & VALUE_ID_RUN_DYN_VERTICAL_RATIO) > 0, _tourData.getRunDyn_VerticalRatio() != null);
_actionValue_RunDyn_VerticalRatio .setState((_allVisibleValueIds & VALUE_ID_RUN_DYN_VERTICAL_RATIO) > 0, _tourData.getRunDyn_VerticalRatio() != null);

// SET_FORMATTING_ON
}
Expand All @@ -591,6 +600,7 @@ private Menu getMenu(final Control parent) {

addItem(_actionValue_TimeSlices);
addItem(_actionValue_TimeDuration);
addItem(_actionValue_TimeMoving);
addItem(_actionValue_TimeOfDay);
addItem(_actionValue_Distance);
addItem(_actionValue_Altitude);
Expand Down

0 comments on commit 6f0bb1e

Please sign in to comment.