public override void Build(IGroup group, DXCanvas canvas) { DynamicMesh meshBuilder = canvas.CreateMesh(DXCanvas.MeshType.Tris); DynamicMesh lineBuilder = canvas.CreateMesh(DXCanvas.MeshType.Lines); double duration = (group.Finish - group.Start).TotalSeconds; ILine line = DataContext; double maxValue = line.Points.Max(p => p.Value); List <Point> points = line.Points.ConvertAll(p => new Point((p.Key - group.Start).TotalSeconds / duration, 1.0 - p.Value / maxValue)); for (int i = 0; i < points.Count - 1; ++i) { lineBuilder.AddLine(points[i], points[i + 1], line.StrokeColor); } Mesh = meshBuilder.Freeze(canvas.RenderDevice); Lines = lineBuilder.Freeze(canvas.RenderDevice); }
public void InitForegroundLines(List <ITick> lines) { if (ForegroundMesh != null) { ForegroundMesh.Dispose(); } DynamicMesh builder = surface.CreateMesh(); builder.Geometry = Mesh.GeometryType.Lines; // Adding Frame separators if (lines != null) { foreach (ITick line in lines) { double x = Scroll.TimeToUnit(line); builder.AddLine(new Point(x, 0.0), new Point(x, 1.0), OptickAlternativeBackground.Color); } } ForegroundMesh = builder.Freeze(surface.RenderDevice); }