コード例 #1
0
        ///<summary>
        /// Extracts the points of the paths in a flat {@link PathIterator} into
        /// a list of Coordinate arrays.
        ///</summary>
        /// <param name="pathGeometry">A path figure collection</param>
        /// <returns>A list of coordinate arrays</returns>
        /// <exception cref="ArgumentException">If a non-linear segment type is encountered</exception>
        private static IList<Coordinate[]> ToCoordinates(PathGeometry pathGeometry)
        {
            if (pathGeometry.MayHaveCurves())
                throw new ArgumentException("WPF geometry must not have non-linear segments");

            var coordArrays = new List<Coordinate[]>();

            var pathFigures = pathGeometry.Figures;

            foreach (PathFigure pathFigure in pathFigures)
            {
                var pts = NextCoordinateArray(pathFigure);
                coordArrays.Add(pts);
            }
            return coordArrays;
        }