Ejemplo n.º 1
0
        public override void OnClick(EventArgs e)
        {
            var p     = form.currPt;
            var point = WinManager.Instance.CreatePoint(p.X, p.Y);

            Draw.DrawPoint(point, true);
        }
Ejemplo n.º 2
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 (form.Points.Count > 1 && CGUtils.SqrtLength(form.Points[0], currP) < 500) {
                //    form.Points[0].pred = lastP;
                //    lastP.succ = form.Points[0];
                //    Draw.DrawLine(lastP, form.Points[0]);
                //    Draw.DrawImage();
                //    lastP = null;
                //}
                return;
            }
            Draw.DrawPoint(newP);
            Draw.DrawLine(lastP, newP);
            var edge = CGEdge.CreateEdge(lastP, newP);

            edges.Add(edge);
            lastP.owner = edge;
            newP.owner  = edge;
            lastP.succ  = newP;
            newP.pred   = lastP;
            lastP       = null;
        }
Ejemplo n.º 3
0
 public void DrawResult()
 {
     Draw.SetPointColor(Color.Yellow);
     for (int i = 0; i < intersections.Count; i++)
     {
         Draw.DrawPoint(intersections[i].point, false, 7);
     }
     Draw.ReSetPointColor();
 }
Ejemplo n.º 4
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();
 }
Ejemplo n.º 5
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;
        }