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


C# Point.Last方法代码示例

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


在下文中一共展示了Point.Last方法的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: GetRamerSampledPoints_NonRecursive

        /// <summary>
        /// Get ramer-sampled points without using recursive function. Call "ClearCache" function for recalculation
        /// </summary>
        /// <param name="dthres"></param>
        /// <returns></returns>
        public Point[] GetRamerSampledPoints_NonRecursive(double dthres)
        {
            if (this.ramerSampledPoints == null)
            {
                Point[] points = new Point[this.Points.Count];
                for (int i = 0, ilen = this.Points.Count; i < ilen; i++)
                {
                    points[i] = this.Points[i].PointObject;
                }
                List<Point> sampledPoints = new List<Point>();
                sampledPoints.Add(points[0]);
                sampledPoints.Add(points.Last());
                Queue<int[]> q = new Queue<int[]>();
                q.Enqueue(new int[] {0, points.Length - 1});

                while (q.Count != 0)
                {
                    double dmax = 0.0;
                    int max_index = 0;
                    int[] range = q.Dequeue();
                    for (int i = range[0] + 1; i < range[1]; i++)
                    {
                        double d = CommonFunction.PerpendicularDistance(points[i], points[range[0]], points[range[1]]);
                        if (dmax < d)
                        {
                            dmax = d;
                            max_index = i;
                        }
                    }

                    if (dthres < dmax)
                    {
                        sampledPoints.Add(points[max_index]);
                        q.Enqueue(new int[] { range[0], max_index });
                        q.Enqueue(new int[] { max_index, range[1] });
                    }
                }

                this.ramerSampledPoints = sampledPoints.ToArray();
            }

            return this.ramerSampledPoints;
        }
开发者ID:h-asai,项目名称:AnswersheetAnalysis,代码行数:48,代码来源:AnalysisPenStroke.cs

示例3: GetClickedPoint

        /// <summary>
        /// Gets the point where NotifyIcon is clicked by the position of ContextMenuStrip and NotifyIcon.
        /// </summary>
        /// <returns>Cursor location</returns>
        /// <remarks>MouseEventArgs.Location property of MouseClick event does not contain data.</remarks>
        private Point GetClickedPoint()
        {
            var contextMenuStrip = _notifyIcon.ContextMenuStrip;

            var corners = new Point[]
            {
                //new Point(contextMenuStrip.Left, contextMenuStrip.Top),
                //new Point(contextMenuStrip.Right, contextMenuStrip.Top),
                new Point(contextMenuStrip.Left, contextMenuStrip.Bottom),
                new Point(contextMenuStrip.Right, contextMenuStrip.Bottom)
            };

            var notifyIconRect = WindowPosition.GetNotifyIconRect(_notifyIcon);
            if (notifyIconRect != Rect.Empty)
            {
                foreach (var corner in corners)
                {
                    if (notifyIconRect.Contains(corner))
                        return corner;
                }
            }

            return corners.Last(); // Fallback
        }
开发者ID:emoacht,项目名称:WlanProfileViewer,代码行数:29,代码来源:NotifyIconComponent.cs


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