• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Media.ArcSegment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Media.ArcSegment的典型用法代码示例。如果您正苦于以下问题:C# ArcSegment类的具体用法?C# ArcSegment怎么用?C# ArcSegment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ArcSegment类属于System.Windows.Media命名空间,在下文中一共展示了ArcSegment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Setup

        public void Setup()
        {
            m_StartSegment = Substitute.For <ITurnCircleArcSegment>();
            m_MiddleSegment = Substitute.For <ITurnCircleArcSegment>();
            m_EndSegment = Substitute.For <ITurnCircleArcSegment>();

            m_Path = Substitute.For <IPath>();
            var segments = new List <IPolylineSegment>
                           {
                               m_StartSegment,
                               m_MiddleSegment,
                               m_EndSegment
                           };

            m_Path.Segments.Returns(segments);

            m_ArcSegmentOne = new ArcSegment(new Point(10.0,
                                                       10.0),
                                             new Size(10.0,
                                                      10.0),
                                             45.0,
                                             false,
                                             SweepDirection.Clockwise,
                                             false);

            m_LineSegment = new LineSegment(new Point(20.0,
                                                      20.0),
                                            false);

            m_ArcSegmentTwo = new ArcSegment(new Point(30.0,
                                                       30.0),
                                             new Size(30.0,
                                                      30.0),
                                             90.0,
                                             false,
                                             SweepDirection.Counterclockwise,
                                             false);

            m_ArcSegmentThree = new ArcSegment(new Point(40.0,
                                                         40.0),
                                               new Size(40.0,
                                                        40.0),
                                               135.0,
                                               false,
                                               SweepDirection.Counterclockwise,
                                               false);


            m_Point = new Point(10.0,
                                10.0);

            m_Helper = Substitute.For <IPathSegmentHelper>();
            m_Helper.SegmentToLineSegment(Line.Unknown).ReturnsForAnyArgs(m_LineSegment);
            m_Helper.SegmentToArcSegment(TurnCircleArcSegment.Unknown).ReturnsForAnyArgs(m_ArcSegmentOne,
                                                                                         m_ArcSegmentTwo,
                                                                                         m_ArcSegmentThree);
            m_Helper.PointRelativeToOrigin(null).ReturnsForAnyArgs(m_Point);

            m_Converter = new RacetrackPathUTurnToFiguresConverter(m_Helper);
        }
开发者ID:tschroedter,项目名称:Selkie.WPF,代码行数:60,代码来源:RacetrackPathUTurnToFiguresConverterTests.cs


示例2: WpfArc

        public WpfArc(IArc arc)
        {
            _xarc = arc;

            _fillBrush = new SolidColorBrush(_xarc.Fill.ToNativeColor());
            _fillBrush.Freeze();
            _strokeBrush = new SolidColorBrush(_xarc.Stroke.ToNativeColor());
            _strokeBrush.Freeze();

            _path = new Path();
            _path.Tag = this;
            _path.Fill = _fillBrush;
            _path.Stroke = _strokeBrush;
            _path.StrokeThickness = arc.StrokeThickness;
            _pg = new PathGeometry();
            _pf = new PathFigure();
            _pf.IsFilled = arc.IsFilled;
            _pf.IsClosed = arc.IsClosed;
            _start = new Point();
            _as = new ArcSegment();
            SetArcSegment(_as, arc, out _start);
            _pf.StartPoint = _start;
            _pf.Segments.Add(_as);
            _pg.Figures.Add(_pf);
            _path.Data = _pg;

            Native = _path;
        }
开发者ID:monocraft,项目名称:RxCanvas,代码行数:28,代码来源:Wpf.cs


示例3: CreateArcShape

 public static Tuple<Path, PathFigure, ArcSegment> CreateArcShape()
 {
     var arcSegment = new ArcSegment()
     {
         SweepDirection = SweepDirection.Counterclockwise,
         RotationAngle = 0
     };
     var figure = new PathFigure()
     {
         IsClosed = false,
         IsFilled = false,
         Segments = new PathSegmentCollection()
         {
             arcSegment
         }
     };
     var path = new Path()
     {
         Data = new PathGeometry()
         {
             Figures = new PathFigureCollection()
             {
                 figure
             }
         },
         Stroke = new SolidColorBrush(Colors.Black),
         StrokeThickness = 1
     };
     return Tuple.Create(path, figure, arcSegment);
 }
