示例#1
0
        public void Delete(LinkedList <string> codes)
        {
            string[] Codes   = new string[codes.Count];
            int      counter = 0;

            foreach (string s in codes)
            {
                Codes[counter++] = s;
            }
            foreach (Sphere s in spheres)
            {
                if (CoordinatesActions.consist(Codes, s.position))
                {
                    s.visualize = false;
                }
            }
            foreach (Cylinder c in cylinders)
            {
                if (CoordinatesActions.consist(Codes, c.int_coordinates[0]) ||
                    CoordinatesActions.consist(Codes, c.int_coordinates[1]))
                {
                    c.visualize = false;
                }
            }
        }
示例#2
0
        public void pant(LinkedList <string> codes, Color SphereColor, Color CylinderColor)
        {
            string[] Codes   = new string[codes.Count];
            int      counter = 0;

            foreach (string s in codes)
            {
                Codes[counter++] = s;
            }
            foreach (Sphere s in spheres)
            {
                if (CoordinatesActions.consist(Codes, s.position))
                {
                    s.paint(SphereColor);
                }
            }
            foreach (Cylinder c in cylinders)
            {
                if (CoordinatesActions.consist(Codes, c.int_coordinates[0]) &&
                    CoordinatesActions.consist(Codes, c.int_coordinates[1]))
                {
                    c.paint(CylinderColor);
                }
            }
        }
示例#3
0
        public void VisualizeOnly(LinkedList <string> codes, bool drawEdge)
        {
            string[] Codes   = new string[codes.Count];
            int      counter = 0;

            foreach (string s in codes)
            {
                Codes[counter++] = s;
            }
            foreach (Sphere s in spheres)
            {
                if (!CoordinatesActions.consist(Codes, s.position))
                {
                    s.visualize = false;
                }
                else
                {
                    s.visualize = true;
                }
            }
            if (drawEdge)
            {
                foreach (Cylinder c in cylinders)
                {
                    if (!CoordinatesActions.consist(Codes, c.int_coordinates[0]) ||
                        !CoordinatesActions.consist(Codes, c.int_coordinates[1]))
                    {
                        c.visualize = false;
                    }
                    else
                    {
                        c.visualize = true;
                    }
                }
            }
            else
            {
                foreach (Cylinder c in cylinders)
                {
                    if (!CoordinatesActions.consist(Codes, c.int_coordinates[0], c.int_coordinates[1]))
                    {
                        c.visualize = false;
                    }
                    else
                    {
                        c.visualize = true;
                    }
                }
            }
        }
示例#4
0
 public void setCubant(string str, Color SphereColor, Color CylinderColor, Color BorderColor)
 {
     if (str.Length != Basis.Length)
     {
         throw new Exception("Размерность кубанта не соответствует размерности гиперкуба.");
     }
     int[] code = new int[str.Length];
     for (int i = 0; i < str.Length; i++)
     {
         if (str[i] == '0')
         {
             code[i] = 0;
         }
         else
         if (str[i] == '1')
         {
             code[i] = 1;
         }
         else
         if (str[i] == '2')
         {
             code[i] = 2;
         }
         else
         {
             throw new Exception("Код кубанта содержит недопустимые символы: " + str[i]);
         }
     }
     foreach (Sphere s in spheres)
     {
         if (CoordinatesActions.consist(s.position, code))
         {
             s.paint(SphereColor);
         }
     }
     foreach (Cylinder c in cylinders)
     {
         if (CoordinatesActions.consist(c.int_coordinates[0], code) && CoordinatesActions.consist(c.int_coordinates[1], code))
         {
             c.paint(CylinderColor);
         }
     }
     if (Constants.UseBordersOption == BordersOption.OnlyDoors)
     {
         foreach (string s in cubants)
         {
             int[] cubantCode = CoordinatesActions.getCode(s);
             int[] per        = CoordinatesActions.peresechenie(cubantCode, code);
             if (per != null && CoordinatesActions.isSquare(per))
             {
                 addSquare(per, BorderColor);
             }
         }
     }
     if (Constants.UseBordersOption == BordersOption.All)
     {
         try
         {
             LinkedList <int[]> squares = CoordinatesActions.getAllSquares(code);
             foreach (int[] squarecode in squares)
             {
                 addSquare(squarecode, BorderColor);
             }
         }
         catch (Exception)
         {
             //nothing to do here
         }
     }
     cubants.AddLast(str);
     cubantColors.AddLast(SphereColor);
     cubantColors.AddLast(CylinderColor);
     cubantColors.AddLast(BorderColor);
 }