public Channel MakeChannel(ChannelInfo info) { var channel = new InterpolationChannel(info, this); int id = channel.GetId(); _channels[id] = channel; return(channel); }
public Image Draw(Viewport viewport) { Point[] bounds = viewport.GetUserBounds(); TTime[] timeRange = new TTime[] { bounds[0].X, bounds[1].X }; Image image = new Image(viewport); // recreate image // fill blank image.Rectangle(viewport.GetUserBounds()) .Add() .FillStroke(Color.LightYellow, Color.Empty); // draw grid for (int i = -1; i <= 1; ++i) { var p0 = new Point(bounds[0].X, i); var p1 = new Point(bounds[1].X, i); image.Line(new[] { p0, p1 }) .Add() .FillStroke(Color.Empty, Color.LightGray, strokeWidth: 0.01f); } // draw current time { var p0 = new Point((float)_currentTime, bounds[0].Y); var p1 = new Point((float)_currentTime, bounds[1].Y); image.Line(new[] { p0, p1 }) .Add() .FillStroke(Color.Empty, Color.Gray, strokeWidth: 0.01f); } // draw channels int segmentCount = 50; foreach (var i in _channels) { InterpolationChannel c = i.Value; Color color = ColorUtils.GetRareColor(c.GetId(), 0.5, 0.5); c.Draw(timeRange, image, segmentCount, color); } return(image); }