开发者ID:ondrej11,项目名称:o106,代码行数:30,代码来源:Factory.cs


示例4: AddCircularArcGraph

		private void AddCircularArcGraph(Point startPoint, Point endPoint, Size size)
		{
			PathFigure pf = new PathFigure();
			pf.StartPoint = new Point(startPoint.X, startPoint.Y);

			ArcSegment arcSegment = new ArcSegment();
			arcSegment.Point = new Point(endPoint.X, endPoint.Y);
			arcSegment.Size = size;
			arcSegment.SweepDirection = SweepDirection.Counterclockwise;

			PathSegmentCollection psc = new PathSegmentCollection();
			psc.Add(arcSegment);

			pf.Segments = psc;

			PathFigureCollection pfc = new PathFigureCollection();
			pfc.Add(pf);

			PathGeometry pg = new PathGeometry();
			pg.Figures = pfc;

			var path = new Path();
			path.Stroke = Brushes.Black;
			path.StrokeThickness = 1;
			path.Data = pg;
			path.Fill = Brushes.Orange;
			path.Stretch = Stretch.Fill;

			var viewportPanel = new ViewportHostPanel();
			ViewportPanel.SetViewportBounds(path, new DataRect(0, 0, 50, 50));
			viewportPanel.Children.Add(path);
			plotter.Children.Add(viewportPanel);
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:33,代码来源:Window1.xaml.cs


示例5: AddArc

        public PathFigure AddArc(int start, int end)
        {
            int horizontalPostion = 100;

            var startPoint = new Point(horizontalPostion, start);
            var endPoint = new Point(horizontalPostion, end);

            PathFigure pathFigure = new PathFigure();
            pathFigure.StartPoint = startPoint;

            ArcSegment arcSeg = new ArcSegment();
            arcSeg.Point = endPoint;
            arcSeg.Size = new Size(25, 25);
            arcSeg.IsLargeArc = true;
            arcSeg.SweepDirection = SweepDirection.Clockwise;
            arcSeg.RotationAngle = 90;

            var arrowhead = new Polygon();
            arrowhead.Stroke = Brushes.Black;
            arrowhead.StrokeThickness = 2;
            arrowhead.Points.Add(new Point(endPoint.X - 4, endPoint.Y));
            arrowhead.Points.Add(new Point(endPoint.X + 4, endPoint.Y + 3));
            arrowhead.Points.Add(new Point(endPoint.X + 4, endPoint.Y - 3));
            arrowhead.Fill = Brushes.Black;

            PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
            myPathSegmentCollection.Add(arcSeg);
            pathFigure.Segments = myPathSegmentCollection;

            _pathFigureCollection.Add(pathFigure);

            _root.Children.Add(arrowhead);

            return pathFigure;
        }
开发者ID:pottereric,项目名称:Synopsis,代码行数:35,代码来源:ArcAdder.cs


示例6: RenderArc

        private void RenderArc(double Angle, Path pathRoot, PathFigure pathFigure, ArcSegment arcSegment)
        {
            Point startPoint = new Point(Radius, 0);
            Point endPoint = ComputeCartesianCoordinate(Angle, Radius);
            endPoint.X += Radius;
            endPoint.Y += Radius;

            pathRoot.Width = Radius * 2 + StrokeThickness;
            pathRoot.Height = Radius * 2 + StrokeThickness;
            pathRoot.Margin = new Thickness(StrokeThickness, StrokeThickness, 0, 0);

            bool largeArc = Angle > 180.0;

            Size outerArcSize = new Size(Radius, Radius);

            pathFigure.StartPoint = startPoint;

            if (startPoint.X == Math.Round(endPoint.X) && startPoint.Y == Math.Round(endPoint.Y))
            {
                endPoint.X -= 0.01;
            }

            arcSegment.Point = endPoint;
            arcSegment.Size = outerArcSize;
            arcSegment.IsLargeArc = largeArc;
        }
开发者ID:EmiiFont,项目名称:MyShuttle_RC,代码行数:26,代码来源:CircularProgressBar.xaml.cs


示例7: Arc

 public Arc(Path path, LineSegment lineSegment, ArcSegment arcSegment, Point zeroPos, Color color)
 {
     Path = path;
     LineSegment = lineSegment;
     ArcSegment = arcSegment;
     ZeroPos = zeroPos;
     Path.Stroke = ToBrush(color);
     Path.Fill = ToBrush(color);
 }
开发者ID:draptik,项目名称:worktimer,代码行数:9,代码来源:Arc.cs


示例8: DefineGeometry

        private void DefineGeometry()
        {
            PointCollection points = Points;
            if (points == null)
            {
                _geometry = Geometry.Empty;
                return;
            }

            PathFigure figure = new PathFigure();
            if (points.Count > 0)
            {
                // start point
                figure.StartPoint = points[0];

                if (points.Count > 1)
                {
                    // points between
                    double desiredRadius = Radius;
                    for (int i = 1; i < (points.Count - 1); i++)
                    {
                        // adjust radius if points are too close
                        Vector v1 = points[i] - points[i - 1];
                        Vector v2 = points[i + 1] - points[i];
                        double radius = Math.Min(Math.Min(v1.Length, v2.Length) / 2, desiredRadius);

                        // draw the line, and stop before the next point
                        double len = v1.Length;
                        v1.Normalize();
                        v1 *= (len - radius);
                        LineSegment line = new LineSegment(points[i - 1] + v1, true);
                        figure.Segments.Add(line);

                        // draw the arc to the next point
                        v2.Normalize();
                        v2 *= radius;
                        SweepDirection direction = (Vector.AngleBetween(v1, v2) > 0) ? SweepDirection.Clockwise : SweepDirection.Counterclockwise;
                        ArcSegment arc = new ArcSegment(points[i] + v2, new Size(radius, radius), 0, false, direction, true);
                        figure.Segments.Add(arc);
                    }

                    // last point
                    figure.Segments.Add(new LineSegment(points[points.Count - 1], true));
                }
            }
            PathGeometry geometry = new PathGeometry();
            geometry.Figures.Add(figure);
            geometry.FillRule = FillRule;
            if (geometry.Bounds == Rect.Empty)
            {
                _geometry = Geometry.Empty;
            }
            else
            {
                _geometry = geometry;
            }
        }
开发者ID:arpinerap,项目名称:digiCamControl.Plugins,代码行数:57,代码来源:RoundPolyline.cs


示例9: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.arc = ((System.Windows.Media.ArcSegment)(target));
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:aditya9992,项目名称:KinectJigsawPuzzle,代码行数:9,代码来源:HoverProgressControl.g.cs


示例10: CreateArcSegment

        public ArcSegment CreateArcSegment(Point point,
                                           Size size,
                                           SweepDirection sweepDirection,
                                           bool isLargeArc = false)
        {
            const double rotationAngle = 0.0;
            const bool isStroked = true;

            var arcSegment = new ArcSegment(point,
                                            size,
                                            rotationAngle,
                                            isLargeArc,
                                            sweepDirection,
                                            isStroked);

            return arcSegment;
        }
开发者ID:tschroedter,项目名称:Selkie.WPF,代码行数:17,代码来源:PathSegmentHelper.cs


示例11: OnApplyTemplate

 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     this.Root = base.GetTemplateChild("Root") as Border;
     this.ArrowRow = base.GetTemplateChild("ArrowRow") as RowDefinition;
     this.ToolTipPathFigure = base.GetTemplateChild("ToolTipPathFigure") as PathFigure;
     this.BottomCenterLeft = base.GetTemplateChild("BottomCenterLeft") as LineSegment;
     this.BottomLeftCorner1 = base.GetTemplateChild("BottomLeftCorner1") as LineSegment;
     this.BottomLeftCorner2 = base.GetTemplateChild("BottomLeftCorner2") as ArcSegment;
     this.TopLeftCorner1 = base.GetTemplateChild("TopLeftCorner1") as LineSegment;
     this.TopLeftCorner2 = base.GetTemplateChild("TopLeftCorner2") as ArcSegment;
     this.TopRightCorner1 = base.GetTemplateChild("TopRightCorner1") as LineSegment;
     this.TopRightCorner2 = base.GetTemplateChild("TopRightCorner2") as ArcSegment;
     this.BottomRightCorner1 = base.GetTemplateChild("BottomRightCorner1") as LineSegment;
     this.BottomRightCorner2 = base.GetTemplateChild("BottomRightCorner2") as ArcSegment;
     this.BottomCenterRight = base.GetTemplateChild("BottomCenterRight") as LineSegment;
 }
