当前位置: 首页>>代码示例>>C#>>正文


C# Animation.LinkMany方法代码示例

本文整理汇总了C#中Animation.LinkMany方法的典型用法代码示例。如果您正苦于以下问题:C# Animation.LinkMany方法的具体用法?C# Animation.LinkMany怎么用?C# Animation.LinkMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Animation的用法示例。


在下文中一共展示了Animation.LinkMany方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateNetworkAnimation

        private static Animation CreateNetworkAnimation(Animation animation, Ani<GraphMessages> state, Lifetime life)
        {
            // --- end points
            // timeline
            animation.LinkMany(
                state.Select(s => s.Graph.EndPoints.Select(
                    p => new LineSegmentDesc(
                             new Point(s.Graph.GetX(p.Skew), s.Graph.GetY(p)).Sweep(new Vector(1000, 0)),
                             Brushes.Black,
                             3))),
                life);
            // timeline label
            animation.LinkMany(
                state.Select(s => s.Graph.EndPoints.Select(
                    p => new TextDesc(
                             text: p.Name,
                             pos: new Point(s.Graph.GetX(p.Skew), s.Graph.GetY(p)),
                             fontWeight: FontWeights.Bold,
                             reference: new Point(1.1, 0.5)))),
                life);
            // tick marks
            animation.LinkMany(
                state.Select(s => s.Graph.EndPoints.SelectMany(
                    p => 10.Range().Select(
                        j => new LineSegmentDesc(
                                 new Point(s.Graph.GetX(p.Skew + j.Seconds()), s.Graph.GetY(p) - 5).Sweep(new Vector(0, 10)),
                                 Brushes.Black,
                                 2)))),
                life);
            // tick labels
            animation.LinkMany(
                state.Select(s => s.Graph.EndPoints.SelectMany(
                    p => 10.Range().Select(
                        j => new TextDesc(
                                 text: (j + "s"),
                                 pos: new Point(s.Graph.GetX(p.Skew + j.Seconds()), s.Graph.GetY(p) - 5) + new Vector(0, -2),
                                 fontSize: 10)))),
                life);

            // --- measurements
            var measurements =
                from s in state
                select from m in s.Measurements
                       let x1 = s.Graph.GetX(m.X1)
                       let y1 = s.Graph.GetY(m.V1)
                       let x2 = s.Graph.GetX(m.X2)
                       let y2 = s.Graph.GetY(m.V2)
                       let y = m.Y ?? ((y1 + y2)/2)
                       select new {s, m, x1, y1, x2, y2, y};
            animation.LinkMany(
                measurements.LiftSelect(
                    e => new LineSegmentDesc(
                             new LineSegment(new Point(e.x1, e.y), new Point(e.x2, e.y)),
                             Brushes.Black,
                             2,
                             1)),
                life);
            animation.LinkMany(
                measurements.LiftSelect(
                    e => new LineSegmentDesc(
                             new LineSegment(new Point(e.x1, e.y1), new Point(e.x1, e.y)),
                             Brushes.Red,
                             dashed: 1)),
                    life);
            animation.LinkMany(
                measurements.LiftSelect(
                    e => new LineSegmentDesc(
                             new LineSegment(new Point(e.x2, e.y2), new Point(e.x2, e.y)),
                             Brushes.Red,
                             dashed: 1)),
                    life);
            var off1 = new Vector(5, -5);
            var off2 = new Vector(5, 12);
            animation.LinkMany(
                measurements.LiftSelect(
                    e => new TextDesc(
                        text: e.m.Text,
                        pos: new Point(Math.Max(e.x1, e.x2), e.y) + off1.Rotate(e.m.Angle),
                        direction: e.m.Angle)),
                    life);
            animation.LinkMany(
                measurements.LiftSelect(
                    e => new TextDesc(
                             text: string.Format("{0:0.00}s", (e.m.X2 - e.m.X1).TotalSeconds),
                             pos: new Point(Math.Max(e.x1, e.x2), e.y) + off2.Rotate(e.m.Angle),
                             direction: e.m.Angle)),
                life);

            // messages
            animation.LinkMany(
                state.Select(e => e.Messages).LiftSelect(
                    e => new LineSegmentDesc(
                             e.Pos,
                             Brushes.Black)),
                life);
            animation.LinkMany(
                state.Select(e => e.Messages.SelectMany(
                    m => new[] {m.PosSourcePoint, m.PosEndPoint}.Select(
                        p => new PointDesc(
                                 p,
//.........这里部分代码省略.........
开发者ID:siddht1,项目名称:AnimatronTheTerrible,代码行数:101,代码来源:NetworkSequenceDiagram.cs


注:本文中的Animation.LinkMany方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。