Beispiel #1
0
        /// <summary>
        /// Creates List of geometries for Strikethru
        /// </summary>
        /// <returns>List of Geometries</returns>
        public List <Geometry> CenterLineRectangleGeometries()
        {
            List <Geometry> geoms = new List <Geometry>();
            PathGeometry    pg    = (PathGeometry)mOrginalGeometry;

            foreach (PathFigure fg in pg.Figures)
            {
                PolyLineSegment       pls       = (PolyLineSegment)fg.Segments[0];
                PointCollectionHelper pch       = new PointCollectionHelper(pls.Points, fg.StartPoint);
                List <double>         distinctY = pch.DistinctY;
                for (int i = 0; i < distinctY.Count - 1; i++)
                {
                    double top    = (distinctY[i] + distinctY[i + 1]) / 2 + 1;
                    double bottom = (distinctY[i] + distinctY[i + 1]) / 2 - 1;
                    // ordered values of X that are present for both Y values
                    List <double> rlMatches = pch.XAtY(distinctY[i], distinctY[i + 1]);
                    double        left      = rlMatches[0];
                    double        right     = rlMatches[rlMatches.Count - 1];

                    PathGeometry rpg = CreateGeometry(top, bottom, left, right);
                    geoms.Add(rpg);
                }
            }
            return(geoms);
        }
        /// <summary>
        /// Creates List of geometries for underline
        /// </summary>
        /// <returns>List of Geometries</returns>
        public Geometry BottomEdgeRectangleGeometry()
        {
            PathGeometry  pg = (PathGeometry)mOrginalGeometry;
            GeometryGroup gg = new GeometryGroup();

            foreach (PathFigure fg in pg.Figures)
            {
                PolyLineSegment       pls       = (PolyLineSegment)fg.Segments[0];
                PointCollectionHelper pch       = new PointCollectionHelper(pls.Points, fg.StartPoint);
                List <double>         distinctY = pch.DistinctY;
                for (int i = 0; i < distinctY.Count - 1; i++)
                {
                    double bottom = distinctY[i + 1] - 3;
                    double top    = bottom + 2;
                    // ordered values of X that are present for both Y values
                    List <double> rlMatches = pch.XAtY(distinctY[i], distinctY[i + 1]);
                    double        left      = rlMatches[0];
                    double        right     = rlMatches[rlMatches.Count - 1];

                    PathGeometry rpg = CreateGeometry(top, bottom, left, right);
                    gg.Children.Add(rpg);
                }
            }
            return(gg);
        }