开发者ID:guazipi,项目名称:bjAirPollution,代码行数:17,代码来源:PathToolTip.cs


示例12: ClippedGrid_SizeChanged

        void ClippedGrid_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            double w = this.ActualWidth;
            double h = this.ActualHeight;

            PathFigure figure = new PathFigure();
            figure.StartPoint = new Point(0, h);

            LineSegment left = new LineSegment();
            left.Point = new Point(0, _arcSizeY + _offsetY);
            figure.Segments.Add(left);

            ArcSegment topLeftRounding = new ArcSegment();
            topLeftRounding.Size = new Size(_arcSizeX, _arcSizeY);
            topLeftRounding.RotationAngle = 0;
            topLeftRounding.IsLargeArc = false;
            topLeftRounding.SweepDirection = SweepDirection.Clockwise;
            topLeftRounding.Point = new Point(_arcSizeX, _offsetY);
            figure.Segments.Add(topLeftRounding);

            LineSegment top = new LineSegment();
            top.Point = new Point(w - _arcSizeX, _offsetY);
            figure.Segments.Add(top);

            ArcSegment topRightRounding = new ArcSegment();
            topRightRounding.Size = new Size(_arcSizeX, _arcSizeY);
            topRightRounding.RotationAngle = 0;
            topRightRounding.IsLargeArc = false;
            topRightRounding.SweepDirection = SweepDirection.Clockwise;
            topRightRounding.Point = new Point(w, _arcSizeY + _offsetY);
            figure.Segments.Add(topRightRounding);

            LineSegment right = new LineSegment();
            right.Point = new Point(w, h);
            figure.Segments.Add(right);

            LineSegment bottom = new LineSegment();
            bottom.Point = new Point(0, h);
            figure.Segments.Add(bottom);

            PathGeometry clip = new PathGeometry();
            clip.Figures.Add(figure);

            this.Clip = clip;
        }
