示例#1
0
文件: VNode.cs 项目: sta1216/MsAGL
        static void AddCurve(PathFigure pathFigure, Curve curve)
        {
            foreach (ICurve seg in curve.Segments)
            {
                var ls = seg as LineSegment;

                if (ls != null)
                {
                    pathFigure.Segments.Add(new Windows.UI.Xaml.Media.LineSegment {
                        Point = Common.UwpPoint(ls.End)
                    });
                }
                else
                {
                    var ellipse = seg as Ellipse;

                    if (ellipse != null)
                    {
                        pathFigure.Segments.Add(new ArcSegment
                        {
                            Point         = Common.UwpPoint(ellipse.End),
                            Size          = new Size(ellipse.AxisA.Length, ellipse.AxisB.Length),
                            RotationAngle = Point.Angle(new Point(1, 0), ellipse.AxisA),
                            //ellipse.ParEnd - ellipse.ParEnd >= Math.PI,
                            SweepDirection = !ellipse.OrientedCounterclockwise() ? SweepDirection.Counterclockwise : SweepDirection.Clockwise
                        });
                    }
                }
            }
        }
 static void AddCurve(PathFigure pathFigure, Curve curve)
 {
     foreach (ICurve seg in curve.Segments)
     {
         var ls = seg as LineSegment;
         if (ls != null)
         {
             pathFigure.Segments.Add(new System.Windows.Media.LineSegment(Common.WpfPoint(ls.End), true));
         }
         else
         {
             var ellipse = seg as Ellipse;
             if (ellipse != null)
             {
                 pathFigure.Segments.Add(new ArcSegment(Common.WpfPoint(ellipse.End),
                                                        new Size(ellipse.AxisA.Length, ellipse.AxisB.Length),
                                                        Point.Angle(new Point(1, 0), ellipse.AxisA),
                                                        ellipse.ParEnd - ellipse.ParEnd >= Math.PI,
                                                        !ellipse.OrientedCounterclockwise()
                         ? SweepDirection.Counterclockwise
                         : SweepDirection.Clockwise, true));
             }
         }
     }
 }