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


C# StreamGeometryContext.LineTo方法代码示例

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


在下文中一共展示了StreamGeometryContext.LineTo方法的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: 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

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

示例5: Star

 static void Star(StreamGeometryContext ctx, Point point, double size, double startAngle, int steps)
 {
     var halfSize = size / 2;
     var quarterSize = halfSize / 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 = Math.PI / steps; angle < MoreMath.TwoPi; angle += Math.PI / steps)
     {
         ctx.LineTo(new Point(point.X + (quarterSize * Math.Sin(angle)), point.Y - (quarterSize * Math.Cos(angle))), true, true);
         angle += Math.PI / steps;
         ctx.LineTo(new Point(point.X + (halfSize * Math.Sin(angle)), point.Y - (halfSize * Math.Cos(angle))), true, true);
     }
 }
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:14,代码来源: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: 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

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

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

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

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

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

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

示例14: _drawTriangularTail

 // draws a triangle at the tail
 private void _drawTriangularTail(StreamGeometryContext c, Point p, Vector v) {
    var p0 = p - v * 17;
    var h = _rotate90(v) * 15;
    c.BeginFigure(p, true, true);
    c.LineTo(p0 + h, true, true);
    c.LineTo(p0 - h, true, true);
 }
开发者ID:borkaborka,项目名称:gmit,代码行数:8,代码来源:DiagramEdge.cs

示例15: ParseToGeometryContext

        /// <summary>
        /// Parse a PathFigureCollection string
        /// </summary>
        internal void ParseToGeometryContext(
            StreamGeometryContext context,
            string pathString,
            int startIndex)
        {
            // [BreakingChange] Dev10 Bug #453199
            // We really should throw an ArgumentNullException here for context and pathString.
            
            // From original code
            // This is only used in call to Double.Parse
            _formatProvider = System.Globalization.CultureInfo.InvariantCulture;
            
            _context         = context;
            _pathString      = pathString;
            _pathLength      = pathString.Length;
            _curIndex        = startIndex;
            
            _secondLastPoint = new Point(0, 0);
            _lastPoint       = new Point(0, 0);
            _lastStart       = new Point(0, 0);
            
            _figureStarted = false;
            
            bool  first = true;
            
            char last_cmd = ' ';

            while (ReadToken()) // Empty path is allowed in XAML
            {
                char cmd = _token;

                if (first)
                {
                    if ((cmd != 'M') && (cmd != 'm'))  // Path starts with M|m
                    {
                        ThrowBadToken();
                    }
            
                    first = false;
                }                    
                
                switch (cmd)
                {
                case 'm': case 'M':
                    // XAML allows multiple points after M/m
                    _lastPoint = ReadPoint(cmd, ! AllowComma);
                    
                    context.BeginFigure(_lastPoint, IsFilled, ! IsClosed);
                    _figureStarted = true;
                    _lastStart = _lastPoint;
                    last_cmd = 'M';
                    
                    while (IsNumber(AllowComma))
                    {
                        _lastPoint = ReadPoint(cmd, ! AllowComma);
                        
                        context.LineTo(_lastPoint, IsStroked, ! IsSmoothJoin);
                        last_cmd = 'L';
                    }
                    break;

                case 'l': case 'L':
                case 'h': case 'H':
                case 'v': case 'V':
                    EnsureFigure();

                    do
                    {
                        switch (cmd)
                        {
                        case 'l': _lastPoint    = ReadPoint(cmd, ! AllowComma); break;
                        case 'L': _lastPoint    = ReadPoint(cmd, ! AllowComma); break;
                        case 'h': _lastPoint.X += ReadNumber(! AllowComma); break;
                        case 'H': _lastPoint.X  = ReadNumber(! AllowComma); break; 
                        case 'v': _lastPoint.Y += ReadNumber(! AllowComma); break;
                        case 'V': _lastPoint.Y  = ReadNumber(! AllowComma); break;
                        }

                        context.LineTo(_lastPoint, IsStroked, ! IsSmoothJoin); 
                    }
                    while (IsNumber(AllowComma));

                    last_cmd = 'L';
                    break;

                case 'c': case 'C': // cubic Bezier
                case 's': case 'S': // smooth cublic Bezier
                    EnsureFigure();
                    
                    do
                    {
                        Point p;
                        
                        if ((cmd == 's') || (cmd == 'S'))
                        {
                            if (last_cmd == 'C')
                            {
//.........这里部分代码省略.........
开发者ID:JianwenSun,项目名称:cc,代码行数:101,代码来源:parserscommon.cs


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