开发者ID:netthanhhung,项目名称:Medical,代码行数:45,代码来源:ClippedGrid.cs


示例13: Draw

        public Path Draw(double X, double Y)
        {
            Path path = new Path();
            Canvas.SetTop(path, Y);
            Canvas.SetLeft(path, X);
            //Make Geometry
            _arcSeg = new ArcSegment(new Point(X+800, Y+800), new Size(1000, 2000), 0.0, true, SweepDirection.Clockwise, true);
            PathSegmentCollection psc = new PathSegmentCollection(){_arcSeg};
            _pathFig = new PathFigure(new Point(X, Y), psc, false);
            PathFigureCollection pfc = new PathFigureCollection(){_pathFig};
            PathGeometry pgeo = new PathGeometry(pfc);
            path.Data = pgeo;

            path.StrokeThickness = 200;
            path.Fill = Brushes.White;
            path.Stroke = Brushes.Black;

            return path;
        }
开发者ID:computmaxer,项目名称:TotalDMXControl,代码行数:19,代码来源:StepPath.cs


示例14: CalculateArcInfo

        /// <summary>
        /// Calculates the midpoint of the arc passed as a parameter, as well as whether the arc is small.
        /// </summary>
        /// <param name="center">The center of the pie chart.</param>
        /// <param name="startPoint">The start point of the arc segment.</param>
        /// <param name="arcSegment">The arc of the pie wedge itself.</param>
        /// <param name="arcMidpoint">he midpoint of the arc in the pie wedge.</param>
        /// <param name="isArcSmall">True if the arc is small, false otherwise.</param>
        private static void CalculateArcInfo(Point center, Point startPoint, ArcSegment arcSegment, out Point arcMidpoint, out bool isArcSmall)
        {
            // Note: we assume a valid arcSegment with equal radii.
            Debug.Assert(arcSegment != null);
            Debug.Assert(arcSegment.Size.Width == arcSegment.Size.Height);

            Point endPoint = arcSegment.Point;
            Point chordMidpoint = new Point(0.5 * (startPoint.X + endPoint.X), 0.5 * (startPoint.Y + endPoint.Y));
            Vector chordDirection = endPoint - startPoint;
            double chordLength = chordDirection.Length;
            double radius = arcSegment.Size.Width;

            isArcSmall = chordLength < DistanceSmallArc;

            // If the chord length is less than the distance tolerance, just use the chord midpoint
            // or the point on the opposite side of the circle as appropriate.
            if (chordLength < DistanceTolerance)
            {
                arcMidpoint = arcSegment.IsLargeArc ? center - (chordMidpoint - center) : chordMidpoint;
            }
            else
            {
                chordDirection /= chordLength;
                Vector radialDirection = new Vector(-chordDirection.Y, chordDirection.X);
                double halfChordLength = 0.5 * chordLength;
                double radialOffset;
                if (radius >= halfChordLength)
                {
                    double sectorRadius = Math.Sqrt(radius * radius - halfChordLength * halfChordLength);
                    radialOffset = -radius + (arcSegment.IsLargeArc ? -sectorRadius : sectorRadius);
                }
                else
                {
                    radialOffset = -halfChordLength;
                }
                if (arcSegment.SweepDirection == SweepDirection.Counterclockwise)
                {
                    radialOffset = -radialOffset;
                }
                arcMidpoint = chordMidpoint + radialOffset * radialDirection;
            }
        }
