Esempio n. 1
0
 /// <summary>
 /// Clones arrow style.
 /// </summary>
 /// <returns>The new instance of the <see cref="ArrowStyle"/> class.</returns>
 public static IArrowStyle Clone(this IArrowStyle arrowStyle)
 {
     return(new ArrowStyle()
     {
         Name = arrowStyle.Name,
         Stroke = arrowStyle.Stroke.Clone(),
         Fill = arrowStyle.Fill.Clone(),
         Thickness = arrowStyle.Thickness,
         LineCap = arrowStyle.LineCap,
         Dashes = arrowStyle.Dashes,
         DashOffset = arrowStyle.DashOffset,
         ArrowType = arrowStyle.ArrowType,
         IsStroked = arrowStyle.IsStroked,
         IsFilled = arrowStyle.IsFilled,
         RadiusX = arrowStyle.RadiusX,
         RadiusY = arrowStyle.RadiusY
     });
 }
Esempio n. 2
0
        private Marker CreatArrowMarker(double x, double y, double angle, IArrowStyle style)
        {
            switch (style.ArrowType)
            {
            default:
            case ArrowType.None:
            {
                var marker = new NoneMarker();

                marker.Style = style;
                marker.Point = new SKPoint((float)x, (float)y);

                return(marker);
            }

            case ArrowType.Rectangle:
            {
                double rx = style.RadiusX;
                double ry = style.RadiusY;
                double sx = 2.0 * rx;
                double sy = 2.0 * ry;

                var marker = new RectangleMarker();

                marker.Style    = style;
                marker.Rotation = MatrixHelper.Rotation(angle, new SKPoint((float)x, (float)y));
                marker.Point    = MatrixHelper.TransformPoint(marker.Rotation, new SKPoint((float)(x - sx), (float)y));

                var rect2 = new Rect2(x - sx, y - ry, sx, sy);
                marker.Rect = SKRect.Create((float)rect2.X, (float)rect2.Y, (float)rect2.Width, (float)rect2.Height);

                return(marker);
            }

            case ArrowType.Ellipse:
            {
                double rx = style.RadiusX;
                double ry = style.RadiusY;
                double sx = 2.0 * rx;
                double sy = 2.0 * ry;

                var marker = new EllipseMarker();

                marker.Style    = style;
                marker.Rotation = MatrixHelper.Rotation(angle, new SKPoint((float)x, (float)y));
                marker.Point    = MatrixHelper.TransformPoint(marker.Rotation, new SKPoint((float)(x - sx), (float)y));

                var rect2 = new Rect2(x - sx, y - ry, sx, sy);
                marker.Rect = SKRect.Create((float)rect2.X, (float)rect2.Y, (float)rect2.Width, (float)rect2.Height);

                return(marker);
            }

            case ArrowType.Arrow:
            {
                double rx = style.RadiusX;
                double ry = style.RadiusY;
                double sx = 2.0 * rx;
                double sy = 2.0 * ry;

                var marker = new ArrowMarker();

                marker.Style    = style;
                marker.Rotation = MatrixHelper.Rotation(angle, new SKPoint((float)x, (float)y));
                marker.Point    = MatrixHelper.TransformPoint(marker.Rotation, new SKPoint((float)x, (float)y));

                marker.P11 = MatrixHelper.TransformPoint(marker.Rotation, new SKPoint((float)(x - sx), (float)(y + sy)));
                marker.P21 = MatrixHelper.TransformPoint(marker.Rotation, new SKPoint((float)x, (float)y));
                marker.P12 = MatrixHelper.TransformPoint(marker.Rotation, new SKPoint((float)(x - sx), (float)(y - sy)));
                marker.P22 = MatrixHelper.TransformPoint(marker.Rotation, new SKPoint((float)x, (float)y));

                return(marker);
            }
            }
        }
Esempio n. 3
0
        private Marker CreatArrowMarker(double x, double y, double angle, IArrowStyle style)
        {
            switch (style.ArrowType)
            {
            default:
            case ArrowType.None:
            {
                var marker = new NoneMarker();

                marker.Style = style;
                marker.Point = new A.Point(x, y);

                return(marker);
            }

            case ArrowType.Rectangle:
            {
                double rx = style.RadiusX;
                double ry = style.RadiusY;
                double sx = 2.0 * rx;
                double sy = 2.0 * ry;

                var marker = new RectangleMarker();

                marker.Style    = style;
                marker.Rotation = AME.MatrixHelper.Rotation(angle, new A.Vector(x, y));
                marker.Point    = AME.MatrixHelper.TransformPoint(marker.Rotation, new A.Point(x - sx, y));

                var rect2 = new Rect2(x - sx, y - ry, sx, sy);
                marker.Rect = new A.Rect(rect2.X, rect2.Y, rect2.Width, rect2.Height);

                return(marker);
            }

            case ArrowType.Ellipse:
            {
                double rx = style.RadiusX;
                double ry = style.RadiusY;
                double sx = 2.0 * rx;
                double sy = 2.0 * ry;

                var marker = new EllipseMarker();

                marker.Style    = style;
                marker.Rotation = AME.MatrixHelper.Rotation(angle, new A.Vector(x, y));
                marker.Point    = AME.MatrixHelper.TransformPoint(marker.Rotation, new A.Point(x - sx, y));

                var rect2 = new Rect2(x - sx, y - ry, sx, sy);
                var rect  = new A.Rect(rect2.X, rect2.Y, rect2.Width, rect2.Height);
                marker.EllipseGeometry = new AM.EllipseGeometry(rect);

                return(marker);
            }

            case ArrowType.Arrow:
            {
                double rx = style.RadiusX;
                double ry = style.RadiusY;
                double sx = 2.0 * rx;
                double sy = 2.0 * ry;

                var marker = new ArrowMarker();

                marker.Style    = style;
                marker.Rotation = AME.MatrixHelper.Rotation(angle, new A.Vector(x, y));
                marker.Point    = AME.MatrixHelper.TransformPoint(marker.Rotation, new A.Point(x, y));

                marker.P11 = AME.MatrixHelper.TransformPoint(marker.Rotation, new A.Point(x - sx, y + sy));
                marker.P21 = AME.MatrixHelper.TransformPoint(marker.Rotation, new A.Point(x, y));
                marker.P12 = AME.MatrixHelper.TransformPoint(marker.Rotation, new A.Point(x - sx, y - sy));
                marker.P22 = AME.MatrixHelper.TransformPoint(marker.Rotation, new A.Point(x, y));

                return(marker);
            }
            }
        }