-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#3533: Fixed getting track analysis; fixed display track info accordi… #21584
base: master
Are you sure you want to change the base?
Conversation
…ng to join segments setting
@@ -173,7 +174,6 @@ public void initItems(@Nullable GpxTrackAnalysis initAnalysis) { | |||
withoutGaps = !selectedGpxFile.isJoinSegments() | |||
&& (Algorithms.isEmpty(currentGpx.getTracks()) || currentGpx.getTracks().get(0).isGeneralTrack()); | |||
} else { | |||
GpxDisplayItem displayItem = getDisplayItem(); | |||
if (displayItem != null) { | |||
analysis = displayItem.analysis; | |||
withoutGaps = !selectedGpxFile.isJoinSegments() && displayItem.isGeneralTrack(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like copy-pasted logic, same as here
private float getDistance(@NonNull TrackItem trackItem, @NonNull GpxTrackAnalysis analysis) { | ||
GpxDataItem dataItem = trackItem.getDataItem(); | ||
boolean joinSegments = dataItem != null && (boolean) dataItem.getParameter(GpxParameter.JOIN_SEGMENTS); | ||
return joinSegments ? analysis.getTotalDistance() : analysis.getTotalDistanceWithoutGaps(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need the same info in other places, we could add a universal method to GpxTrackAnalysis or TrackItem instead of UI
@@ -24,7 +24,6 @@ class GpxTrackAnalysis { | |||
} | |||
|
|||
var name: String? = null | |||
var totalDistanceWithoutGaps = 0f | |||
var timeSpanWithoutGaps: Long = 0 | |||
var expectedRouteDuration: Long = 0 | |||
var timeMovingWithoutGaps: Long = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have the same issue with other variables here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have not faced such problems with others.
if(splitSegments.size == 1 && !splitSegments[0].segment.isGeneralSegment()) { | ||
totalDistanceWithoutGaps = totalDistance | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks strange. Is it needed because there are different values in totalDistance and totalDistanceWithoutGaps when we do not have multiple segments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. in case when we have only one segment we don't have "general segment" and totalDistanceWithoutGaps is not calculated, but it can be referenced in code
totalDistance = _totalDistance | ||
if(splitSegments.size == 1 && !splitSegments[0].segment.isGeneralSegment()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting
…ng to join segments setting