开发者ID:minhthanhnguyen,项目名称:WpfToolkit,代码行数:50,代码来源:PieChartHelper.cs


示例15: SurfaceWindow1

        /// <summary>
        /// Default constructor.
        /// </summary>
        public SurfaceWindow1()
        {
            InitializeComponent();
            Path myShape = new Path();
            myShape.StrokeThickness = 3.0;
            myShape.Fill = System.Windows.Media.Brushes.Wheat;
            myShape.Stroke = System.Windows.Media.Brushes.BlueViolet;
            PathGeometry myGeometry = new PathGeometry();
            PathFigure figure = new PathFigure();

            //Figure draws the segments upside down (this the coordinate system in negatives to draw objects)
            Double width = 200;
            Double height = 100;
            figure.SetValue(PathFigure.StartPointProperty, new Point(height, 0));
            ArcSegment arc = new ArcSegment(new Point(height, height), new Size(height / 2, height / 2), 0.0, true, SweepDirection.Counterclockwise, true);
            //Note: LineSegments take end point as the constructor, Their Start point will be the end point of previous segment(the order you added into path figure(Source API))
            LineSegment arcVertical1 = new LineSegment(new Point(height, height - 25), true);
            LineSegment horizontal1 = new LineSegment(new Point(height + 275, height - 25), true);
            LineSegment vertical = new LineSegment(new Point(height + 275, 25), true);
            LineSegment horizontal2 = new LineSegment(new Point(height, 25), true);
            LineSegment arcVertical2 = new LineSegment(new Point(height, 0), true);

            figure.Segments.Add(arc);
            figure.Segments.Add(arcVertical1);
            figure.Segments.Add(horizontal1);
            figure.Segments.Add(vertical);
            figure.Segments.Add(horizontal2);
            figure.Segments.Add(arcVertical2);
            myGeometry.Figures.Add(figure);

            myShape.Data = myGeometry;
            myCanvas.Children.Add(myShape);

            //****************************** Register for Stroke change events*************************
            // This is how we can get the currently being drawn stroke information
            inkCanvas.Strokes.StrokesChanged += new StrokeCollectionChangedEventHandler(canvasStrokesChanged);

            // Add handlers for window availability events
            AddWindowAvailabilityHandlers();
        }
开发者ID:srkapil,项目名称:Random-Projects,代码行数:43,代码来源:SurfaceWindow1.xaml.cs


