public class CrumbDatabase
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
CrumbDatabase.OnCrumbListener |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COLUMN_ID |
static java.lang.String |
COLUMN_LAT |
static java.lang.String |
COLUMN_LON |
static int |
DATABASE_VERSION |
static java.lang.String |
META_TRACK_CURRENT |
static java.lang.String |
META_TRACK_DBID |
static java.lang.String |
META_TRACK_DBIDS |
static java.lang.String |
META_TRACK_NODE_TITLE |
static java.lang.String |
META_TRACK_NODE_UID |
static java.lang.String |
SEG_COLUMN_TIMESTAMP |
static long |
STALE |
static java.lang.String |
TAG |
static double |
VALUE_UNKNOWN |
Modifier and Type | Method and Description |
---|---|
void |
addCrumbListener(CrumbDatabase.OnCrumbListener l) |
void |
createSegment(long timestamp,
int color,
java.lang.String title,
java.lang.String style,
java.lang.String userTitle,
java.lang.String userUid,
boolean bStitch)
Create new track segment with specified timestamp and style
If bStitch is true, then set last point for that UID in
the previous segment as the first point in this segment
|
void |
deleteAll()
Deprecated.
|
void |
deleteSegment(int track_dbid)
Given a segment identifier delete the segment
|
java.util.List<CrumbPoint> |
getCrumbPoints(int trackDbId) |
void |
getCrumbPoints(int trackDbId,
TrackPolyline track) |
java.util.List<Crumb> |
getCrumbs(int trackDbId)
Deprecated.
|
java.util.List<Crumb> |
getCrumbs(java.lang.String uid,
long startTime,
long endTime)
Get all crumbs in the specified time range
|
int |
getCurrentSegmentId(java.lang.String uid,
java.lang.String orderBy)
Get ID of segment with most recent timestamp
|
CrumbPoint |
getLastCrumb(int trackDbId)
Get last crumb for specified UID in specified track
|
TrackPolyline |
getMostRecentTrack(java.lang.String uid)
Returns the most recent track for a given user identifer
|
TrackPolyline |
getTrack(int trackDbId,
boolean bPoints) |
TrackPolyline |
getTrack(int trackDbId,
java.util.List<CrumbPoint> points)
Pull track metadata from DB and use 'crumbs' for the track points
|
TrackPolyline |
getTrack(java.lang.String callsign,
java.lang.String uid,
long timestamp,
java.util.List<Crumb> crumbs)
Create a polyline from the specified parameters
Does not access database
|
TrackPolyline |
getTrackByCallsign(java.lang.String callsign,
java.lang.String uid)
Get first track matching the callsign & title
|
TrackPolyline |
getTrackByTrackTitle(java.lang.String title,
java.lang.String uid)
Get first track matching the uid & title
|
java.util.List<TrackPolyline> |
getTracks(int[] trackIds,
TrackProgress progress)
Get tracks for the specified track IDs
|
java.util.List<TrackPolyline> |
getTracks(java.lang.String uid,
boolean bHideTemp,
boolean bDisplayAll,
TrackProgress progress)
Get tracks for the specified user UID
If bDisplayAll, then get all tracks, else
Get first 15 tracks, optionally skipping "temporary" tracks
|
java.util.List<TrackPolyline> |
getTracks(java.lang.String uid,
long startTime,
long endTime) |
java.util.List<TrackPolyline> |
getTracks(java.lang.String uid,
long startTime,
long endTime,
TrackProgress progress)
Get all tracks in the specified time range
|
java.util.List<TrackUser> |
getUserList()
Get list of users which have tracks in the local database
|
static CrumbDatabase |
instance() |
void |
persist(PointMapItem m,
long timestamp,
android.content.SharedPreferences prefs)
Writes the crumb for a PointMapItem to the database.
|
void |
removeCrumbListener(CrumbDatabase.OnCrumbListener l) |
int |
setServerTrack(java.lang.String callsign,
java.lang.String uid,
long startTime,
Track track,
android.content.SharedPreferences prefs)
We store server queried tracks once for a given uid/timestamp, in local DB.
|
void |
setTrackColor(int track_dbid,
java.lang.String color) |
void |
setTrackName(int track_dbid,
java.lang.String name) |
void |
setTrackStyle(int track_dbid,
java.lang.String style) |
public static final java.lang.String TAG
public static final int DATABASE_VERSION
public static final double VALUE_UNKNOWN
public static final java.lang.String COLUMN_ID
public static final java.lang.String COLUMN_LAT
public static final java.lang.String COLUMN_LON
public static final java.lang.String SEG_COLUMN_TIMESTAMP
public static final java.lang.String META_TRACK_DBID
public static final java.lang.String META_TRACK_CURRENT
public static final java.lang.String META_TRACK_DBIDS
public static final java.lang.String META_TRACK_NODE_UID
public static final java.lang.String META_TRACK_NODE_TITLE
public static final long STALE
public static CrumbDatabase instance()
@Deprecated public void deleteAll()
public int getCurrentSegmentId(java.lang.String uid, java.lang.String orderBy)
public void persist(PointMapItem m, long timestamp, android.content.SharedPreferences prefs)
m
- the point map to create a crumb fortimestamp
- the timestamp for the point map itemprefs
- the shared preference used to record the next
available track color.public void createSegment(long timestamp, int color, java.lang.String title, java.lang.String style, java.lang.String userTitle, java.lang.String userUid, boolean bStitch)
timestamp
- the timestamp for the segmentcolor
- the color of the segmenttitle
- the title of the segmentstyle
- how the segment should be styleduserTitle
- the title of the segmentuserUid
- the user id that represents the segmentbStitch
- true will result in the new segement being joined with the previous segmentpublic void deleteSegment(int track_dbid)
track_dbid
- the segment idpublic CrumbPoint getLastCrumb(int trackDbId)
trackDbId
- Track database ID@Deprecated public java.util.List<Crumb> getCrumbs(int trackDbId)
trackDbId
- Track database IDpublic java.util.List<CrumbPoint> getCrumbPoints(int trackDbId)
public void getCrumbPoints(int trackDbId, TrackPolyline track)
public java.util.List<TrackPolyline> getTracks(java.lang.String uid, long startTime, long endTime, TrackProgress progress)
uid
- the identifier for the map item that created the track (ie the user uid)startTime
- the start time for the trackendTime,
- if -1 then search all crumbs starting at startTimepublic java.util.List<TrackPolyline> getTracks(java.lang.String uid, long startTime, long endTime)
public java.util.List<Crumb> getCrumbs(java.lang.String uid, long startTime, long endTime)
uid
- the user identifier for the crumbs.startTime
- the start timeendTime,
- if -1 then search all crumbs starting at startTimepublic TrackPolyline getTrack(java.lang.String callsign, java.lang.String uid, long timestamp, java.util.List<Crumb> crumbs)
callsign
- Track callsignuid
- Track UIDtimestamp
- Track start timecrumbs
- List of crumbspublic TrackPolyline getTrack(int trackDbId, java.util.List<CrumbPoint> points)
trackDbId
- Track database IDpoints
- Crumb pointspublic TrackPolyline getTrack(int trackDbId, boolean bPoints)
public TrackPolyline getTrackByCallsign(java.lang.String callsign, java.lang.String uid)
callsign
- the title (callsign) for the trackuid
- the uid for the for the trackpublic TrackPolyline getTrackByTrackTitle(java.lang.String title, java.lang.String uid)
title
- the segment titleuid
- the uid for the user segmentpublic TrackPolyline getMostRecentTrack(java.lang.String uid)
uid
- the uidpublic java.util.List<TrackPolyline> getTracks(java.lang.String uid, boolean bHideTemp, boolean bDisplayAll, TrackProgress progress)
uid
- the user uidbHideTemp
- If true, omit tracks shorter than 10 minutes and did not move more than 100 metersbDisplayAll
- If true, include all tracks, otherwise include first 15 tracksprogress
- the progress callback for long running operatations.public java.util.List<TrackPolyline> getTracks(int[] trackIds, TrackProgress progress)
trackIds
- the list of track id'sprogress
- the progress callback for getting the tracks.public java.util.List<TrackUser> getUserList()
public void setTrackName(int track_dbid, java.lang.String name)
public void setTrackColor(int track_dbid, java.lang.String color)
public void setTrackStyle(int track_dbid, java.lang.String style)
public int setServerTrack(java.lang.String callsign, java.lang.String uid, long startTime, Track track, android.content.SharedPreferences prefs)
callsign
- uid
- startTime
- track
- public void addCrumbListener(CrumbDatabase.OnCrumbListener l)
public void removeCrumbListener(CrumbDatabase.OnCrumbListener l)