Fix gpx files import

This commit is contained in:
Vitaliy 2020-07-07 11:23:53 +03:00
parent 5f60f452c0
commit c18b5ba25c
2 changed files with 9 additions and 1 deletions

View file

@ -752,7 +752,7 @@ public class GPXDatabase {
GPX_COL_GRADIENT_ALTITUDE_COLOR + ", " +
GPX_COL_GRADIENT_SLOPE_COLOR + ", " +
GPX_COL_GRADIENT_SCALE_TYPE +
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
new Object[] {fileName, fileDir, color, 0, item.splitType, item.splitInterval,
item.apiImported ? 1 : 0, item.showAsMarkers ? 1 : 0, item.joinSegments ? 1 : 0,
item.showArrows ? 1 : 0, item.showStartFinish ? 1 : 0, item.width,

View file

@ -23,6 +23,7 @@ import net.osmand.AndroidUtils;
import net.osmand.CallbackWithObject;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.GPXFile.GradientScaleType;
import net.osmand.GPXUtilities.WptPt;
import net.osmand.IProgress;
import net.osmand.IndexConstants;
@ -1018,6 +1019,13 @@ public class ImportHelper {
File file = new File(gpxFile.path);
if (!destinationExists) {
GPXDatabase.GpxDataItem item = new GPXDatabase.GpxDataItem(file, gpxFile.getColor(0));
item.setWidth(gpxFile.getWidth(null));
item.setShowArrows(gpxFile.isShowArrows());
item.setShowStartFinish(gpxFile.isShowStartFinish());
item.setGradientScaleType(gpxFile.getGradientScaleType());
item.setGradientSpeedColor(gpxFile.getGradientScaleColor(GradientScaleType.SPEED, 0));
item.setGradientSlopeColor(gpxFile.getGradientScaleColor(GradientScaleType.SLOPE, 0));
item.setGradientAltitudeColor(gpxFile.getGradientScaleColor(GradientScaleType.ALTITUDE, 0));
app.getGpxDbHelper().add(item);
} else {
GPXDatabase.GpxDataItem item = app.getGpxDbHelper().getItem(file);