示例16: DrawEquation

 public override void DrawEquation(DrawingContext dc)
 {
     LineSegment line;
     ArcSegment arc;
     Point pathFigureStart;
     if (IsInverted)
     {
         pathFigureStart = new Point(ParentEquation.Right, Bottom - StandardRoundPen.Thickness /2);
         line = new LineSegment(new Point(Left, Bottom - StandardRoundPen.Thickness / 2), true);
         arc = new ArcSegment(Location, new Size(Width * 4.5, Height), 0, false, SweepDirection.Counterclockwise, true);
     }
     else
     {
         pathFigureStart = new Point(ParentEquation.Right, Top);
         line = new LineSegment(Location, true);
         arc = new ArcSegment(new Point(Left, Bottom), new Size(Width * 4.5, Height), 0, false, SweepDirection.Clockwise, true);
     }
     PathGeometry pathGeometry = new PathGeometry();
     PathFigure pathFigure = new PathFigure(pathFigureStart, new PathSegment[] { line, arc }, false);
     pathGeometry.Figures.Add(pathFigure);
     dc.DrawGeometry(null, StandardRoundPen, pathGeometry);
 }
开发者ID:JackWangCUMT,项目名称:math-editor,代码行数:22,代码来源:DivMathSign.cs


示例17: CreateArcGeometry

        public static Geometry CreateArcGeometry(double minAngle, double maxAngle, double radius, int thickness, SweepDirection sweepDirection)
        {
            //the range will have 4 segments (arc, line, arc, line)
            //if the sweep angle is bigger than 180 use the large arc
            //first use the same sweep direction as the control. invert for the second arc.
            PathFigure figure = new PathFigure();
            figure.IsClosed = true;
            figure.StartPoint = new Point((radius - thickness) * Math.Sin(minAngle * Math.PI / 180),
                -(radius - thickness) * Math.Cos(minAngle * Math.PI / 180));

            //first arc segment
            ArcSegment arc = new ArcSegment();
            arc.Point = new Point((radius - thickness) * Math.Sin(maxAngle * Math.PI / 180),
                -(radius - thickness) * Math.Cos(maxAngle * Math.PI / 180));
            arc.Size = new Size(radius - thickness, radius - thickness);
            arc.SweepDirection = sweepDirection;
            if (Math.Abs(maxAngle - minAngle) > 180) arc.IsLargeArc = true;
            figure.Segments.Add(arc);
            //first line segment
            LineSegment line = new LineSegment();
            line.Point = new Point(radius * Math.Sin(maxAngle * Math.PI / 180),
                -radius * Math.Cos(maxAngle * Math.PI / 180));
            figure.Segments.Add(line);
            //second arc segment
            arc = new ArcSegment();
            arc.Point = new Point(radius * Math.Sin(minAngle * Math.PI / 180),
                -radius * Math.Cos(minAngle * Math.PI / 180));
            arc.Size = new Size(radius, radius);
            arc.SweepDirection = SweepDirection.Counterclockwise;
            if (sweepDirection == SweepDirection.Counterclockwise)
                arc.SweepDirection = SweepDirection.Clockwise;
            if (Math.Abs(maxAngle - minAngle) > 180) arc.IsLargeArc = true;
            figure.Segments.Add(arc);

            PathGeometry path = new PathGeometry();
            path.Figures.Add(figure);
            return path;
        }
开发者ID:GrenobleRoboticLab,项目名称:RemoteAdventurer,代码行数:38,代码来源:RadialScaleHelper.cs


示例18: Transform

		/// <summary>
		/// Transforms the specified path segment and returns the result.
		/// </summary>
		/// <param name="pathSegment">The path segment.</param>
		/// <param name="transform">The transform.</param>
		/// <returns></returns>
        public static PathSegment Transform(this PathSegment pathSegment, TransformGroup transform)
		{
			PathSegment ret;
			if (pathSegment is LineSegment)
				ret = new LineSegment { Point = ((LineSegment)pathSegment).Point.Transform(transform) };
			else if (pathSegment is ArcSegment)
			{
				var arcSegment = (ArcSegment) pathSegment;
			    var scaleTransform = transform.Children.OfType<ScaleTransform>().FirstOrDefault();
                var rotateTransform = transform.Children.OfType<RotateTransform>().FirstOrDefault();
                var size = new Size { Height = arcSegment.Size.Height * scaleTransform.ScaleY, Width = arcSegment.Size.Width * scaleTransform.ScaleX };
                ret = new ArcSegment { Point = arcSegment.Point.Transform(transform), Size = size, IsLargeArc = arcSegment.IsLargeArc, RotationAngle = rotateTransform.Angle };
			}
			else if (pathSegment is BezierSegment)
			{
				var bezierSegment = (BezierSegment)pathSegment;
				ret = new BezierSegment
				{
					Point1 = bezierSegment.Point1.Transform(transform),
					Point2 = bezierSegment.Point2.Transform(transform),
					Point3 = bezierSegment.Point3.Transform(transform),
				};
			}
			else if (pathSegment is QuadraticBezierSegment)
			{
				var bezierSegment = (QuadraticBezierSegment)pathSegment;
				ret = new QuadraticBezierSegment
				{
					Point1 = bezierSegment.Point1.Transform(transform),
					Point2 = bezierSegment.Point2.Transform(transform),
				};
			}
			else
				throw new Exception("Transform To implement");
			return ret;
		}
