src/main/java/de/dennisguse/opentracks/data/ContentProviderUtils.java
static TrackPoint fillTrackPoint(Cursor cursor, CachedTrackPointsIndexes indexes) {
        Instant time = Instant.ofEpochMilli(cursor.getLong(indexes.timeIndex));
        TrackPoint trackPoint = new TrackPoint(TrackPoint.Type.getById(cursor.getInt(indexes.typeIndex)), time);
        trackPoint.setId(new TrackPoint.Id(cursor.getInt(indexes.idIndex)));

        if (!cursor.isNull(indexes.longitudeIndex)) {
            trackPoint.setLongitude(((double) cursor.getInt(indexes.longitudeIndex)) / 1E6);
        }
        if (!cursor.isNull(indexes.latitudeIndex)) {
            trackPoint.setLatitude(((double) cursor.getInt(indexes.latitudeIndex)) / 1E6);
        }
        if (!cursor.isNull(indexes.altitudeIndex)) {
            trackPoint.setAltitude(Altitude.WGS84.of(cursor.getFloat(indexes.altitudeIndex)));
        }
        if (!cursor.isNull(indexes.accuracyIndex)) {
            trackPoint.setHorizontalAccuracy(Distance.of(cursor.getFloat(indexes.accuracyIndex)));
        }
        if (!cursor.isNull(indexes.speedIndex)) {
            trackPoint.setSpeed(Speed.of(cursor.getFloat(indexes.speedIndex)));
        }
        if (!cursor.isNull(indexes.bearingIndex)) {
            trackPoint.setBearing(cursor.getFloat(indexes.bearingIndex));
        }

        if (!cursor.isNull(indexes.sensorHeartRateIndex)) {
            trackPoint.setHeartRate(cursor.getFloat(indexes.sensorHeartRateIndex));
        }
        if (!cursor.isNull(indexes.sensorCadenceIndex)) {
            trackPoint.setCadence(cursor.getFloat(indexes.sensorCadenceIndex));
        }
        if (!cursor.isNull(indexes.sensorDistanceIndex)) {
            trackPoint.setSensorDistance(Distance.of(cursor.getFloat(indexes.sensorDistanceIndex)));
        }
        if (!cursor.isNull(indexes.sensorPowerIndex)) {
            trackPoint.setPower(cursor.getFloat(indexes.sensorPowerIndex));
        }

        if (!cursor.isNull(indexes.altitudeGainIndex)) {
            trackPoint.setAltitudeGain(cursor.getFloat(indexes.altitudeGainIndex));
        }
        if (!cursor.isNull(indexes.altitudeLossIndex)) {
            trackPoint.setAltitudeLoss(cursor.getFloat(indexes.altitudeLossIndex));
        }

        return trackPoint;
    }
/**
     * Fills a {@link TrackPoint} from a cursor.
     *
     * @param cursor  the cursor pointing to a trackPoint.
     * @param indexes the cached trackPoints indexes
     */
Fills a  TrackPoint from a cursor.
@param cursor  the cursor pointing to a trackPoint.
@param indexes the cached trackPoints indexes
Fills a TrackPoint from a cursor . @param cursor the cursor pointing to a trackPoint . @param indexes the cached trackPoints indexes
static TrackPoint fillTrackPoint(Cursor cursor, CachedTrackPointsIndexes indexes) {
        Instant time = Instant.ofEpochMilli(cursor.getLong(indexes.timeIndex));
        TrackPoint trackPoint = new TrackPoint(TrackPoint.Type.getById(cursor.getInt(indexes.typeIndex)), time);
        trackPoint.setId(new TrackPoint.Id(cursor.getInt(indexes.idIndex)));
        if (!cursor.isNull(indexes.longitudeIndex)) {
            trackPoint.setLongitude(((double) cursor.getInt(indexes.longitudeIndex)) / 1E6);
        }
        if (!cursor.isNull(indexes.latitudeIndex)) {
            trackPoint.setLatitude(((double) cursor.getInt(indexes.latitudeIndex)) / 1E6);
        }
        if (!cursor.isNull(indexes.altitudeIndex)) {
            trackPoint.setAltitude(Altitude.WGS84.of(cursor.getFloat(indexes.altitudeIndex)));
        }
        if (!cursor.isNull(indexes.accuracyIndex)) {
            trackPoint.setHorizontalAccuracy(Distance.of(cursor.getFloat(indexes.accuracyIndex)));
        }
        if (!cursor.isNull(indexes.speedIndex)) {
            trackPoint.setSpeed(Speed.of(cursor.getFloat(indexes.speedIndex)));
        }
        if (!cursor.isNull(indexes.bearingIndex)) {
            trackPoint.setBearing(cursor.getFloat(indexes.bearingIndex));
        }
        if (!cursor.isNull(indexes.sensorHeartRateIndex)) {
            trackPoint.setHeartRate(cursor.getFloat(indexes.sensorHeartRateIndex));
        }
        if (!cursor.isNull(indexes.sensorCadenceIndex)) {
            trackPoint.setCadence(cursor.getFloat(indexes.sensorCadenceIndex));
        }
        if (!cursor.isNull(indexes.sensorDistanceIndex)) {
            trackPoint.setSensorDistance(Distance.of(cursor.getFloat(indexes.sensorDistanceIndex)));
        }
        if (!cursor.isNull(indexes.sensorPowerIndex)) {
            trackPoint.setPower(cursor.getFloat(indexes.sensorPowerIndex));
        }
        if (!cursor.isNull(indexes.altitudeGainIndex)) {
            trackPoint.setAltitudeGain(cursor.getFloat(indexes.altitudeGainIndex));
        }
        if (!cursor.isNull(indexes.altitudeLossIndex)) {
            trackPoint.setAltitudeLoss(cursor.getFloat(indexes.altitudeLossIndex));
        }
        return trackPoint;
    }
