當前位置: 首頁>>代碼示例>>C#>>正文


C# StreamGeometryContext.BeginFigure方法代碼示例

本文整理匯總了C#中System.Windows.Media.StreamGeometryContext.BeginFigure方法的典型用法代碼示例。如果您正苦於以下問題:C# StreamGeometryContext.BeginFigure方法的具體用法?C# StreamGeometryContext.BeginFigure怎麽用?C# StreamGeometryContext.BeginFigure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Media.StreamGeometryContext的用法示例。


在下文中一共展示了StreamGeometryContext.BeginFigure方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreateArrows

        private void CreateArrows(Path path, StreamGeometryContext gc)
        {
            double start;

            if (path.PathType == PathType.Convex)
            {
                start = GeometryHelper.GetAngleFromPoint(path.StartPoint, path.Origin);
            }
            else
            {
                start = GeometryHelper.GetAngleFromPoint(path.EndPoint, path.Origin);
            }

            for(int i= 0; i < 10; i++)
            {
                start += 8;
                var org = GeometryHelper.GetPointAtAngle(path.Origin, path.Radius, start);
                var pt1 = GeometryHelper.GetPointAtAngle(path.Origin, path.Radius + 10, start);
                var pt2 = GeometryHelper.GetPointAtAngle(path.Origin, path.Radius - 10, start);
                var pt3 = GeometryHelper.GetPointAtAngle(org, 20, start + 90);

                gc.BeginFigure(pt1, true, true);
                gc.LineTo(pt2, true, true);
                gc.LineTo(pt3, true, true);
                gc.LineTo(pt1, true, true);

                gc.BeginFigure(path.Origin, false, false);
                gc.LineTo(pt1, true, true);

            }
        }
開發者ID:curtmantle,項目名稱:Geometry,代碼行數:31,代碼來源:PathElementsVisual.cs

示例2: Draw

        public override void Draw(StreamGeometryContext context, Connection connection)
        {
            if (connection.SourceConnectionPoint == null || connection.TargetConnectionPoint == null)
            {
                context.BeginFigure(connection.StartPoint, true, false);
                context.LineTo(connection.EndPoint, true, true);
            }
            else if(connection.Source == connection.Target)
            {
                Point startPoint = connection.SourceEndPoint.EndPoint;
                Point midPoint = connection.SourceConnectionPoint.LineAwayFromThisTo(startPoint, 50);

                context.BeginFigure(startPoint, true, true);
                context.ArcTo(midPoint, new Size(50, 50), 180, false, SweepDirection.Clockwise, true, true);
                context.ArcTo(startPoint, new Size(50, 50), 180, false, SweepDirection.Clockwise, true, true);
            }
            else
            {
                Point startPoint = connection.SourceEndPoint.EndPoint;
                Point endPoint = connection.TargetEndPoint.EndPoint;

                context.BeginFigure(startPoint, true, false);
                context.LineTo(endPoint, true, true);
            }
        }
開發者ID:uQr,項目名稱:Visual-NHibernate,代碼行數:25,代碼來源:IConnectionDrawingStrategy.cs

示例3: DrawParallelLines

        public static void DrawParallelLines(StreamGeometryContext context, Point startPoint, Point endPoint, int spacing)
        {
            Vector perpendicularLine = GetPerpendicularLine(startPoint, endPoint);

            // Draw 1->2 line
            context.BeginFigure(startPoint + (perpendicularLine * spacing), true, false);
            context.LineTo(endPoint + (perpendicularLine * spacing), true, true);

            // Draw 2->1 line
            context.BeginFigure(startPoint - (perpendicularLine * spacing), true, false);
            context.LineTo(endPoint - (perpendicularLine * spacing), true, true);
        }
開發者ID:uQr,項目名稱:Visual-NHibernate,代碼行數:12,代碼來源:DrawingHelper.cs

