當前位置: 首頁>>代碼示例>>C#>>正文


C# Point.Take方法代碼示例

本文整理匯總了C#中System.Point.Take方法的典型用法代碼示例。如果您正苦於以下問題:C# Point.Take方法的具體用法?C# Point.Take怎麽用?C# Point.Take使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Point的用法示例。


在下文中一共展示了Point.Take方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TransformToCoordinateAndFlagSequence

        /// <summary>
        /// Gets the coordinate and flag sequence arrays to be set as property values.
        /// </summary>
        /// <param name="points">The points to be transformed.</param>
        /// <param name="Coordinates">The coordinate sequence array.</param>
        /// <param name="Flags">The flag sequence array.</param>
        /// <param name="filterControlPoints">if set to <c>true</c> control points will be ignored during translation.</param>
        /// <returns>
        ///   <c>true</c> if successfully transformed; otherwise, <c>false</c>.
        /// </returns>
        internal static bool TransformToCoordinateAndFlagSequence(List<PolyPointDescriptor> points, out Point[] Coordinates, out unodrawing.PolygonFlags[] Flags, bool filterControlPoints = false)
        {
            bool success = false;
            Coordinates = null;
            Flags = null;

            if (points != null)
            {
                Coordinates = new Point[points.Count];
                Flags = new unodrawing.PolygonFlags[points.Count];

                if (points.Count > 0)
                {
                    try
                    {
                        int i = 0;
                        foreach (var item in points)
                        {
                            if (!filterControlPoints || item.Flag == PolygonFlags.NORMAL)
                            {
                                // System.Linq.Enumerable.ElementAt(points, i);
                                Coordinates[i] = new Point(item.X, item.Y);
                                Flags[i] = (unodrawing.PolygonFlags)item.Flag;
                                i++;
                            }
                        }

                        if (i < points.Count)
                        {
                            Coordinates = Coordinates.Take(i).ToArray();
                            Flags = Flags.Take(i).ToArray();
                            //TODO: check if this works
                        }
                    }
                    catch { return false; }
                }
                success = true;
            }
            return success;
        }
開發者ID:TUD-INF-IAI-MCI,項目名稱:Tangram_Lector_Workstation,代碼行數:50,代碼來源:OoDrawUtils.cs


注:本文中的System.Point.Take方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。