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


C# Point.First方法代码示例

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


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

示例1: Optimize

        public Directions Optimize(Point[] points)
        {
            DBC.Assert(points.Length > 1, "Unable to optimize a route with less than 2 points.");

            Log(points);

            if (IsSingleRouteDirections(points)) return BuildSingleRouteDirections(points);

            var graph = new DirectedGraph(points);
            var graphNavigator = new GraphNavigator(graph, points.First(), points.Last(), roadPathService);
            IList<Directions> cycles = graphNavigator.GetCycles();
            stitchingService = new StitchingService(cycles, graph);
            var stitched = stitchingService.Stitch();
            stitched.Order(points.First(), points.Last());
            return stitched;
        }
开发者ID:liammclennan,项目名称:shortest-path,代码行数:16,代码来源:DirectionsService.cs

示例2: _addSeriesAsPolyline

        private IEnumerable<Shape> _addSeriesAsPolyline(Point[] points, Brush color, double storkeThickness,
            bool animate = true)
        {
            if (points.Length < 2) return Enumerable.Empty<Shape>();
            var addedFigures = new List<Shape>();

            var l = 0d;
            for (var i = 1; i < points.Length; i++)
            {
                var p1 = points[i - 1];
                var p2 = points[i];
                l += Math.Sqrt(
                    Math.Pow(Math.Abs(p1.X - p2.X), 2) +
                    Math.Pow(Math.Abs(p1.Y - p2.Y), 2)
                    );
            }

            var f = points.First();
            var p = points.Where(x => x != f);
            var g = new PathGeometry
            {
                Figures = new PathFigureCollection(new List<PathFigure>
                {
                    new PathFigure
                    {
                        StartPoint = f,
                        Segments = new PathSegmentCollection(
                            p.Select(x => new LineSegment {Point = new Point(x.X, x.Y)}))
                    }
                })
            };

            var path = new Path
            {
                Stroke = color,
                StrokeThickness = storkeThickness,
                Data = g,
                StrokeEndLineCap = PenLineCap.Round,
                StrokeStartLineCap = PenLineCap.Round,
                StrokeDashOffset = l,
                StrokeDashArray = new DoubleCollection { l, l },
                ClipToBounds = true
            };

            var sp = points.ToList();
            sp.Add(new Point(points.Max(x => x.X), ToPlotArea(Chart.Min.Y, AxisTags.Y)));

            Chart.Canvas.Children.Add(path);
            addedFigures.Add(path);

            var draw = new DoubleAnimationUsingKeyFrames
            {
                BeginTime = TimeSpan.FromSeconds(0),
                KeyFrames = new DoubleKeyFrameCollection
                {
                    new SplineDoubleKeyFrame
                    {
                        KeyTime = TimeSpan.FromMilliseconds(1),
                        Value = l
                    },
                    new SplineDoubleKeyFrame
                    {
                        KeyTime = TimeSpan.FromMilliseconds(750),
                        Value = 0
                    }
                }
            };
            Storyboard.SetTarget(draw, path);
            Storyboard.SetTargetProperty(draw, new PropertyPath(Shape.StrokeDashOffsetProperty));
            var sbDraw = new Storyboard();
            sbDraw.Children.Add(draw);
            var animated = false;
            if (!Chart.DisableAnimation)
            {
                if (animate)
                {
                    sbDraw.Begin();
                    animated = true;
                }
            }
            if (!animated) path.StrokeDashOffset = 0;
            return addedFigures;
        }
开发者ID:gitter-badger,项目名称:Live-Charts,代码行数:83,代码来源:ScatterSeries.cs

示例3: DrawLines

 private void DrawLines(DrawingContext drawingContext, Pen pen, Point[] points)
 {
     var pathGeometry = new PathGeometry();
     var figure = new PathFigure(points.First(), points.Skip(1).Select(p => new LineSegment(p, true)), true);
     pathGeometry.Figures = new PathFigureCollection { figure };
     drawingContext.DrawGeometry(null, pen, pathGeometry);
 }
开发者ID:aabrohi,项目名称:kinect-kollage,代码行数:7,代码来源:InterfacePainter.cs


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