static TrackPoint fillTrackPoint ( Cursor cursor , CachedTrackPointsIndexes indexes ) { Instant time = Instant . ofEpochMilli ( cursor . getLong ( indexes . timeIndex ) ) ; TrackPoint trackPoint = new TrackPoint ( TrackPoint . Type . getById ( cursor . getInt ( indexes . typeIndex ) ) , time ) ; trackPoint . setId ( new TrackPoint . Id ( cursor . getInt ( indexes . idIndex ) ) ) ; if ( ! cursor . isNull ( indexes . longitudeIndex ) ) { trackPoint . setLongitude ( ( ( double ) cursor . getInt ( indexes . longitudeIndex ) ) / 1E6 ) ; } if ( ! cursor . isNull ( indexes . latitudeIndex ) ) { trackPoint . setLatitude ( ( ( double ) cursor . getInt ( indexes . latitudeIndex ) ) / 1E6 ) ; } if ( ! cursor . isNull ( indexes . altitudeIndex ) ) { trackPoint . setAltitude ( Altitude . WGS84 . of ( cursor . getFloat ( indexes . altitudeIndex ) ) ) ; } if ( ! cursor . isNull ( indexes . accuracyIndex ) ) { trackPoint . setHorizontalAccuracy ( Distance . of ( cursor . getFloat ( indexes . accuracyIndex ) ) ) ; } if ( ! cursor . isNull ( indexes . speedIndex ) ) { trackPoint . setSpeed ( Speed . of ( cursor . getFloat ( indexes . speedIndex ) ) ) ; } if ( ! cursor . isNull ( indexes . bearingIndex ) ) { trackPoint . setBearing ( cursor . getFloat ( indexes . bearingIndex ) ) ; } if ( ! cursor . isNull ( indexes . sensorHeartRateIndex ) ) { trackPoint . setHeartRate ( cursor . getFloat ( indexes . sensorHeartRateIndex ) ) ; } if ( ! cursor . isNull ( indexes . sensorCadenceIndex ) ) { trackPoint . setCadence ( cursor . getFloat ( indexes . sensorCadenceIndex ) ) ; } if ( ! cursor . isNull ( indexes . sensorDistanceIndex ) ) { trackPoint . setSensorDistance ( Distance . of ( cursor . getFloat ( indexes . sensorDistanceIndex ) ) ) ; } if ( ! cursor . isNull ( indexes . sensorPowerIndex ) ) { trackPoint . setPower ( cursor . getFloat ( indexes . sensorPowerIndex ) ) ; } if ( ! cursor . isNull ( indexes . altitudeGainIndex ) ) { trackPoint . setAltitudeGain ( cursor . getFloat ( indexes . altitudeGainIndex ) ) ; } if ( ! cursor . isNull ( indexes . altitudeLossIndex ) ) { trackPoint . setAltitudeLoss ( cursor . getFloat ( indexes . altitudeLossIndex ) ) ; } return trackPoint ; }
Fills a {@link TrackPoint} from a cursor.
Fills a { @link TrackPoint } from a cursor .