/// <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; }