Esempio n. 1
0
        public static SKPath CreateArc(ArcSegment a, WhiteBoard w = null)
        {
            if (w == null)

            {
                return(CreateArc(a.Start, a.End, a.End, a.CW));
            }
            else
            {
                return(CreateArc(w.BoardToCanvas(a.Start), w.BoardToCanvas(a.End), w.BoardToCanvas(a.Center), a.CW));
            }
        }
Esempio n. 2
0
        public void Draw(WhiteBoard w, SKCanvas h, SKPaint lines, SKPaint moves)
        {
            Parallel.ForEach(DrawCommands, (command) =>
            {
                //command.Value.Draw(w, h, zeroPoint, lines, moves, ScaleFactor, RotationDeg);
                var r = (GcodeDrawCommand)command.Value;

                if (r.DrawType == typeof(GcodeArc))
                {
                    var q = (GcodeArc)command.Value;
                    var i = q.getArc(zeroPoint, ScaleFactor, RotationDeg);
                    SKPaint p;
                    if (q.PenDown)
                    {
                        p = lines;
                    }
                    else
                    {
                        p = moves;
                    }

                    //h.DrawPath(Transformations.CreateArc(i,w),p);
                    h.DrawLine(w.BoardToCanvas(i.Start), w.BoardToCanvas(i.End), p);
                    //TODO: Teken daadwerkelijk een arc!!
                }
                else if (r.DrawType == typeof(GcodeLine))
                {
                    var q = (GcodeLine)command.Value;
                    var i = q.getLine(zeroPoint, ScaleFactor, RotationDeg);
                    SKPaint p;
                    if (q.PenDown)
                    {
                        p = lines;
                    }
                    else
                    {
                        p = moves;
                    }

                    h.DrawLine(w.BoardToCanvas(i.Start), w.BoardToCanvas(i.End), p);
                    //Console.WriteLine("Draw Line!");
                }
                else
                {
                    Console.WriteLine("Not Line or arc!");
                }
            });
        }
Esempio n. 3
0
        public static SKPoint GetTransformedToBoard(WhiteBoard v, SKPoint point, SKPoint zero, float scale,
                                                    float rotation)
        {
            var pointinverted = RotateDegrees(InvertXY(point), rotation);

            var w = new SKPoint((zero.X + (pointinverted.X * scale)), (zero.Y + (pointinverted.Y * scale)));

            return(v.BoardToCanvas(w));
        }