public static void collectDataForLog ( IHMConnection connection , GpsLog log ) throws Exception { long logId = log . id ; String query = "select " + // GpsLogsDataTableFields . COLUMN_DATA_LAT . getFieldName ( ) + "," + // GpsLogsDataTableFields . COLUMN_DATA_LON . getFieldName ( ) + "," + // GpsLogsDataTableFields . COLUMN_DATA_ALTIM . getFieldName ( ) + "," + // GpsLogsDataTableFields . COLUMN_DATA_TS . getFieldName ( ) + // " from " + TABLE_GPSLOG_DATA + " where " + // GpsLogsDataTableFields . COLUMN_LOGID . getFieldName ( ) + " = " + logId + " order by " + GpsLogsDataTableFields . COLUMN_DATA_TS . getFieldName ( ) ; try ( IHMStatement newStatement = connection . createStatement ( ) ; IHMResultSet result = newStatement . executeQuery ( query ) ; ) { newStatement . setQueryTimeout ( 30 ) ; while ( result . next ( ) ) { double lat = result . getDouble ( 1 ) ; double lon = result . getDouble ( 2 ) ; double altim = result . getDouble ( 3 ) ; long ts = result . getLong ( 4 ) ; GpsPoint gPoint = new GpsPoint ( ) ; gPoint . lon = lon ; gPoint . lat = lat ; gPoint . altim = altim ; gPoint . utctime = ts ; log . points . add ( gPoint ) ; } } }
Gather gps points data for a supplied log .