当前位置: 首页>>代码示例>>C#>>正文


C# StreamGeometryContext.PolyLineTo方法代码示例

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


在下文中一共展示了StreamGeometryContext.PolyLineTo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddRing

        ///<summary>
        /// Adds a <see cref="PathFigure"/> representing a polygon ring
        /// having the given coordinate sequence to the supplied <see cref="StreamGeometryContext"/>
        ///</summary>
        ///<param name="sgc">The stream geometry context.</param>
        ///<param name="coordinates">A coordinate sequence</param>
        ///<param name="filled">Starting paramter for </param>
        ///<returns>The path for the coordinate sequence</returns>
        private static void AddRing(StreamGeometryContext sgc, Coordinate[] coordinates, bool filled)
        {
            if (coordinates.Length <= 0)
                return;

            sgc.BeginFigure(ToPoint(coordinates[0]), filled, true);
            if (coordinates.Length > 0)
                sgc.PolyLineTo(ToPoint(coordinates, 1), true, true);
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:17,代码来源:PolygonWpfStreamGeometry.cs

示例2: SerializeData

 /// <summary>
 /// SerializeData - Serialize the contents of this Segment to the provided context.
 /// </summary>
 internal override void SerializeData(StreamGeometryContext ctx)
 {
     ctx.PolyLineTo(Points, IsStroked, IsSmoothJoin);
 }                                    
开发者ID:JianwenSun,项目名称:cc,代码行数:7,代码来源:PolyLineSegmentFigureLogic.cs

示例3: AddArcToFigureToStreamGeometryContext

        /// <summary>
        /// Private helper to render a path figure to the SGC
        /// </summary>
        private static void AddArcToFigureToStreamGeometryContext(StreamGeometryContext context, List<Point> abPoints, List<Point> dcPoints, List<Point> polyLinePoints)
        {
            Debug.Assert(context != null);
            Debug.Assert(abPoints != null && dcPoints != null);
            Debug.Assert(polyLinePoints != null);
            //Debug.Assert(abPoints.Count > 0 && dcPoints.Count > 0);
            if (abPoints.Count == 0 || dcPoints.Count == 0)
            {
                return;
            }

            context.BeginFigure(abPoints[0], //start point
                                        true,   //isFilled
                                        true);  //IsClosed

            for (int j = 0; j < 2; j++)
            {
                List<Point> points = j == 0 ? abPoints : dcPoints;
                int startIndex = j == 0 ? 1 : 0;
                for (int i = startIndex; i < points.Count; )
                {
                    Point next = points[i];
                    if (next == StrokeRenderer.ArcToMarker)
                    {
                        if (polyLinePoints.Count > 0)
                        {
                            //polyline first
                            context.PolyLineTo(  polyLinePoints,
                                                 true,      //isStroked
                                                 true);     //isSmoothJoin
                            polyLinePoints.Clear();
                        }
                        //we're arcing, pull out height, width and the arc to point
                        Debug.Assert(i + 2 < points.Count);
                        if (i + 2 < points.Count)
                        {
                            Point sizePoint = points[i + 1];
                            Size ellipseSize = new Size(sizePoint.X / 2/*width*/, sizePoint.Y / 2/*height*/);
                            Point arcToPoint = points[i + 2];

                            bool isLargeArc = false; //>= 180

                            context.ArcTo(  arcToPoint,
                                            ellipseSize,
                                            0d,             //rotation
                                            isLargeArc,     //isLargeArc
                                            SweepDirection.Clockwise,
                                            true,           //isStroked
                                            true);          //isSmoothJoin
                        }
                        i += 3; //advance past this arcTo block
                    }
                    else
                    {
                        //walk forward until we find an arc marker or the end
                        polyLinePoints.Add(next);
                        i++;
                    }
                }
                if (polyLinePoints.Count > 0)
                {
                    //polyline
                    context.PolyLineTo(polyLinePoints,
                                         true,      //isStroked
                                         true);     //isSmoothJoin
                    polyLinePoints.Clear();
                }
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:72,代码来源:StrokeRenderer.cs

示例4: AddPolylineFigureToStreamGeometryContext

        /// <summary>
        /// Private helper to render a path figure to the SGC
        /// </summary>
        private static void AddPolylineFigureToStreamGeometryContext(StreamGeometryContext context, List<Point> abPoints, List<Point> dcPoints)
        {
            Debug.Assert(context != null);
            Debug.Assert(abPoints != null && dcPoints != null);
            Debug.Assert(abPoints.Count > 0 && dcPoints.Count > 0);

            context.BeginFigure(abPoints[0], //start point
                                        true,   //isFilled
                                        true);  //IsClosed

            context.PolyLineTo(abPoints,
                                 true,      //isStroked
                                 true);     //isSmoothJoin

            context.PolyLineTo(dcPoints,
                                 true,      //isStroked
                                 true);     //isSmoothJoin

        }
开发者ID:JianwenSun,项目名称:cc,代码行数:22,代码来源:StrokeRenderer.cs

示例5: AddFigureToStreamGeometryContext

        /// <summary>
        /// Private helper to render a path figure to the SGC
        /// </summary>
        private static void AddFigureToStreamGeometryContext(StreamGeometryContext context, List<Point> points, bool isBezierFigure)
        {
            Debug.Assert(context != null);
            Debug.Assert(points != null);
            Debug.Assert(points.Count > 0);

            context.BeginFigure(points[points.Count - 1], //start point
                                        true,   //isFilled
                                        true);  //IsClosed

            if (isBezierFigure)
            {
                context.PolyBezierTo(points,
                                     true,      //isStroked
                                     true);     //isSmoothJoin
            }
            else
            {
                context.PolyLineTo(points,
                                     true,      //isStroked
                                     true);     //isSmoothJoin
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:26,代码来源:StrokeRenderer.cs

示例6: DrawFigure

        public static void DrawFigure(StreamGeometryContext ctx, PathFigure figure)
        {
            ctx.BeginFigure(figure.StartPoint, figure.IsFilled, figure.IsClosed);
            foreach (var segment in figure.Segments)
            {
                var lineSegment = segment as WpfLineSegment;
                if (lineSegment != null) { ctx.LineTo(lineSegment.Point, lineSegment.IsStroked, lineSegment.IsSmoothJoin); continue; }

                var bezierSegment = segment as BezierSegment;
                if (bezierSegment != null) { ctx.BezierTo(bezierSegment.Point1, bezierSegment.Point2, bezierSegment.Point3, bezierSegment.IsStroked, bezierSegment.IsSmoothJoin); continue; }

                var quadraticSegment = segment as QuadraticBezierSegment;
                if (quadraticSegment != null) { ctx.QuadraticBezierTo(quadraticSegment.Point1, quadraticSegment.Point2, quadraticSegment.IsStroked, quadraticSegment.IsSmoothJoin); continue; }

                var polyLineSegment = segment as PolyLineSegment;
                if (polyLineSegment != null) { ctx.PolyLineTo(polyLineSegment.Points, polyLineSegment.IsStroked, polyLineSegment.IsSmoothJoin); continue; }

                var polyBezierSegment = segment as PolyBezierSegment;
                if (polyBezierSegment != null) { ctx.PolyBezierTo(polyBezierSegment.Points, polyBezierSegment.IsStroked, polyBezierSegment.IsSmoothJoin); continue; }

                var polyQuadraticSegment = segment as PolyQuadraticBezierSegment;
                if (polyQuadraticSegment != null) { ctx.PolyQuadraticBezierTo(polyQuadraticSegment.Points, polyQuadraticSegment.IsStroked, polyQuadraticSegment.IsSmoothJoin); continue; }

                var arcSegment = segment as ArcSegment;
                if (arcSegment != null) { ctx.ArcTo(arcSegment.Point, arcSegment.Size, arcSegment.RotationAngle, arcSegment.IsLargeArc, arcSegment.SweepDirection, arcSegment.IsStroked, arcSegment.IsSmoothJoin); continue; }
            }
        }
开发者ID:WenzCao,项目名称:automatic-graph-layout,代码行数:27,代码来源:GraphmapsNode.cs

示例7: DrawArrow

        void DrawArrow(StreamGeometryContext gc, Point from, Point to2, double Wings, double offset)
        {
            Point to = new Point(from.X * (1.0 - offset) + to2.X * offset, from.Y * (1.0 - offset) + to2.Y * offset);

            double dx = to2.X - from.X;
            double dy = to2.Y - from.Y;

            double len = Math.Sqrt(dx * dx + dy * dy);
            if (len == 0)
                return;

            dx = (dx / len) * (Wings);
            dy = (dy / len) * (Wings);

            Point A = new Point(to.X - dx, to.Y - dy);

            var pts0 = new Point(to.X, to.Y);
            dx /= 2;
            dy /= 2;
            var pts1 = new Point(A.X - dy, A.Y + dx);
            var pts2 = new Point(A.X + dx / 2, A.Y + dy / 2);
            var pts3 = new Point(A.X + dy, A.Y - dx);

            gc.BeginFigure(pts0, true, true);
            gc.PolyLineTo(new Point[] { pts1, pts2, pts3 }, true, true);
        }
开发者ID:MuffPotter,项目名称:xservernet-bin,代码行数:26,代码来源:ArrowDashLine.cs

示例8: DrawCustomShape

 private void DrawCustomShape(StreamGeometryContext context)
 {
     context.BeginFigure(this.DiagramPoints[0], true, false);
             context.PolyLineTo(this.DiagramPoints, true, true);
 }
开发者ID:Ravnii,项目名称:ATISv2,代码行数:5,代码来源:LineDiagram.cs

示例9: InternalDrawArrowGeometry

        private void InternalDrawArrowGeometry(StreamGeometryContext context)
        {
            Point pt1 = new Point(X1, this.Y1);
            Point pt2 = new Point(X2, this.Y2);

            var lastPt = pt1;
            context.BeginFigure(pt1, false, false);
            if (Points != null)
            {
                foreach (var point in Points)
                {
                    context.LineTo(point, true, true);
                }
                //The Previous Point (before the Endpoint) should be used for Angle Caluculation!
                if (Points.Count > 1)
                    lastPt = Points[Points.Count - 2];
            }
            context.LineTo(pt2, true, true);

            double theta = Math.Atan2(lastPt.Y - Y2, lastPt.X - X2);
            double sint = Math.Sin(theta);
            double cost = Math.Cos(theta);

            Point pt3 = new Point(
                X2 + (HeadWidth * cost - HeadHeight * sint),
                Y2 + (HeadWidth * sint + HeadHeight * cost));

            Point pt4 = new Point(
                X2 + (HeadWidth * cost + HeadHeight * sint),
                Y2 - (HeadHeight * cost - HeadWidth * sint));

            context.BeginFigure(pt2, true, false);
            context.PolyLineTo(new[] {pt3, pt4, pt2}, true, true);
        }
开发者ID:Mortimer76,项目名称:DiagrammDesigner,代码行数:34,代码来源:ArrowPath.cs


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