29 #include <wx/progdlg.h>
36 #include "hyperlink.h"
40 extern std::vector<Track*> g_TrackList;
51 TrackPoint(
double lat,
double lon, wxString ts =
"");
52 TrackPoint(
double lat,
double lon, wxDateTime dt);
56 wxDateTime GetCreateTime(
void);
57 void SetCreateTime(wxDateTime dt);
58 const char *GetTimeString() {
return m_stimestring.c_str(); }
59 bool HasValidTimestamp() {
60 if (m_stimestring.size() != strlen(
"YYYY-MM-DDTHH:MM:SSZ"))
70 void SetCreateTime(wxString ts);
71 std::string m_stimestring;
85 int GetnPoints(
void) {
return TrackPoints.size(); }
87 void SetVisible(
bool visible =
true) { m_bVisible = visible; }
92 TrackPoint *AddNewPoint(vector2D point, wxDateTime time);
94 void SetListed(
bool listed =
true) { m_bListed = listed; }
95 virtual bool IsRunning() {
return false; }
97 bool IsVisible() {
return m_bVisible; }
98 bool IsListed() {
return m_bListed; }
100 int GetCurrentTrackSeg() {
return m_CurrentTrackSeg; }
101 void SetCurrentTrackSeg(
int seg) { m_CurrentTrackSeg = seg; }
104 int Simplify(
double maxDelta);
105 Route *RouteFromTrack(wxGenericProgressDialog *pprog);
107 void ClearHighlights();
109 wxString GetName(
bool auto_if_empty =
false)
const {
110 if (!auto_if_empty || !m_TrackNameString.IsEmpty()) {
111 return m_TrackNameString;
115 if ((
int)TrackPoints.size() > 0) rp = TrackPoints[0];
116 if (rp && rp->GetCreateTime().IsValid())
117 name = rp->GetCreateTime().FormatISODate() + _T(
" ") +
121 name = _(
"(Unnamed Track)");
125 void SetName(
const wxString name) { m_TrackNameString = name; }
127 wxString GetDate(
bool auto_if_empty =
false)
const {
130 if ((
int)TrackPoints.size() > 0) rp = TrackPoints[0];
131 if (rp && rp->GetCreateTime().IsValid())
132 name = rp->GetCreateTime().FormatISODate() + _T(
" ") +
136 name = _(
"(Unknown Date)");
144 wxString m_TrackDescription;
146 wxString m_TrackStartString;
147 wxString m_TrackEndString;
157 int m_CurrentTrackSeg;
159 HyperlinkList *m_HyperlinkList;
160 int m_HighlightedTrackPoint;
162 void Clone(
Track *psourcetrack,
int start_nPoint,
int end_nPoint,
163 const wxString &suffix);
168 void DouglasPeuckerReducer(std::vector<TrackPoint *> &list,
169 std::vector<bool> &keeplist,
int from,
int to,
172 double GetXTE(
double fm1Lat,
double fm1Lon,
double fm2Lat,
double fm2Lon,
173 double toLat,
double toLon);
175 std::vector<TrackPoint *> TrackPoints;
176 std::vector<std::vector<SubTrack> > SubTracks;
183 double ComputeScale(
int left,
int right);
184 void InsertSubTracks(LLBBox &box,
int level,
int pos);
195 wxString m_TrackNameString;
204 void SetPrecision(
int precision);
207 void Stop(
bool do_add_point =
false);
208 Track *DoExtendDaily();
209 bool IsRunning() {
return m_bRunning; }
211 void AdjustCurrentTrackPoint(
TrackPoint *prototype);
214 void OnTimerTrack(wxTimerEvent &event);
215 void AddPointNow(
bool do_add_point =
false);
218 wxTimer m_TimerTrack;
221 double m_TrackTimerSec;
222 double m_allowedMaxXTE;
223 double m_allowedMaxAngle;
225 vector2D m_lastAddedPoint;
227 wxDateTime m_prev_time;
234 double m_minTrackpoint_delta;
236 enum eTrackPointState {
242 std::deque<vector2D> skipPoints;
243 std::deque<wxDateTime> skipTimes;
245 DECLARE_EVENT_TABLE()