public static IValueRangeSeries <DateTime> GetDateTimeFromChartResult(bool xIsTime, bool isOffset, TrailResult tr, TrailResult ReferenceTrailResult, IList <float[]> regions) { IValueRangeSeries <DateTime> t = new ValueRangeSeries <DateTime>(); foreach (float[] at in regions) { DateTime d1 = GetDateTimeFromChartResult(xIsTime, isOffset, tr, ReferenceTrailResult, at[0]); DateTime d2 = GetDateTimeFromChartResult(xIsTime, isOffset, tr, ReferenceTrailResult, at[1]); t.Add(new ValueRange <DateTime>(d1, d2)); } return(t); }
//Exclude the pauses from the selection public static IValueRangeSeries <DateTime> excludePauses(IValueRangeSeries <DateTime> sels, IValueRangeSeries <DateTime> pauses) { IValueRangeSeries <DateTime> t = new ValueRangeSeries <DateTime>(); foreach (IValueRange <DateTime> tsel in sels) { foreach (IValueRange <DateTime> t1 in DateTimeRangeSeries.TimesNotPaused( tsel.Lower, tsel.Upper, pauses)) { t.Add(t1); } } return(t); }
void summaryList_Click(object sender, System.EventArgs e) { //SelectTrack, for ST3 if (sender is TreeList) { TreeList l = sender as TreeList; TreeList.RowHitState hit; object row; //Note: As ST scrolls before Location is recorded, incorrect row may be selected... row = summaryList.RowHitTest(((MouseEventArgs)e).Location, out hit); if (row != null && hit == TreeList.RowHitState.Row && row is Result) { Result result = (Result)row; IActivity id = result.Activity; if (id != null && result.Seconds > 0) { if (m_showPage && isSingleView != true) { IDictionary<string, MapPolyline> routes = new Dictionary<string, MapPolyline>(); TrailMapPolyline m = new TrailMapPolyline( new TrailResult(new ActivityWrapper(id, Plugin.GetApplication().SystemPreferences.RouteSettings.RouteColor))); routes.Add(m.key, m); if (m_layer != null) { m_layer.TrailRoutes = routes; } } IValueRangeSeries<DateTime> t = new ValueRangeSeries<DateTime>(); t.Add(new ValueRange<DateTime>(result.DateStart, result.DateEnd)); IList<TrailResultMarked> aTrm = new List<TrailResultMarked>(); aTrm.Add(new TrailResultMarked( new TrailResult(new ActivityWrapper(id, Plugin.GetApplication().SystemPreferences.RouteSettings.RouteSelectedColor)), t)); this.MarkTrack(aTrm); } } } }
/**************************************************/ void summaryList_Click(object sender, System.EventArgs e) { //SelectTrack, for ST3 if (sender is TreeList) { TreeList l = sender as TreeList; TreeList.RowHitState hit; object row; //Note: As ST scrolls before Location is recorded, incorrect row may be selected... row = summaryList.RowHitTest(((MouseEventArgs)e).Location, out hit); if (row != null && hit == TreeList.RowHitState.Row && row is PredictorData) { PredictorData result = (PredictorData)row; if (result.source != null && result.source.Activity != null) { IActivity id = result.source.Activity; if (m_showPage) { IDictionary<string, MapPolyline> routes = new Dictionary<string, MapPolyline>(); TrailMapPolyline m = new TrailMapPolyline( new TrailResult(new ActivityWrapper(id, Plugin.GetApplication().SystemPreferences.RouteSettings.RouteColor))); routes.Add(m.key, m); if (m_layer != null) { m_layer.TrailRoutes = routes; } } IValueRangeSeries<DateTime> t = new ValueRangeSeries<DateTime>(); DateTime endTime; if (result.source.UsedTime.TotalSeconds > 0) { endTime = result.source.StartUsedTime.Add(result.source.UsedTime); } else { endTime = ActivityInfoCache.Instance.GetInfo(id).ActualTrackEnd; } t.Add(new ValueRange<DateTime>(result.source.StartUsedTime, endTime)); IList<TrailResultMarked> aTrm = new List<TrailResultMarked>(); aTrm.Add(new TrailResultMarked( new TrailResult(new ActivityWrapper(id, Plugin.GetApplication().SystemPreferences.RouteSettings.RouteSelectedColor)), t)); this.MarkTrack(aTrm); } } } }
//Exclude the pauses from the selection public static IValueRangeSeries<DateTime> excludePauses(IValueRangeSeries<DateTime> sels, IValueRangeSeries<DateTime> pauses) { IValueRangeSeries<DateTime> t = new ValueRangeSeries<DateTime>(); foreach (IValueRange<DateTime> tsel in sels) { foreach (IValueRange<DateTime> t1 in DateTimeRangeSeries.TimesNotPaused( tsel.Lower, tsel.Upper, pauses)) { t.Add(t1); } } return t; }