示例#1
0
 public void ChooseContour(int n)
 {
     if (n == -1)
     {
         curContour = null;
         return;
     }
     if (n < curSymbol.contours.Count)
     {
         foreach (Contour c in curSymbol.contours)
         {
             c.Current = false;
         }
         curContour                    = curSymbol.contours[n];
         curContour.Current            = true;
         curSymbol.contours[n].Current = true;
         firstPoint                    = null;
         curPoint  = null;
         lastPoint = null;
         if (curContour.GetPoints().Count > 0)
         {
             foreach (MyPoint p in curContour.GetPoints())
             {
                 if (p.First)
                 {
                     firstPoint = p;
                 }
             }
             GetLastPoint();
         }
     }
 }
示例#2
0
        private Contour ContourFromString(string str, ref int pos)
        {
            Contour c = new Contour();

            while (str[pos] == ' ')
            {
                pos++;
            }
            while (str[pos] == 'l' && str[pos + 1] == 'n' && str[pos + 2] == ':')
            {
                pos += 3;
                c.lines.Add(LineFromString(str, ref pos));
                if (pos >= str.Length)
                {
                    break;
                }
                while (str[pos] == ' ')
                {
                    pos++;
                }
            }
            List <MyPoint> points = c.GetPoints();
            List <ILine>   L      = c.lines;
            List <ILine>   ln     = new List <ILine>();

            foreach (ILine l in L)
            {
                ln.Add(LineOnPoints(l, points));
            }
            c.myPoints = points;
            c.lines    = ln;
            return(c);
        }