TrackDao

interface TrackDao

DAO (Data Access Object) for Tracks and Waypoints. Handles all database operations for the track editor.

Functions

Link copied to clipboard
abstract suspend fun changeTrackId(fromTrackId: Int, toTrackId: Int)
Link copied to clipboard
open suspend fun clearAll()

Clears the entire database (both tracks and waypoints). Runs inside a single transaction to ensure atomicity.

Link copied to clipboard
abstract suspend fun clearTracks()

Delete all tracks from the database.

Link copied to clipboard
abstract suspend fun clearWaypoints()

Delete all waypoints from the database.

Link copied to clipboard
abstract suspend fun countWaypointsForTrack(trackId: Int): Int
Link copied to clipboard
abstract suspend fun countWaypointsForTracks(trackIds: List<Int>): Int
Link copied to clipboard
abstract suspend fun deleteSegment(trackId: Int, startId: Double, endId: Double)
Link copied to clipboard
abstract suspend fun deleteWaypoint(waypoint: WaypointEntity)

Delete a single waypoint debug (for debugging or global operations).

abstract suspend fun deleteWaypoint(trackId: Int, id: Double)
Link copied to clipboard
abstract suspend fun getAllWaypoints(): List<WaypointEntity>

Get all waypoints in the database (for debugging or global operations).

Link copied to clipboard
abstract suspend fun getIntervalSize(trackId: Int, p1: Double, p2: Double): Int
Link copied to clipboard
abstract suspend fun getTrackById(id: Int): TrackEntity?

Fetch a single track by its ID.

Link copied to clipboard
abstract suspend fun getTrackFirstWaypointId(trackId: Int): Double?
Link copied to clipboard
abstract suspend fun getTrackIds(): List<Int>
Link copied to clipboard
abstract suspend fun getTrackIdsWithVisibleWaypoints(latNorth: Double, latSouth: Double, lonWest: Double, lonEast: Double): List<Int>
Link copied to clipboard
abstract suspend fun getTrackLastWaypointId(trackId: Int): Double?
Link copied to clipboard
abstract suspend fun getTracksWithVisibleWaypoints(latNorth: Double, latSouth: Double, lonWest: Double, lonEast: Double): List<WaypointEntity>
Link copied to clipboard
abstract suspend fun getTracksWithVisibleWaypointsCount(latNorth: Double, latSouth: Double, lonWest: Double, lonEast: Double): Double
Link copied to clipboard
abstract suspend fun getTrackWaypoints(trackId: Int): List<WaypointEntity>

Get all waypoints for a specific track, ordered by their ID.

Link copied to clipboard
abstract suspend fun getTrackWaypointsSample(trackId: Int, sampleRate: Int): List<WaypointEntity>
Link copied to clipboard
abstract suspend fun getVisibleTrackWaypoints(trackId: Int, latNorth: Double, latSouth: Double, lonWest: Double, lonEast: Double): List<WaypointEntity>
Link copied to clipboard
abstract suspend fun getVisibleTrackWaypointsChunk(trackId: Int, latNorth: Double, latSouth: Double, lonWest: Double, lonEast: Double, chunkSize: Int, offset: Int): List<WaypointEntity>
Link copied to clipboard
abstract suspend fun getVisibleTrackWaypointsCount(trackId: Int, latNorth: Double, latSouth: Double, lonWest: Double, lonEast: Double): Double
Link copied to clipboard
abstract suspend fun getWaypoint(trackId: Int, index: Int): WaypointEntity?
Link copied to clipboard
abstract suspend fun getWaypointIndex(trackId: Int, id: Double): Int?
Link copied to clipboard
abstract suspend fun getWaypointsByChunk(trackId: Int, chunkSize: Int, offset: Int): List<WaypointEntity>
Link copied to clipboard
abstract suspend fun getWaypointsInBoundingBox(trackId: Int, south: Double, north: Double, west: Double, east: Double, step: Int = 1): List<WaypointEntity>
Link copied to clipboard
abstract suspend fun insertTrack(track: TrackEntity): Long

Insert a new Track into the database.

Link copied to clipboard
abstract suspend fun insertWaypoint(waypoint: WaypointEntity)

Insert a waypoint into the database. If the waypoint already exists, it will be replaced.

Link copied to clipboard
abstract suspend fun insertWaypoints(waypoints: List<WaypointEntity>)

Inserts a list of waypoints

Link copied to clipboard
open suspend fun insertWaypointWithTrackCheck(waypoint: WaypointEntity)

Inserts a waypoint, ensuring the parent track exists.

Link copied to clipboard
abstract suspend fun reassignIdsAscending(trackId: Int, newStart: Double, indexDescending: Boolean)
Link copied to clipboard
abstract suspend fun reassignIdsDescending(trackId: Int, newStart: Double, indexDescending: Boolean)
Link copied to clipboard
abstract suspend fun reassignReversedIds(trackId: Int)
abstract suspend fun reassignReversedIds(trackId: Int, p1: Double, p2: Double)
Link copied to clipboard
abstract suspend fun removeTrack(trackId: Int)
Link copied to clipboard
abstract suspend fun removeWaypointsByStep(trackId: Int, step: Int)
abstract suspend fun removeWaypointsByStep(trackId: Int, step: Int, p1: Double, p2: Double)
Link copied to clipboard
open suspend fun renumberTrack(trackId: Int, newStart: Double, descending: Boolean = false, indexDescending: Boolean = false)
Link copied to clipboard
open suspend fun reverseTrack(trackId: Int)
open suspend fun reverseTrack(trackId: Int, p1: Double, p2: Double)
Link copied to clipboard
abstract suspend fun shiftIds(trackId: Int)
abstract suspend fun shiftIds(trackId: Int, p1: Double, p2: Double)
Link copied to clipboard
abstract suspend fun shiftIdsTemporarily(trackId: Int)