public static FlowCollection InFlow(this PoI source) { FlowCollection fc = null; if (!source.Data.ContainsKey("InFlow")) { fc = new FlowCollection(); source.Data["InFlow"] = fc; } else if (source.Data["InFlow"] is FlowCollection) { fc = (FlowCollection)source.Data["InFlow"]; } return fc ?? (fc = new FlowCollection()); }
public void UpdateNextStops() { if (Poi == null) return; NextStops = new FlowCollection(); NextStops.AddRange(Poi.Flow()); NextStops.AddRange(Poi.InFlow()); foreach (var fs in NextStops) { var etd = fs.Etd; if (etd < fs.Eta) etd = AppState.TimelineManager.End; var w = 1000.0 / (AppState.TimelineManager.End - AppState.TimelineManager.Start).TotalSeconds; fs.FlowBarLeft = (fs.Eta - AppState.TimelineManager.Start).TotalSeconds*w; fs.FlowBarWidth = (etd - fs.Eta).TotalSeconds*w; } FooView = CollectionViewSource.GetDefaultView(NextStops); FooView.Filter = TimeFilter; FooView.SortDescriptions.Add(new SortDescription() { PropertyName = "Eta", Direction = ListSortDirection.Ascending }); }