Merge pull request #8203 from osmandapp/Fix_7084

Fix_7084
This commit is contained in:
max-klaus 2020-01-10 14:36:00 +03:00 committed by GitHub
commit 1368066253
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 84 additions and 52 deletions

View file

@ -873,7 +873,7 @@ public class GPXUtilities {
WptPt point = segment.points.get(k); WptPt point = segment.points.get(k);
if (k > 0) { if (k > 0) {
double currentSegment = 0; double currentSegment = 0;
if (!(segment.generalSegment && joinSegments && point.firstPoint)) { if (!(segment.generalSegment && !joinSegments && point.firstPoint)) {
currentSegment = metric.metric(prev, point); currentSegment = metric.metric(prev, point);
secondaryMetricEnd += secondaryMetric.metric(prev, point); secondaryMetricEnd += secondaryMetric.metric(prev, point);
} }

View file

@ -8,20 +8,17 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import java.util.Map;
import java.util.Map.Entry;
import net.osmand.GPXUtilities; import net.osmand.GPXUtilities;
import net.osmand.IProgress;
import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.plus.GPXDatabase.GpxDataItem;
import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.GPXTrackAnalysis; import net.osmand.GPXUtilities.GPXTrackAnalysis;
import net.osmand.GPXUtilities.Route; import net.osmand.GPXUtilities.Route;
import net.osmand.GPXUtilities.Track; import net.osmand.GPXUtilities.Track;
import net.osmand.GPXUtilities.TrkSegment; import net.osmand.GPXUtilities.TrkSegment;
import net.osmand.GPXUtilities.WptPt; import net.osmand.GPXUtilities.WptPt;
import net.osmand.IProgress;
import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.plus.GPXDatabase.GpxDataItem;
import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
import net.osmand.plus.OsmandSettings.MetricsConstants; import net.osmand.plus.OsmandSettings.MetricsConstants;
import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.activities.SavingTrackHelper;
@ -39,6 +36,8 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class GpxSelectionHelper { public class GpxSelectionHelper {
@ -48,6 +47,7 @@ public class GpxSelectionHelper {
private static final String BACKUPMODIFIEDTIME = "backupTime"; private static final String BACKUPMODIFIEDTIME = "backupTime";
private static final String COLOR = "color"; private static final String COLOR = "color";
private static final String SELECTED_BY_USER = "selected_by_user"; private static final String SELECTED_BY_USER = "selected_by_user";
private OsmandApplication app; private OsmandApplication app;
@NonNull @NonNull
private List<SelectedGpxFile> selectedGPXFiles = new java.util.ArrayList<>(); private List<SelectedGpxFile> selectedGPXFiles = new java.util.ArrayList<>();
@ -595,9 +595,12 @@ public class GpxSelectionHelper {
displayed = sf != null; displayed = sf != null;
if (show && sf == null) { if (show && sf == null) {
sf = new SelectedGpxFile(); sf = new SelectedGpxFile();
if (dataItem != null && dataItem.getColor() != 0) { if (dataItem != null) {
if (dataItem.getColor() != 0) {
gpx.setColor(dataItem.getColor()); gpx.setColor(dataItem.getColor());
} }
sf.setJoinSegments(dataItem.isJoinSegments());
}
sf.setGpxFile(gpx, app); sf.setGpxFile(gpx, app);
sf.notShowNavigationDialog = notShowNavigationDialog; sf.notShowNavigationDialog = notShowNavigationDialog;
sf.selectedByUser = selectedByUser; sf.selectedByUser = selectedByUser;
@ -661,7 +664,6 @@ public class GpxSelectionHelper {
} }
private void syncGpxWithMarkers(GPXFile gpxFile) { private void syncGpxWithMarkers(GPXFile gpxFile) {
File gpx = new File(gpxFile.path);
MapMarkersHelper mapMarkersHelper = app.getMapMarkersHelper(); MapMarkersHelper mapMarkersHelper = app.getMapMarkersHelper();
MapMarkersGroup group = mapMarkersHelper.getMarkersGroup(gpxFile); MapMarkersGroup group = mapMarkersHelper.getMarkersGroup(gpxFile);
if (group != null) { if (group != null) {
@ -669,22 +671,25 @@ public class GpxSelectionHelper {
} }
} }
public static class SelectedGpxFile { public static class SelectedGpxFile {
public boolean notShowNavigationDialog = false; public boolean notShowNavigationDialog = false;
public boolean selectedByUser = true; public boolean selectedByUser = true;
private boolean showCurrentTrack;
private GPXFile gpxFile; private GPXFile gpxFile;
private int color;
private GPXTrackAnalysis trackAnalysis; private GPXTrackAnalysis trackAnalysis;
private long modifiedTime = -1;
private boolean splitProcessed = false;
private List<TrkSegment> processedPointsToDisplay = new ArrayList<>();
private boolean routePoints;
private List<TrkSegment> processedPointsToDisplay = new ArrayList<>();
private List<GpxDisplayGroup> displayGroups; private List<GpxDisplayGroup> displayGroups;
private int color;
private long modifiedTime = -1;
private boolean routePoints;
private boolean joinSegments;
private boolean showCurrentTrack;
private boolean splitProcessed = false;
public void setGpxFile(GPXFile gpxFile, OsmandApplication app) { public void setGpxFile(GPXFile gpxFile, OsmandApplication app) {
this.gpxFile = gpxFile; this.gpxFile = gpxFile;
if (gpxFile.tracks.size() > 0) { if (gpxFile.tracks.size() > 0) {
@ -723,7 +728,7 @@ public class GpxSelectionHelper {
} }
public List<TrkSegment> getPointsToDisplay() { public List<TrkSegment> getPointsToDisplay() {
return processedPointsToDisplay; return joinSegments ? gpxFile.getGeneralTrack().segments : processedPointsToDisplay;
} }
public List<TrkSegment> getModifiablePointsToDisplay() { public List<TrkSegment> getModifiablePointsToDisplay() {
@ -747,6 +752,14 @@ public class GpxSelectionHelper {
this.showCurrentTrack = showCurrentTrack; this.showCurrentTrack = showCurrentTrack;
} }
public boolean isJoinSegments() {
return joinSegments;
}
public void setJoinSegments(boolean joinSegments) {
this.joinSegments = joinSegments;
}
public int getColor() { public int getColor() {
return color; return color;
} }

View file

@ -412,7 +412,13 @@ public class TrackActivity extends TabActivity {
public boolean setJoinSegments(boolean joinSegments) { public boolean setJoinSegments(boolean joinSegments) {
if (gpxDataItem != null) { if (gpxDataItem != null) {
return app.getGpxDbHelper().updateJoinSegments(gpxDataItem, joinSegments); boolean updated = app.getGpxDbHelper().updateJoinSegments(gpxDataItem, joinSegments);
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(gpxFile.path);
if (updated && selectedGpxFile != null) {
selectedGpxFile.setJoinSegments(joinSegments);
}
return updated;
} }
return false; return false;
} }

View file

@ -1230,7 +1230,7 @@ public class GpxUiHelper {
} }
private static List<Entry> calculateElevationArray(GPXTrackAnalysis analysis, GPXDataSetAxisType axisType, private static List<Entry> calculateElevationArray(GPXTrackAnalysis analysis, GPXDataSetAxisType axisType,
float divX, float convEle, boolean useGeneralTrackPoints) { float divX, float convEle, boolean useGeneralTrackPoints, boolean calcGaps) {
List<Entry> values = new ArrayList<>(); List<Entry> values = new ArrayList<>();
List<Elevation> elevationData = analysis.elevationData; List<Elevation> elevationData = analysis.elevationData;
float nextX = 0; float nextX = 0;
@ -1252,7 +1252,9 @@ public class GpxUiHelper {
x = e.distance; x = e.distance;
} }
if (x > 0) { if (x > 0) {
if (!(!calcGaps && e.firstPoint && lastEntry != null)) {
nextX += x / divX; nextX += x / divX;
}
if (!Float.isNaN(e.elevation)) { if (!Float.isNaN(e.elevation)) {
elev = e.elevation; elev = e.elevation;
if (prevElevOrig != -80000) { if (prevElevOrig != -80000) {
@ -1383,7 +1385,8 @@ public class GpxUiHelper {
@NonNull GPXTrackAnalysis analysis, @NonNull GPXTrackAnalysis analysis,
@NonNull GPXDataSetAxisType axisType, @NonNull GPXDataSetAxisType axisType,
boolean useRightAxis, boolean useRightAxis,
boolean drawFilled) { boolean drawFilled,
boolean calcGaps) {
OsmandSettings settings = ctx.getSettings(); OsmandSettings settings = ctx.getSettings();
OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.get(); OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.get();
boolean useFeet = (mc == OsmandSettings.MetricsConstants.MILES_AND_FEET) || (mc == OsmandSettings.MetricsConstants.MILES_AND_YARDS); boolean useFeet = (mc == OsmandSettings.MetricsConstants.MILES_AND_FEET) || (mc == OsmandSettings.MetricsConstants.MILES_AND_YARDS);
@ -1393,11 +1396,11 @@ public class GpxUiHelper {
float divX; float divX;
XAxis xAxis = mChart.getXAxis(); XAxis xAxis = mChart.getXAxis();
if (axisType == GPXDataSetAxisType.TIME && analysis.isTimeSpecified()) { if (axisType == GPXDataSetAxisType.TIME && analysis.isTimeSpecified()) {
divX = setupXAxisTime(xAxis, analysis.timeSpan); divX = setupXAxisTime(xAxis, calcGaps ? analysis.timeSpan : analysis.timeSpanWithoutGaps);
} else if (axisType == GPXDataSetAxisType.TIMEOFDAY && analysis.isTimeSpecified()) { } else if (axisType == GPXDataSetAxisType.TIMEOFDAY && analysis.isTimeSpecified()) {
divX = setupXAxisTimeOfDay(xAxis, analysis.startTime); divX = setupXAxisTimeOfDay(xAxis, analysis.startTime);
} else { } else {
divX = setupAxisDistance(ctx, xAxis, analysis.totalDistance); divX = setupAxisDistance(ctx, xAxis, calcGaps ? analysis.totalDistance : analysis.totalDistanceWithoutGaps);
} }
final String mainUnitY = useFeet ? ctx.getString(R.string.foot) : ctx.getString(R.string.m); final String mainUnitY = useFeet ? ctx.getString(R.string.foot) : ctx.getString(R.string.m);
@ -1421,7 +1424,7 @@ public class GpxUiHelper {
} }
}); });
List<Entry> values = calculateElevationArray(analysis, axisType, divX, convEle, true); List<Entry> values = calculateElevationArray(analysis, axisType, divX, convEle, true, calcGaps);
OrderedLineDataSet dataSet = new OrderedLineDataSet(values, "", GPXDataSetType.ALTITUDE, axisType); OrderedLineDataSet dataSet = new OrderedLineDataSet(values, "", GPXDataSetType.ALTITUDE, axisType);
dataSet.priority = (float) (analysis.avgElevation - analysis.minElevation) * convEle; dataSet.priority = (float) (analysis.avgElevation - analysis.minElevation) * convEle;
@ -1640,7 +1643,8 @@ public class GpxUiHelper {
@NonNull GPXDataSetAxisType axisType, @NonNull GPXDataSetAxisType axisType,
@Nullable List<Entry> eleValues, @Nullable List<Entry> eleValues,
boolean useRightAxis, boolean useRightAxis,
boolean drawFilled) { boolean drawFilled,
boolean calcGaps) {
if (axisType == GPXDataSetAxisType.TIME || axisType == GPXDataSetAxisType.TIMEOFDAY) { if (axisType == GPXDataSetAxisType.TIME || axisType == GPXDataSetAxisType.TIMEOFDAY) {
return null; return null;
} }
@ -1649,10 +1653,10 @@ public class GpxUiHelper {
OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.get(); OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.get();
boolean useFeet = (mc == OsmandSettings.MetricsConstants.MILES_AND_FEET) || (mc == OsmandSettings.MetricsConstants.MILES_AND_YARDS); boolean useFeet = (mc == OsmandSettings.MetricsConstants.MILES_AND_FEET) || (mc == OsmandSettings.MetricsConstants.MILES_AND_YARDS);
final float convEle = useFeet ? 3.28084f : 1.0f; final float convEle = useFeet ? 3.28084f : 1.0f;
final float totalDistance = analysis.totalDistance; final float totalDistance = calcGaps ? analysis.totalDistance : analysis.totalDistanceWithoutGaps;
XAxis xAxis = mChart.getXAxis(); XAxis xAxis = mChart.getXAxis();
float divX = setupAxisDistance(ctx, xAxis, analysis.totalDistance); float divX = setupAxisDistance(ctx, xAxis, calcGaps ? analysis.totalDistance : analysis.totalDistanceWithoutGaps);
final String mainUnitY = "%"; final String mainUnitY = "%";
@ -1677,7 +1681,7 @@ public class GpxUiHelper {
List<Entry> values; List<Entry> values;
if (eleValues == null) { if (eleValues == null) {
values = calculateElevationArray(analysis, GPXDataSetAxisType.DISTANCE, 1f, 1f, false); values = calculateElevationArray(analysis, GPXDataSetAxisType.DISTANCE, 1f, 1f, false, calcGaps);
} else { } else {
values = new ArrayList<>(eleValues.size()); values = new ArrayList<>(eleValues.size());
for (Entry e : eleValues) { for (Entry e : eleValues) {

View file

@ -586,7 +586,7 @@ public class TrackDetailsMenu {
switch (gpxItem.chartTypes[i]) { switch (gpxItem.chartTypes[i]) {
case ALTITUDE: case ALTITUDE:
dataSet = GpxUiHelper.createGPXElevationDataSet(app, chart, analysis, dataSet = GpxUiHelper.createGPXElevationDataSet(app, chart, analysis,
gpxItem.chartAxisType, false, true); gpxItem.chartAxisType, false, true, false);
break; break;
case SPEED: case SPEED:
dataSet = GpxUiHelper.createGPXSpeedDataSet(app, chart, analysis, dataSet = GpxUiHelper.createGPXSpeedDataSet(app, chart, analysis,
@ -594,7 +594,7 @@ public class TrackDetailsMenu {
break; break;
case SLOPE: case SLOPE:
dataSet = GpxUiHelper.createGPXSlopeDataSet(app, chart, analysis, dataSet = GpxUiHelper.createGPXSlopeDataSet(app, chart, analysis,
gpxItem.chartAxisType, null, gpxItem.chartTypes.length > 1, true); gpxItem.chartAxisType, null, gpxItem.chartTypes.length > 1, true, false);
break; break;
} }
if (dataSet != null) { if (dataSet != null) {

View file

@ -529,7 +529,7 @@ public class SplitSegmentDialogFragment extends DialogFragment {
TextView distanceOrTimeSpanText = (TextView) convertView.findViewById(R.id.distance_or_time_span_text); TextView distanceOrTimeSpanText = (TextView) convertView.findViewById(R.id.distance_or_time_span_text);
if (position == 0) { if (position == 0) {
distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_track_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_track_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0));
float totalDistance = joinSegments && gpxItem.isGeneralTrack() ? analysis.totalDistanceWithoutGaps : analysis.totalDistance; float totalDistance = joinSegments && gpxItem.isGeneralTrack() ? analysis.totalDistance : analysis.totalDistanceWithoutGaps;
distanceOrTimeSpanValue.setText(OsmAndFormatter.getFormattedDistance(totalDistance, app)); distanceOrTimeSpanValue.setText(OsmAndFormatter.getFormattedDistance(totalDistance, app));
distanceOrTimeSpanText.setText(app.getString(R.string.distance)); distanceOrTimeSpanText.setText(app.getString(R.string.distance));
} else { } else {

View file

@ -12,13 +12,13 @@ import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.TrkSegment;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.QuadRect; import net.osmand.data.QuadRect;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.plus.GPXDatabase.GpxDataItem; import net.osmand.plus.GPXDatabase.GpxDataItem;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.TrkSegment;
import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -60,9 +60,11 @@ public class TrackBitmapDrawer {
public interface TrackBitmapDrawerListener { public interface TrackBitmapDrawerListener {
void onTrackBitmapDrawing(); void onTrackBitmapDrawing();
void onTrackBitmapDrawn(); void onTrackBitmapDrawn();
boolean isTrackBitmapSelectionSupported(); boolean isTrackBitmapSelectionSupported();
void drawTrackBitmap(Bitmap bitmap); void drawTrackBitmap(Bitmap bitmap);
} }
@ -205,7 +207,10 @@ public class TrackBitmapDrawer {
if (gpxFile.showCurrentTrack) { if (gpxFile.showCurrentTrack) {
sf = app.getSavingTrackHelper().getCurrentTrack(); sf = app.getSavingTrackHelper().getCurrentTrack();
} else { } else {
sf = app.getSelectedGpxHelper().getSelectedFileByPath(gpxFile.path);
if (sf == null) {
sf = new GpxSelectionHelper.SelectedGpxFile(); sf = new GpxSelectionHelper.SelectedGpxFile();
}
sf.setGpxFile(gpxFile, app); sf.setGpxFile(gpxFile, app);
} }
Bitmap bmp = mapBitmap.copy(mapBitmap.getConfig(), true); Bitmap bmp = mapBitmap.copy(mapBitmap.getConfig(), true);

View file

@ -435,8 +435,10 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
analysis, GPXDataSetAxisType.DISTANCE, true, true); analysis, GPXDataSetAxisType.DISTANCE, true, true);
} }
if (analysis.hasElevationData) { if (analysis.hasElevationData) {
GpxDataItem gpxDataItem = getGpxDataItem();
boolean calcGaps = gpxDataItem != null && gpxDataItem.isJoinSegments() && gpxItem.isGeneralTrack() || !gpxItem.isGeneralTrack();
elevationDataSet = GpxUiHelper.createGPXElevationDataSet(app, chart, elevationDataSet = GpxUiHelper.createGPXElevationDataSet(app, chart,
analysis, GPXDataSetAxisType.DISTANCE, false, true); analysis, GPXDataSetAxisType.DISTANCE, false, true, calcGaps);
} }
if (speedDataSet != null) { if (speedDataSet != null) {
dataSets.add(speedDataSet); dataSets.add(speedDataSet);
@ -451,15 +453,17 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
break; break;
} }
case GPX_TAB_ITEM_ALTITUDE: { case GPX_TAB_ITEM_ALTITUDE: {
GpxDataItem gpxDataItem = getGpxDataItem();
boolean calcGaps = gpxDataItem != null && gpxDataItem.isJoinSegments() && gpxItem.isGeneralTrack() || !gpxItem.isGeneralTrack();
OrderedLineDataSet elevationDataSet = GpxUiHelper.createGPXElevationDataSet(app, chart, OrderedLineDataSet elevationDataSet = GpxUiHelper.createGPXElevationDataSet(app, chart,
analysis, GPXDataSetAxisType.DISTANCE, false, true); analysis, GPXDataSetAxisType.DISTANCE, false, true, calcGaps);
if (elevationDataSet != null) { if (elevationDataSet != null) {
dataSets.add(elevationDataSet); dataSets.add(elevationDataSet);
} }
if (analysis.hasElevationData) { if (analysis.hasElevationData) {
List<Entry> eleValues = elevationDataSet != null && !gpxItem.isGeneralTrack() ? elevationDataSet.getValues() : null; List<Entry> eleValues = elevationDataSet != null && !gpxItem.isGeneralTrack() ? elevationDataSet.getValues() : null;
OrderedLineDataSet slopeDataSet = GpxUiHelper.createGPXSlopeDataSet(app, chart, OrderedLineDataSet slopeDataSet = GpxUiHelper.createGPXSlopeDataSet(app, chart,
analysis, GPXDataSetAxisType.DISTANCE, eleValues, true, true); analysis, GPXDataSetAxisType.DISTANCE, eleValues, true, true, calcGaps);
if (slopeDataSet != null) { if (slopeDataSet != null) {
dataSets.add(slopeDataSet); dataSets.add(slopeDataSet);
} }
@ -720,7 +724,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
public void onClick(View v) { public void onClick(View v) {
TrackActivity activity = getTrackActivity(); TrackActivity activity = getTrackActivity();
if (activity != null && activity.setJoinSegments(!activity.isJoinSegments())) { if (activity != null && activity.setJoinSegments(!activity.isJoinSegments())) {
updateSplitView(); updateContent();
for (int i = 0; i < getCount(); i++) { for (int i = 0; i < getCount(); i++) {
View view = getViewAtPosition(i); View view = getViewAtPosition(i);
updateJoinGapsInfo(view, i); updateJoinGapsInfo(view, i);
@ -1156,14 +1160,14 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
((SwitchCompat) view.findViewById(R.id.gpx_join_gaps_switch)).setChecked(joinSegments); ((SwitchCompat) view.findViewById(R.id.gpx_join_gaps_switch)).setChecked(joinSegments);
if (analysis != null) { if (analysis != null) {
if (tabType.equals(GPXTabItemType.GPX_TAB_ITEM_GENERAL)) { if (tabType.equals(GPXTabItemType.GPX_TAB_ITEM_GENERAL)) {
float totalDistance = joinSegments && gpxItem.isGeneralTrack() ? analysis.totalDistanceWithoutGaps : analysis.totalDistance; float totalDistance = !joinSegments && gpxItem.isGeneralTrack() ? analysis.totalDistanceWithoutGaps : analysis.totalDistance;
float timeSpan = joinSegments && gpxItem.isGeneralTrack() ? analysis.timeSpanWithoutGaps : analysis.timeSpan; float timeSpan = !joinSegments && gpxItem.isGeneralTrack() ? analysis.timeSpanWithoutGaps : analysis.timeSpan;
((TextView) view.findViewById(R.id.distance_text)).setText(OsmAndFormatter.getFormattedDistance(totalDistance, app)); ((TextView) view.findViewById(R.id.distance_text)).setText(OsmAndFormatter.getFormattedDistance(totalDistance, app));
((TextView) view.findViewById(R.id.duration_text)).setText(Algorithms.formatDuration((int) (timeSpan / 1000), app.accessibilityEnabled())); ((TextView) view.findViewById(R.id.duration_text)).setText(Algorithms.formatDuration((int) (timeSpan / 1000), app.accessibilityEnabled()));
} else if (tabType.equals(GPXTabItemType.GPX_TAB_ITEM_SPEED)) { } else if (tabType.equals(GPXTabItemType.GPX_TAB_ITEM_SPEED)) {
long timeMoving = joinSegments && gpxItem.isGeneralTrack() ? analysis.timeMovingWithoutGaps : analysis.timeMoving; long timeMoving = !joinSegments && gpxItem.isGeneralTrack() ? analysis.timeMovingWithoutGaps : analysis.timeMoving;
float totalDistanceMoving = joinSegments && gpxItem.isGeneralTrack() ? analysis.totalDistanceMovingWithoutGaps : analysis.totalDistanceMoving; float totalDistanceMoving = !joinSegments && gpxItem.isGeneralTrack() ? analysis.totalDistanceMovingWithoutGaps : analysis.totalDistanceMoving;
((TextView) view.findViewById(R.id.time_moving_text)).setText(Algorithms.formatDuration((int) (timeMoving / 1000), app.accessibilityEnabled())); ((TextView) view.findViewById(R.id.time_moving_text)).setText(Algorithms.formatDuration((int) (timeMoving / 1000), app.accessibilityEnabled()));
((TextView) view.findViewById(R.id.distance_text)).setText(OsmAndFormatter.getFormattedDistance(totalDistanceMoving, app)); ((TextView) view.findViewById(R.id.distance_text)).setText(OsmAndFormatter.getFormattedDistance(totalDistanceMoving, app));

View file

@ -244,11 +244,11 @@ public class RouteStatisticCard extends BaseCard {
List<ILineDataSet> dataSets = new ArrayList<>(); List<ILineDataSet> dataSets = new ArrayList<>();
OrderedLineDataSet slopeDataSet = null; OrderedLineDataSet slopeDataSet = null;
OrderedLineDataSet elevationDataSet = GpxUiHelper.createGPXElevationDataSet(app, mChart, analysis, OrderedLineDataSet elevationDataSet = GpxUiHelper.createGPXElevationDataSet(app, mChart, analysis,
GPXDataSetAxisType.DISTANCE, false, true); GPXDataSetAxisType.DISTANCE, false, true, false);
if (elevationDataSet != null) { if (elevationDataSet != null) {
dataSets.add(elevationDataSet); dataSets.add(elevationDataSet);
slopeDataSet = GpxUiHelper.createGPXSlopeDataSet(app, mChart, analysis, slopeDataSet = GpxUiHelper.createGPXSlopeDataSet(app, mChart, analysis,
GPXDataSetAxisType.DISTANCE, elevationDataSet.getValues(), true, true); GPXDataSetAxisType.DISTANCE, elevationDataSet.getValues(), true, true, false);
} }
if (slopeDataSet != null) { if (slopeDataSet != null) {
dataSets.add(slopeDataSet); dataSets.add(slopeDataSet);

View file

@ -120,11 +120,11 @@ public class SimpleRouteCard extends BaseCard {
List<ILineDataSet> dataSets = new ArrayList<>(); List<ILineDataSet> dataSets = new ArrayList<>();
OrderedLineDataSet slopeDataSet = null; OrderedLineDataSet slopeDataSet = null;
OrderedLineDataSet elevationDataSet = GpxUiHelper.createGPXElevationDataSet(app, mChart, analysis, OrderedLineDataSet elevationDataSet = GpxUiHelper.createGPXElevationDataSet(app, mChart, analysis,
GpxUiHelper.GPXDataSetAxisType.DISTANCE, false, true); GpxUiHelper.GPXDataSetAxisType.DISTANCE, false, true, false);
if (elevationDataSet != null) { if (elevationDataSet != null) {
dataSets.add(elevationDataSet); dataSets.add(elevationDataSet);
slopeDataSet = GpxUiHelper.createGPXSlopeDataSet(app, mChart, analysis, slopeDataSet = GpxUiHelper.createGPXSlopeDataSet(app, mChart, analysis,
GpxUiHelper.GPXDataSetAxisType.DISTANCE, elevationDataSet.getValues(), true, true); GpxUiHelper.GPXDataSetAxisType.DISTANCE, elevationDataSet.getValues(), true, true, false);
} }
if (slopeDataSet != null) { if (slopeDataSet != null) {
dataSets.add(slopeDataSet); dataSets.add(slopeDataSet);