Example #1
0
        public void Draw(Graphics g, bool current, Color color, bool allix, bool coord, ScreenConverter sc)
        {
            Pen   p  = new Pen(color);
            float t  = 0f;
            float dt = 0.01f;

            PointF[] result = new PointF[101];
            for (int i = 0; i <= 100; i++)
            {
                result[i] = B(t, sc);
                t        += dt;
            }
            if (allix && current)
            {
                g.DrawLine(Pens.Silver, sc.II(P1.X), sc.JJ(P1.Y), sc.II(P2.X), sc.JJ(P2.Y));
                g.DrawLine(Pens.Silver, sc.II(P3.X), sc.JJ(P3.Y), sc.II(P4.X), sc.JJ(P4.Y));
                P2.Draw(g, current, allix, coord, sc);
                P3.Draw(g, current, allix, coord, sc);
            }
            if (current)
            {
                p.Color = Color.Black;
                g.DrawLines(p, result);
            }
            else
            {
                p.Color = Color.FromArgb(220, Color.DarkSlateGray);
                g.DrawLines(p, result);
            }
        }
Example #2
0
        private PointF B(float t, int pt, float x, float y, ScreenConverter sc)
        {
            float  c0 = (1 - t) * (1 - t) * (1 - t);
            float  c1 = (1 - t) * (1 - t) * 3 * t;
            float  c2 = (1 - t) * t * 3 * t;
            float  c3 = t * t * t;
            double X  = c0 * (sc.II(P1.X) * pt + x) + c1 * (sc.II(P2.X) * pt + x) + c2 * (sc.II(P3.X) * pt + x) + c3 * (sc.II(P4.X) * pt + x);
            double Y  = c0 * (sc.JJ(P1.Y) * pt + y) + c1 * (sc.JJ(P2.Y) * pt + y) + c2 * (sc.JJ(P3.Y) * pt + y) + c3 * (sc.JJ(P4.Y) * pt + y);

            return(new PointF((float)X, (float)Y));
        }
Example #3
0
        private PointF B(float t, ScreenConverter sc)
        {
            float  c0 = (1 - t) * (1 - t) * (1 - t);
            float  c1 = (1 - t) * (1 - t) * 3 * t;
            float  c2 = (1 - t) * t * 3 * t;
            float  c3 = t * t * t;
            double x  = c0 * sc.II(P1.X) + c1 * sc.II(P2.X) + c2 * sc.II(P3.X) + c3 * sc.II(P4.X);
            double y  = c0 * sc.JJ(P1.Y) + c1 * sc.JJ(P2.Y) + c2 * sc.JJ(P3.Y) + c3 * sc.JJ(P4.Y);

            return(new PointF((float)x, (float)y));
        }
Example #4
0
 public void Draw(Graphics g, bool allix, int pt, float x, float y, ScreenConverter sc)
 {
     if (Current)
     {
         g.DrawLine(Pens.Red, sc.II(P1.X) * pt + x, sc.JJ(P1.Y) * pt + y, sc.II(P2.X) * pt + x, sc.JJ(P2.Y) * pt + y);
     }
     else
     {
         g.DrawLine(Pens.Black, sc.II(P1.X) * pt + x, sc.JJ(P1.Y) * pt + y, sc.II(P2.X) * pt + x, sc.JJ(P2.Y) * pt + y);
     }
 }
Example #5
0
        public void DrawBorder(Graphics g, ScreenConverter sc)
        {
            PointF p1 = new PointF(sc.II(0), sc.JJ(0));
            PointF p2 = new PointF(sc.II(0), sc.JJ(1));
            PointF p3 = new PointF(sc.II(1 * font.symbolWidth / 100f), sc.JJ(0));
            PointF p4 = new PointF(sc.II(1 * font.symbolWidth / 100f), sc.JJ(1));

            g.DrawLine(Pens.Black, p1, p2);
            g.DrawLine(Pens.Black, p1, p3);
            g.DrawLine(Pens.Black, p4, p3);
            g.DrawLine(Pens.Black, p2, p4);
            //g.DrawRectangle(Pens.Black, sc.II(sc.RX), sc.JJ(sc.RY), sc.LS(1), sc.LS(1));
        }
