Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-02-24 17:51:07 +01:00
commit 514f10be3e
3 changed files with 21 additions and 6 deletions

View file

@ -26,6 +26,8 @@ import android.widget.ListView;
import android.widget.TextView;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import net.osmand.Location;
import net.osmand.data.PointDescription;
@ -51,6 +53,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static net.osmand.binary.RouteDataObject.HEIGHT_UNDEFINED;
@ -222,7 +225,15 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
});
GPXTrackAnalysis analysis = gpx.getAnalysis(0);
GpxUiHelper.setGPXElevationChartData(app, mChart, analysis, false, true);
List<ILineDataSet> dataSets = new ArrayList<>();
GpxUiHelper.OrderedLineDataSet elevationDataSet = GpxUiHelper.createGPXElevationDataSet(app, mChart, analysis, false, true);
dataSets.add(elevationDataSet);
if (analysis.elevationData.size() > 1) {
GpxUiHelper.OrderedLineDataSet slopeDataSet = GpxUiHelper.createGPXSlopeDataSet(app, mChart, analysis, true, true);
dataSets.add(slopeDataSet);
}
LineData data = new LineData(dataSets);
mChart.setData(data);
((TextView) headerView.findViewById(R.id.average_text))
.setText(OsmAndFormatter.getFormattedAlt(analysis.avgElevation, app));

View file

@ -1268,12 +1268,12 @@ public class GpxUiHelper {
nextXRaw += e.distance;
nextYRaw = (float) e.elevation;
nextX += (float) e.distance / divX;
if (nextXRaw - prevXRaw > 10) {
nextY = (nextYRaw - prevYRaw) / (nextXRaw - prevXRaw) * 100f;
nextY = (nextYRaw - prevYRaw) / (nextXRaw - prevXRaw) * 100f;
if (nextXRaw - prevXRaw > 50 && Math.abs(nextY) < 120) {
values.add(new Entry(nextX, nextY));
prevXRaw = nextXRaw;
prevYRaw = nextYRaw;
}
prevXRaw = nextXRaw;
prevYRaw = nextYRaw;
}
}
}
@ -1304,12 +1304,16 @@ public class GpxUiHelper {
dataSet.setDrawHorizontalHighlightIndicator(false);
dataSet.setHighLightColor(light ? mChart.getResources().getColor(R.color.secondary_text_light) : mChart.getResources().getColor(R.color.secondary_text_dark));
dataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);
/*
dataSet.setFillFormatter(new IFillFormatter() {
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
return dataProvider.getYChartMin();
}
});
*/
if (useRightAxis) {
dataSet.setAxisDependency(YAxis.AxisDependency.RIGHT);
}

View file

@ -354,7 +354,7 @@ public class TrackSegmentFragment extends SelectedGPXFragment {
OrderedLineDataSet elevationDataSet = GpxUiHelper.createGPXElevationDataSet(app, chart, analysis, false, true);
dataSets.add(elevationDataSet);
if (analysis.elevationData.size() > 1) {
OrderedLineDataSet slopeDataSet = GpxUiHelper.createGPXSlopeDataSet(app, chart, analysis, true, false);
OrderedLineDataSet slopeDataSet = GpxUiHelper.createGPXSlopeDataSet(app, chart, analysis, true, true);
dataSets.add(slopeDataSet);
}
LineData data = new LineData(dataSets);