예제 #1
0
        private PathGeometry CreateAreaCurveGeometry()
        {
            PathGeometry pathGeometry = new PathGeometry();
            PathFigure   pathFigure   = new PathFigure();

            pathGeometry.Figures.Add(pathFigure);

            Point[] catmullRomPoints = new Point[_childrenPositions.Count];
            _childrenPositions.CopyTo(catmullRomPoints, 0);
            Point[] bezierPoints = GeometryOperation.CatmullRom(catmullRomPoints);
            pathFigure.StartPoint = bezierPoints[0];
            PolyBezierSegment pbs = new PolyBezierSegment();

            for (int i = 1; i < bezierPoints.GetLength(0); i++)
            {
                pbs.Points.Add(bezierPoints[i]);
            }
            pathFigure.Segments.Add(pbs);
            if (AreaBrush != null)
            {
                pathFigure.Segments.Add(new LineSegment(new Point(_childrenPositions[_childrenPositions.Count - 1].X, GetHorizontalAxis(this)), false));
                pathFigure.Segments.Add(new LineSegment(new Point(_childrenPositions[0].X, GetHorizontalAxis(this)), false));
            }
            return(pathGeometry);
        }
예제 #2
0
        private PathGeometry CreateLineCurveGeometry()
        {
            PathGeometry pathGeometry = new PathGeometry();
            PathFigure   pathFigure   = new PathFigure();

            pathGeometry.Figures.Add(pathFigure);
            pathFigure.StartPoint = (Point)GeometryOperation.ComputeIntersectionPoint((FrameworkElement)InternalChildren[0], (FrameworkElement)InternalChildren[1]);
            PolyLineSegment pls = new PolyLineSegment();

            for (int i = 1; i < InternalChildren.Count; i++)
            {
                pls.Points.Add(GeometryOperation.ComputeIntersectionPoint((FrameworkElement)InternalChildren[i],
                                                                          ((FrameworkElement)InternalChildren[i - 1])));
            }
            pathFigure.Segments.Add(pls);
            if (AreaBrush != null)
            {
                pathFigure.Segments.Add(new LineSegment(new Point(_childrenPositions[_childrenPositions.Count - 1].X, GetHorizontalAxis(this)), false));
                pathFigure.Segments.Add(new LineSegment(new Point(_childrenPositions[0].X, GetHorizontalAxis(this)), false));
            }
            return(pathGeometry);
        }