示例4: Draw

        public override void Draw(StreamGeometryContext context, Point startPoint, Point endPoint)
        {
            Vector line = endPoint - startPoint;
            Vector perpendicularLine = new Vector(line.Y, -line.X);
            perpendicularLine.Normalize();

            double halfLength = line.Length/2;
            Point leftPoint = startPoint - (perpendicularLine*halfLength);
            Point rightPoint = startPoint + (perpendicularLine * halfLength);

            var norLine = new Vector(line.X, line.Y);
            norLine.Normalize();
            Point shortEndPoint = endPoint - (norLine * 4);

            context.BeginFigure(startPoint, true, false);
            context.LineTo(shortEndPoint, true, false);

            context.LineTo(leftPoint, false, false);
            context.LineTo(shortEndPoint, true, false);

            context.LineTo(rightPoint, false, false);
            context.LineTo(shortEndPoint, true, false);

            context.LineTo(endPoint, true, false);
        }
開發者ID:uQr,項目名稱:Visual-NHibernate,代碼行數:25,代碼來源:ManyConnectorEndPoint.cs

示例5: Polygon

 static void Polygon(StreamGeometryContext ctx, Point point, double size, double startAngle, int steps)
 {
     var halfSize = size / 2;
     var xOffset = halfSize * Math.Sin(startAngle);
     var yOffset = halfSize * Math.Cos(startAngle);
     ctx.BeginFigure(new Point(point.X + xOffset, point.Y - yOffset), true, true);
     for (var angle = startAngle + (MoreMath.TwoPi / steps); angle < MoreMath.TwoPi; angle += MoreMath.TwoPi / steps) ctx.LineTo(new Point(point.X + (halfSize * Math.Sin(angle)), point.Y - (halfSize * Math.Cos(angle))), true, true);
 }
開發者ID:AuditoryBiophysicsLab,項目名稱:ESME-Workbench,代碼行數:8,代碼來源:SeriesMarkerType.cs

示例6: Draw

        public void Draw(StreamGeometryContext context, Connection connection)
        {
            Point startPoint = connection.SourceEndPoint.EndPoint;
            Point endPoint = connection.TargetEndPoint.EndPoint;

            context.BeginFigure(startPoint, true, false);
            context.LineTo(endPoint, true, true);
        }
開發者ID:uQr,項目名稱:Visual-NHibernate,代碼行數:8,代碼來源:InheritanceDrawingStrategy.cs

示例7: AddCircleToGeometry

 private static void AddCircleToGeometry(StreamGeometryContext streamGeometryContext, Point[] points, double pointSize)
 {
     foreach (Point point in points)
     {
         streamGeometryContext.BeginFigure(new Point(point.X - (pointSize / 2), point.Y - (pointSize / 2)), true, true);
         streamGeometryContext.ArcTo(new Point(point.X - (pointSize / 2) - 0.0001, point.Y - (pointSize / 2)),
             new Size(pointSize, pointSize), 360, true, SweepDirection.Clockwise, true, false);
     }
 }
開發者ID:HackatonArGP,項目名稱:Guardianes,代碼行數:9,代碼來源:SqlGeometryHelper.cs

示例8: 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

示例9: DrawTriangle

 public static void DrawTriangle(StreamGeometryContext context, Vector mainLine, Vector mainPerpendicularLine, Point point1, int size, bool isFilled)
 {
     int halfSize = size / 2;
     context.BeginFigure(point1, isFilled, true);
     var point2 = point1 + (mainPerpendicularLine * halfSize) + (mainLine * size);
     var point3 = point1 - (mainPerpendicularLine * halfSize) + (mainLine * size);
     context.LineTo(point2, true, true);
     context.LineTo(point3, true, true);
 }
開發者ID:uQr,項目名稱:Visual-NHibernate,代碼行數:9,代碼來源:DrawingHelper.cs

示例10: InternalDrawGeometry

        private void InternalDrawGeometry(StreamGeometryContext context)
        {
            generateGeometry();

            context.BeginFigure(tips[0], true, true);
            for (int x = 1; x < points.Count(); x++)
            {
                context.LineTo(points[x], true, true);
            }
        }
開發者ID:wshanshan,項目名稱:DDD,代碼行數:10,代碼來源:Star.cs

示例11: OpenFigure

 static void OpenFigure(StreamGeometryContext ctx, Point point, double size, double startAngle, int steps)
 {
     var halfSize = size / 2;
     for (var angle = startAngle; angle <= Math.PI; angle += Math.PI / steps)
     {
         var xOffset = halfSize * Math.Sin(angle);
         var yOffset = halfSize * Math.Cos(angle);
         ctx.BeginFigure(new Point(point.X + xOffset, point.Y - yOffset), false, false);
         ctx.LineTo(new Point(point.X - xOffset, point.Y + yOffset), true, false);
     }            
 }
開發者ID:AuditoryBiophysicsLab,項目名稱:ESME-Workbench,代碼行數:11,代碼來源:SeriesMarkerType.cs

示例12: Draw

        public override void Draw(StreamGeometryContext context, Point startPoint, Point endPoint)
        {
            base.Draw(context, startPoint, endPoint);

            Vector line = endPoint - startPoint;
            Vector perpendicularLine = new Vector(line.Y, -line.X);
            perpendicularLine.Normalize();

            double halfLength = line.Length / 2;
            Point leftPoint = endPoint - (perpendicularLine * halfLength);
            Point rightPoint = endPoint + (perpendicularLine * halfLength);

            context.BeginFigure(leftPoint, true, false);
            context.LineTo(rightPoint, true, false);
        }
開發者ID:uQr,項目名稱:Visual-NHibernate,代碼行數:15,代碼來源:IConnectorEndPointDrawingStrategy.cs

示例13: AddSegmentToGeometry

 private static void AddSegmentToGeometry(StreamGeometryContext streamGeometryContext, Point[] points, bool close)
 {
     for (int i = 0; i < points.Length; i++)
     {
         if (i == 0)
         {
             streamGeometryContext.BeginFigure(points[i], true, false);
         }
         else
         {
             streamGeometryContext.LineTo(points[i], true, true);
         }
     }
     if (close)
     {
         streamGeometryContext.LineTo(points[0], true, true);
     }
 }
開發者ID:HackatonArGP,項目名稱:Guardianes,代碼行數:18,代碼來源:SqlGeometryHelper.cs

示例14: InternalDrawArrowGeometry

		private void InternalDrawArrowGeometry(StreamGeometryContext context)
		{
			var theta = Math.Atan2(Y1 - Y2, X1 - X2);
			var sint = Math.Sin(theta);
			var cost = Math.Cos(theta);

			var pt1 = new Point(X1, Y1);
			var pt2 = new Point(X2, Y2);

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

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

			context.BeginFigure(pt1, true, false);
			context.LineTo(pt2, true, true);
			context.LineTo(pt3, true, true);
			context.LineTo(pt2, true, true);
			context.LineTo(pt4, true, true);
		}
開發者ID:christopher7694,項目名稱:Hearthstone-Deck-Tracker,代碼行數:19,代碼來源:Arrow.cs

示例15: DrawArrowGeometry

        /// <summary>
        /// The actual method for drawing the arrow.
        /// </summary>
        /// <param name="StreamGeometryContext">Describes a geometry using drawing commands.</param>
        protected override void DrawArrowGeometry(StreamGeometryContext StreamGeometryContext)
        {
            var theta = Math.Atan2(Y1 - Y2, X1 - X2);
            var sint  = Math.Sin(theta);
            var cost  = Math.Cos(theta);

            var ArrowOrigin = new Point(X1, Y1);
            var ArrowTarget = new Point(X2, Y2);

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

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

            StreamGeometryContext.BeginFigure(ArrowOrigin, isFilled:  true, isClosed:    false);
            StreamGeometryContext.LineTo     (ArrowTarget, isStroked: true, isSmoothJoin: true);
            StreamGeometryContext.LineTo     (pt3,         isStroked: true, isSmoothJoin: true);
            StreamGeometryContext.LineTo     (ArrowTarget, isStroked: true, isSmoothJoin: true);
            StreamGeometryContext.LineTo     (pt4,         isStroked: true, isSmoothJoin: true);
        }
開發者ID:subbuballa,項目名稱:Loki,代碼行數:25,代碼來源:Arrow.cs


注:本文中的System.Windows.Media.StreamGeometryContext.BeginFigure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。