Search in sources :

Example 11 with GPXTrackAnalysis

use of net.osmand.plus.GPXUtilities.GPXTrackAnalysis in project Osmand by osmandapp.

the class GPXDatabase method readItem.

private GpxDataItem readItem(SQLiteCursor query) {
    String fileName = query.getString(0);
    String fileDir = query.getString(1);
    float totalDistance = (float) query.getDouble(2);
    int totalTracks = (int) query.getInt(3);
    long startTime = query.getLong(4);
    long endTime = query.getLong(5);
    long timeSpan = query.getLong(6);
    long timeMoving = query.getLong(7);
    float totalDistanceMoving = (float) query.getDouble(8);
    double diffElevationUp = query.getDouble(9);
    double diffElevationDown = query.getDouble(10);
    double avgElevation = query.getDouble(11);
    double minElevation = query.getDouble(12);
    double maxElevation = query.getDouble(13);
    float maxSpeed = (float) query.getDouble(14);
    float avgSpeed = (float) query.getDouble(15);
    int points = (int) query.getInt(16);
    int wptPoints = (int) query.getInt(17);
    String color = query.getString(18);
    long fileLastModifiedTime = query.getLong(19);
    int splitType = (int) query.getInt(20);
    double splitInterval = query.getDouble(21);
    boolean apiImported = query.getInt(22) == 1;
    String wptCategoryNames = query.getString(23);
    GPXTrackAnalysis a = new GPXTrackAnalysis();
    a.totalDistance = totalDistance;
    a.totalTracks = totalTracks;
    a.startTime = startTime;
    a.endTime = endTime;
    a.timeSpan = timeSpan;
    a.timeMoving = timeMoving;
    a.totalDistanceMoving = totalDistanceMoving;
    a.diffElevationUp = diffElevationUp;
    a.diffElevationDown = diffElevationDown;
    a.avgElevation = avgElevation;
    a.minElevation = minElevation;
    a.maxElevation = maxElevation;
    a.minSpeed = maxSpeed;
    a.maxSpeed = maxSpeed;
    a.avgSpeed = avgSpeed;
    a.points = points;
    a.wptPoints = wptPoints;
    if (wptCategoryNames != null) {
        a.wptCategoryNames = Algorithms.decodeStringSet(wptCategoryNames);
    }
    File dir;
    if (!Algorithms.isEmpty(fileDir)) {
        dir = new File(context.getAppPath(IndexConstants.GPX_INDEX_DIR), fileDir);
    } else {
        dir = context.getAppPath(IndexConstants.GPX_INDEX_DIR);
    }
    GpxDataItem item = new GpxDataItem(new File(dir, fileName), a);
    try {
        item.color = Algorithms.isEmpty(color) ? 0 : Algorithms.parseColor(color);
    } catch (IllegalArgumentException e) {
        item.color = 0;
    }
    item.fileLastModifiedTime = fileLastModifiedTime;
    item.splitType = splitType;
    item.splitInterval = splitInterval;
    item.apiImported = apiImported;
    return item;
}
Also used : GPXTrackAnalysis(net.osmand.plus.GPXUtilities.GPXTrackAnalysis) File(java.io.File)

Aggregations

GPXTrackAnalysis (net.osmand.plus.GPXUtilities.GPXTrackAnalysis)11 ImageView (android.widget.ImageView)4 TextView (android.widget.TextView)4 ArrayList (java.util.ArrayList)4 File (java.io.File)3 Date (java.util.Date)3 GPXFile (net.osmand.plus.GPXUtilities.GPXFile)3 SelectedGpxFile (net.osmand.plus.GpxSelectionHelper.SelectedGpxFile)3 Matrix (android.graphics.Matrix)2 PopupMenu (android.support.v7.widget.PopupMenu)2 MenuItem (android.view.MenuItem)2 MotionEvent (android.view.MotionEvent)2 View (android.view.View)2 LineChart (com.github.mikephil.charting.charts.LineChart)2 LineData (com.github.mikephil.charting.data.LineData)2 Highlight (com.github.mikephil.charting.highlight.Highlight)2 ILineDataSet (com.github.mikephil.charting.interfaces.datasets.ILineDataSet)2 OnChartGestureListener (com.github.mikephil.charting.listener.OnChartGestureListener)2 DateFormat (java.text.DateFormat)2 GpxDataItem (net.osmand.plus.GPXDatabase.GpxDataItem)2