Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using Microsoft.Research.DynamicDataDisplay.Filters;
|
---|
6 | using Microsoft.Research.DynamicDataDisplay.Common;
|
---|
7 | using System.Collections.Specialized;
|
---|
8 | using System.Windows;
|
---|
9 |
|
---|
10 | namespace Microsoft.Research.DynamicDataDisplay.Charts
|
---|
11 | {
|
---|
12 | /// <summary>
|
---|
13 | /// Represents a collection of point filters of <see cref="LineGraph"/>.
|
---|
14 | /// </summary>
|
---|
15 | public sealed class FilterCollection : D3Collection<IPointsFilter>
|
---|
16 | {
|
---|
17 | protected override void OnItemAdding(IPointsFilter item)
|
---|
18 | {
|
---|
19 | if (item == null)
|
---|
20 | throw new ArgumentNullException("item");
|
---|
21 | }
|
---|
22 |
|
---|
23 | protected override void OnItemAdded(IPointsFilter item)
|
---|
24 | {
|
---|
25 | item.Changed += OnItemChanged;
|
---|
26 | }
|
---|
27 |
|
---|
28 | private void OnItemChanged(object sender, EventArgs e)
|
---|
29 | {
|
---|
30 | OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
---|
31 | }
|
---|
32 |
|
---|
33 | protected override void OnItemRemoving(IPointsFilter item)
|
---|
34 | {
|
---|
35 | item.Changed -= OnItemChanged;
|
---|
36 | }
|
---|
37 |
|
---|
38 | internal List<Point> Filter(List<Point> points, Rect screenRect)
|
---|
39 | {
|
---|
40 | foreach (var filter in Items)
|
---|
41 | {
|
---|
42 | filter.SetScreenRect(screenRect);
|
---|
43 | points = filter.Filter(points);
|
---|
44 | }
|
---|
45 |
|
---|
46 | return points;
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.