Example #6
0
 private int SearchMyPoint(PointF p, ScreenConverter sc)
 {
     if (p != null)
     {
         for (int i = 0; i < curContour.myPoints.Count; i++)
         {
             MyPoint P = curContour.myPoints[i];
             if (p.X <= sc.II(P.X) + 4 && p.X >= sc.II(P.X) - 4 && p.Y >= sc.JJ(P.Y) - 4 && p.Y <= sc.JJ(P.Y) + 4)
             {
                 return(i);
             }
         }
     }
     return(-1);
 }
Example #7
0
        public void Draw(Graphics g, bool current, Color color, bool allix, bool coord, ScreenConverter sc)
        {
            Pen p = new Pen(color);

            if (current)
            {
                p.Color = Color.Black;
                g.DrawLine(p, sc.II(P1.X), sc.JJ(P1.Y), sc.II(P2.X), sc.JJ(P2.Y));
            }
            else
            {
                p.Color = Color.FromArgb(220, Color.DarkSlateGray);
                g.DrawLine(p, sc.II(P1.X), sc.JJ(P1.Y), sc.II(P2.X), sc.JJ(P2.Y));
            }
        }
Example #8
0
 public void UpdatePoint(float dx, float dy, ScreenConverter sc)
 {
     if (curPoint != null)
     {
         MyPoint cur = curPoint;
         if (!(sc.II(cur.X) + dx > Width - 4) && sc.II(cur.X) + dx > 0)
         {
             cur.X += sc.LR((int)dx);
         }
         if (!(sc.JJ(cur.Y) + dy > Height - 4) && sc.JJ(cur.Y) + dy > 0)
         {
             cur.Y -= sc.LR((int)dy);
         }
         curPoint.Current = false;
     }
 }
Example #9
0
 private MyPoint SearchPoint(PointF p, ScreenConverter sc)
 {
     /*foreach (MyPoint P in curContour.myPoints)
      *  if (p.X <= sc.II(P.X) + 4 && p.X >= sc.II(P.X) - 4 && p.Y >= sc.JJ(P.Y) - 4 && p.Y <= sc.JJ(P.Y) + 4)
      *      return P;*/
     foreach (ILine l in curContour.lines)
     {
         foreach (MyPoint P in l.GetSecondPoints())
         {
             if (p.X <= sc.II(P.X) + 4 && p.X >= sc.II(P.X) - 4 && p.Y >= sc.JJ(P.Y) - 4 && p.Y <= sc.JJ(P.Y) + 4)
             {
                 return(P);
             }
         }
     }
     return(null);
 }
Example #10
0
        public void Draw(Graphics g, bool allix, int pt, float x, float y, ScreenConverter sc)
        {
            float t  = 0f;
            float dt = 0.01f;

            PointF[] result = new PointF[101];
            for (int i = 0; i <= 100; i++)
            {
                result[i] = B(t, pt, x, y, sc);
                t        += dt;
            }
            if (allix)
            {
                g.DrawLine(Pens.Silver, sc.II(P1.X) * pt + x, sc.JJ(P1.Y) * pt + y, sc.II(P2.X) * pt + x, sc.JJ(P2.Y) * pt + y);
                g.DrawLine(Pens.Silver, sc.II(P3.X) * pt + x, sc.JJ(P3.Y) * pt + y, sc.II(P4.X) * pt + x, sc.JJ(P4.Y) * pt + y);
            }
            g.DrawLines(Pens.Black, result);
        }
Example #11
0
        public void Draw(Graphics g, bool curCont, bool allix, bool coord, ScreenConverter sc)
        {
            Pen p = new Pen(Brushes.Black);

            if (!allix)
            {
                return;
            }
            if (coord)
            {
                string s = "(" + sc.II(X) + ";" + sc.JJ(Y) + ")";
                Brush  b = new SolidBrush(Color.White);
                if (curCont)
                {
                    b = new SolidBrush(Color.FromArgb(60, Color.Black));
                }
                else
                {
                    b = new SolidBrush(Color.FromArgb(60, Color.Silver));
                }
                if (curCont)
                {
                    g.DrawString(s, new Font("Courier", 8), b, sc.II(X) + 4, sc.JJ(Y) - 1);
                }
            }
            if (curCont)
            {
                p.Color = Color.Black;
            }
            if (!curCont && !Current)
            {
                p.Color = Color.FromArgb(180, Color.DarkSlateGray);
            }
            if (First)
            {
                p.Color = Color.Blue;
            }
            if (Current)
            {
                p.Color = Color.Red;
            }
            g.DrawEllipse(p, sc.II(X) - 3, sc.JJ(Y) - 3, 6, 6);
        }