public override void Build(IGroup group, DXCanvas canvas) { TextBlocks = new List <TextEntry>(); DynamicMesh meshBuilder = canvas.CreateMesh(DXCanvas.MeshType.Tris); DynamicMesh lineBuilder = canvas.CreateMesh(DXCanvas.MeshType.Lines); MaxHeight = group.Height; Build(DataContext, DataContext, 0.0, meshBuilder, lineBuilder); Mesh = meshBuilder.Freeze(canvas.RenderDevice); Lines = lineBuilder.Freeze(canvas.RenderDevice); double duration = (group.Finish - group.Start).TotalSeconds; Matrix localTransform = new Matrix(); localTransform.Scale((DataContext.Finish - DataContext.Start).TotalSeconds / duration, 1.0); localTransform.Translate((DataContext.Start - group.Start).TotalSeconds / duration, 0.0); if (Mesh != null) { Mesh.LocalTransform = localTransform; } if (Lines != null) { Lines.LocalTransform = localTransform; } TextBlocks.Sort((a, b) => - a.Width.CompareTo(b.Width)); }
private void Surface_OnDraw(DXCanvas canvas, DXCanvas.Layer layer, ZoomCanvas.ZoomScroll scroll) { switch (layer) { case DXCanvas.Layer.Normal: foreach (Track track in Tracks) { track.Draw(canvas, layer, Board, scroll); } break; } }
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 override void Draw(DXCanvas canvas, DXCanvas.Layer layer, IBoard board, ZoomCanvas.ZoomScroll scroll, Vector offset) { canvas.Draw(Mesh); canvas.Draw(Lines); Segment unitBox = NormalizeTime(DataContext, board); double unitThreashold = scroll.ToUnitLength(TextDrawLimit); foreach (TextEntry block in TextBlocks) { double blockWidth = scroll.ToPixelLength(unitBox.Length * block.Width); if (blockWidth < TextDrawLimit) { break; } Point pixelPos = new Point(scroll.ToPixel(unitBox.Start + unitBox.Length * block.Position.X) + TextOffset, offset.Y + block.Position.Y * MaxHeight); canvas.Text.Draw(pixelPos, block.Text, Colors.Black, TextAlignment.Left, blockWidth); } }
internal void Draw(DXCanvas canvas, DXCanvas.Layer layer, IBoard board, ZoomCanvas.ZoomScroll scroll) { Children.ForEach(item => item.Draw(canvas, layer, board, scroll, Offset)); }
internal void Build(DXCanvas canvas) { Children.ForEach(item => item.Build(DataContext, canvas)); }
public override void Draw(DXCanvas canvas, DXCanvas.Layer layer, IBoard board, ZoomCanvas.ZoomScroll scroll, Vector offset) { canvas.Draw(Mesh); canvas.Draw(Lines); }
public abstract void Draw(DXCanvas canvas, DXCanvas.Layer layer, IBoard board, ZoomCanvas.ZoomScroll scroll, Vector offset);
public abstract void Build(IGroup group, DXCanvas canvas);