Esempio n. 1
0
  private void loadJourney() {
    // Otherwise, we need to query DB and build points from scratch.
    gpspoints = new ArrayList<>();

    mDb.openReadOnly();

    Cursor points = mDb.fetchAllCoordsForTrip(tripid);
    int COL_LAT = points.getColumnIndex("lat");
    int COL_LGT = points.getColumnIndex("lgt");
    int COL_TIME = points.getColumnIndex("time");
    int COL_ACC = points.getColumnIndex(DbAdapter.K_POINT_ACC);
    int COL_SPEED = points.getColumnIndex(DbAdapter.K_POINT_SPEED);
    int COL_ALT = points.getColumnIndex(DbAdapter.K_POINT_ALT);

    while (!points.isAfterLast()) {
      int lat = points.getInt(COL_LAT);
      int lgt = points.getInt(COL_LGT);
      long time = points.getInt(COL_TIME);
      double altitude = points.getDouble(COL_ALT);
      float speed = (float) points.getDouble(COL_SPEED);
      float acc = (float) points.getDouble(COL_ACC);

      gpspoints.add(new CyclePoint(lat, lgt, time, acc, altitude, speed));

      points.moveToNext();
    } // while
    points.close();
    mDb.close();
  } // loadJourney
Esempio n. 2
0
  // Get lat/long extremes, etc, from trip record
  private void populateDetails() {
    mDb.openReadOnly();

    Cursor tripdetails = mDb.fetchTrip(tripid);
    startTime_ = tripdetails.getInt(tripdetails.getColumnIndex("start"));
    status = tripdetails.getInt(tripdetails.getColumnIndex("status"));
    endTime_ = tripdetails.getInt(tripdetails.getColumnIndex("endtime"));
    distance = tripdetails.getFloat(tripdetails.getColumnIndex("distance"));

    purp_ = tripdetails.getString(tripdetails.getColumnIndex("purp"));
    fancystart_ = tripdetails.getString(tripdetails.getColumnIndex("fancystart"));
    info_ = tripdetails.getString(tripdetails.getColumnIndex("fancyinfo"));
    note_ = tripdetails.getString(tripdetails.getColumnIndex("note"));
    age_ = tripdetails.getString(tripdetails.getColumnIndex("age"));
    gender_ = tripdetails.getString(tripdetails.getColumnIndex("gender"));
    experience_ = tripdetails.getString(tripdetails.getColumnIndex("experience"));

    tripdetails.close();
    mDb.close();

    loadJourney();
  }