Esempio n. 1
0
            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));
            }
Esempio n. 2
0
 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;
     }
 }
Esempio n. 3
0
            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);
            }
Esempio n. 4
0
            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);
                }
            }
Esempio n. 5
0
 internal void Draw(DXCanvas canvas, DXCanvas.Layer layer, IBoard board, ZoomCanvas.ZoomScroll scroll)
 {
     Children.ForEach(item => item.Draw(canvas, layer, board, scroll, Offset));
 }
Esempio n. 6
0
 internal void Build(DXCanvas canvas)
 {
     Children.ForEach(item => item.Build(DataContext, canvas));
 }
Esempio n. 7
0
 public override void Draw(DXCanvas canvas, DXCanvas.Layer layer, IBoard board, ZoomCanvas.ZoomScroll scroll, Vector offset)
 {
     canvas.Draw(Mesh);
     canvas.Draw(Lines);
 }
Esempio n. 8
0
 public abstract void Draw(DXCanvas canvas, DXCanvas.Layer layer, IBoard board, ZoomCanvas.ZoomScroll scroll, Vector offset);
Esempio n. 9
0
 public abstract void Build(IGroup group, DXCanvas canvas);