开发者ID:TNOCS,项目名称:csTouch,代码行数:42,代码来源:GeometryExtension.cs


示例19: FlattenSegment

 /// <summary>
 /// Converts an ArcSegment into a PolyLineSegment because I currently have no muse to calculate
 /// the correct Bézier curves.
 /// </summary>
 public static PdfSharp.Xps.XpsModel.PolyLineSegment FlattenSegment(PdfSharp.Xps.XpsModel.Point startPoint,
   PdfSharp.Xps.XpsModel.ArcSegment seg)
 {
   PathGeometry geo = new PathGeometry();
   PathFigure fig = new PathFigure();
   geo.Figures.Add(fig);
   fig.StartPoint = new Point(startPoint.X, startPoint.Y);
   ArcSegment aseg = new ArcSegment(new Point(seg.Point.X, seg.Point.Y), new Size(seg.Size.Width, seg.Size.Height), seg.RotationAngle,
     seg.IsLargeArc, (SweepDirection)seg.SweepDirection, seg.IsStroked);
   fig.Segments.Add(aseg);
   geo = geo.GetFlattenedPathGeometry();
   fig = geo.Figures[0];
   //PolyLineSegment lineSeg = (PolyLineSegment)fig.Segments[0];
   PdfSharp.Xps.XpsModel.PolyLineSegment resultSeg = new PdfSharp.Xps.XpsModel.PolyLineSegment();
   int count = fig.Segments.Count;
   for (int idx = 0; idx < count; idx++)
   {
     PathSegment pathSeg = fig.Segments[idx];
     if (pathSeg is PolyLineSegment)
     {
       PolyLineSegment plseg = (PolyLineSegment)pathSeg;
       foreach (Point point in plseg.Points)
         resultSeg.Points.Add(new PdfSharp.Xps.XpsModel.Point(point.X, point.Y));
     }
     else if (pathSeg is LineSegment)
     {
       LineSegment lseg = (LineSegment)pathSeg;
       resultSeg.Points.Add(new PdfSharp.Xps.XpsModel.Point(lseg.Point.X, lseg.Point.Y));
     }
     else
     {
       Debugger.Break();
     }
   }
   return resultSeg;
 }
开发者ID:alexiej,项目名称:YATE,代码行数:40,代码来源:WpfUtils.cs


示例20: arc

        public void arc(double x, double y, double width, double height, double start, double stop)
        {
            Path p = new Path ();
            PathGeometry pg = new PathGeometry ();
            // FIXME: moonlight should be fixed to automatically ceate Figures.
            pg.Figures = new PathFigureCollection ();

            PathFigure pf = new PathFigure ();
            pf.StartPoint = new Point (x, y);
            ArcSegment ars = new ArcSegment ();
            ars.Size = new Size (width, height);
            ars.SweepDirection = SweepDirection.Counterclockwise;
            ars.IsLargeArc = (stop - start > PI);

            pf.Segments.Add (ars);
            pg.Figures.Add (pf);

            p.Stroke = stroke_brush;
            p.StrokeThickness = stroke_weight;
            p.StrokeLineJoin = stroke_join;
            p.StrokeStartLineCap = p.StrokeEndLineCap = stroke_cap;
            p.Data = pg;
            Host.Children.Add (p);
        }
开发者ID:atsushieno,项目名称:tsukimi,代码行数:24,代码来源:StandardLibrary.Shapes.cs



注:本文中的System.Windows.Media.ArcSegment类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Media.Brush类代码示例发布时间:2022-05-26
下一篇:
C# Markup.ParserContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap