当前位置: 首页>>代码示例>>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;未经允许,请勿转载。