Exemplo n.º 1
0
 public override void OnMouseDown(MouseEventArgs e)
 {
     if (lastP == null)
     {
         lastP = WinManager.Instance.CreatePoint(e.X, CGUtils.ReversedY(e.Y));
         Draw.DrawPoint(lastP);
     }
     Draw.DrawImage();
 }
Exemplo n.º 2
0
        public override void DrawResult()
        {
            var ltl  = CGUtils.LowestThenLeftmost(WinManager.Instance.data.points);
            var curr = ltl;

            do
            {
                Draw.DrawLine(curr, curr.succ);
                curr = curr.succ;
            } while (ltl != curr);
            Draw.DrawImage();
        }
Exemplo n.º 3
0
 public override void OnMouseMove(MouseEventArgs e)
 {
     if (form.IsMouseDown)
     {
         var currP = form.currPt;
         //if (form.Points.Count > 1 && CGUtils.SqrtLength(form.Points[0], currP) < 500) {
         //    currP.Y = CGUtils.ReversedY(currP.Y);
         //    Point p = form.PictureBox1.PointToScreen(new Point((int)form.Points[0].x, (int)CGUtils.ReversedY(form.Points[0].y)));
         //}
         Draw.DrawImage();
     }
 }
Exemplo n.º 4
0
        public virtual void DrawResult()
        {
            var dashLinePen = new Pen(Color.Gray);

            dashLinePen.DashStyle   = System.Drawing.Drawing2D.DashStyle.Custom;
            dashLinePen.DashPattern = new float[] { 5, 5 };
            Draw.SetPen(dashLinePen);
            for (int i = 0; i < p.internalEdges.Count; i++)
            {
                Draw.DrawLine(p.internalEdges[i].from, p.internalEdges[i].to);
            }
            Draw.DrawImage();
            Draw.ResetPen();
        }
Exemplo n.º 5
0
 public override void OnMouseMove(MouseEventArgs e)
 {
     if (form.IsMouseDown)
     {
         var currP = form.currPt;
         for (int i = 0; i < form.Points.Count; i++)
         {
             if (form.Points[i] != lastP && CGUtils.SqrtLength(form.Points[i], currP) < 500)
             {
                 currP.Y = CGUtils.ReversedY(currP.Y);
                 Point p = form.PictureBox1.PointToScreen(new Point((int)form.Points[i].x, (int)CGUtils.ReversedY(form.Points[i].y)));
                 SetCursorPos(p.X, p.Y);
                 linkPoint = form.Points[i];
             }
         }
         Draw.DrawImage();
     }
 }
Exemplo n.º 6
0
        public override void OnMouseUp(MouseEventArgs e)
        {
            var newP = WinManager.Instance.CreatePoint(e.X, CGUtils.ReversedY(e.Y));

            if (newP == null)
            {
                var currP = form.currPt;
                if (CGUtils.SqrtLength(linkPoint, currP) < 500)
                {
                    linkPoint.pred = lastP;
                    lastP.succ     = linkPoint;
                    Draw.DrawLine(lastP, linkPoint);
                    Draw.DrawImage();
                    lastP = null;
                }
                return;
            }
            Draw.DrawPoint(newP);
            Draw.DrawLine(lastP, newP);
            lastP.succ = newP;
            newP.pred  = lastP;
            lastP      = newP;
        }
Exemplo n.º 7
0
 public override void DrawResult()
 {
     pt.DrawResult();
     Draw.DrawImage();
 }