using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using System.Windows.Media;
namespace Microsoft.Research.DynamicDataDisplay.PointMarkers
{
/// Composite point markers renders a specified set of markers
/// at every point of graph
public sealed class CompositePointMarker : PointMarker {
public CompositePointMarker() { }
public CompositePointMarker(params PointMarker[] markers) {
if (markers == null)
throw new ArgumentNullException("markers");
foreach (PointMarker m in markers)
this.markers.Add(m);
}
public CompositePointMarker(IEnumerable markers) {
if (markers == null)
throw new ArgumentNullException("markers");
foreach (PointMarker m in markers)
this.markers.Add(m);
}
private readonly Collection markers = new Collection();
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public Collection Markers {
get { return markers; }
}
public override void Render(DrawingContext dc, Point screenPoint) {
LocalValueEnumerator enumerator = GetLocalValueEnumerator();
foreach (var marker in markers) {
enumerator.Reset();
while (enumerator.MoveNext()) {
marker.SetValue(enumerator.Current.Property, enumerator.Current.Value);
}
marker.Render(dc, screenPoint);
}
}
}
}