Ejemplo n.º 1
0
        public void AddPoint(NFPoint Point)
        {
            int L = Points.GetLength(0) + 1;

            Array.Resize <NFPoint>(ref Points, L);
            Points[L - 1] = Point;
        }
Ejemplo n.º 2
0
 public void AddPoint(NFPoint Point)
 {
     Points.Add(Point);
 }
Ejemplo n.º 3
0
        public void SaveToItems(string filePath)       //Функция для отладки в CatUI
        {
            //string filePath = "F:/items/";
            string taskfile = "TASKNAME\tNFTest\nTIMELIMIT:\t3600000\nTASKTYPE:\tSheet\n";

            taskfile += String.Format("WIDTH:\t{0}\nLENGTH:\t{1}\n", this.ListY, this.ListX);
            taskfile += "SHEETQUANT:\t1\n";
            taskfile += String.Format("ITEM2DOMAINDIST:\t{0}\n", this.p2l);
            taskfile += String.Format("ITEM2ITEMDIST:\t{0}\n", this.p2p);



            for (int item_id = 0; item_id < this.Count(); item_id++)
            {
                NFItem Item     = Items[item_id];
                int    CC       = Item.ContourCount();
                string fileData = "ITEMNAME:\t" + Item.Name + "\n";

                int    rot     = (Item.Rotation == 0 ? this.DefaultRotation : Item.Rotation - 1);
                string rotstep = "";
                switch (rot)
                {
                case 0:
                    rotstep = "NO";
                    break;

                case 1:
                    rotstep = "PI";
                    break;

                case 2:
                    rotstep = "PI/2";
                    break;

                case 3:
                    rotstep = "FREE";
                    break;
                }
                int refl  = (Item.Reflection == 0 ? this.DefaultReflection : Item.Reflection - 1);
                int count = (Item.Count == 0 ? this.DefaultItemCount : Item.Count);

                taskfile += String.Format("ITEMFILE:\t{0}.item\n", ".\\" + item_id);
                taskfile += String.Format("ITEMQUANT:\t{0}\n", count);
                taskfile += String.Format("ROTATE:\t{0}\n", (rot > 1 ? 1 : rot));
                taskfile += String.Format("ROTSTEP:\t{0}\n", rotstep);
                taskfile += String.Format("REFLECT:\t{0}\n", refl);


                for (int contour_id = 0; contour_id < CC; contour_id++)
                {
                    NFContour contour = Item.GetContour(contour_id);
                    int       VC      = contour.VertexCount();
                    fileData += "VERTQUANT:\t" + VC + "\n";

                    for (int v_id = 0; v_id < VC; v_id++)
                    {
                        NFPoint Point = contour.GetPoint(v_id);
                        fileData += "VERTEX:\t" + Point.x + "\t" + Point.y + "\t" + Point.b + "\n";
                    }
                }
                using (StreamWriter sw = File.CreateText(filePath + item_id + ".item"))
                {
                    fileData = fileData.Replace(",", ".");
                    sw.WriteLine(fileData);
                    sw.Close();
                }

                using (StreamWriter sw = File.CreateText(filePath + "NFTest.task"))
                {
                    sw.WriteLine(taskfile);
                    sw.Close();
                }
            }
        }