Beispiel #1
0
 public PaperTreeNode(int level, int l, int w, PaperTreeNode root, int k)
 {
     Len   = l;
     Width = w;
     Level = level - 1;
     Kaidu = k;
     Root  = root;
     if ((Level <= 0 || Len < 50 || Width < 50))
     {
         Len     = 0;
         Width   = 0;
         CutMode = CutModeMenu.无;
         return;
     }
     if (FitRect())
     {
         Cut           = 1;
         CutMode       = CutModeMenu.无;;
         L2Cut         = new PaperTreeNode(Level, (Len - Cut) / 2, Width, this, Kaidu * 2);
         L2Cut.CutMode = CutModeMenu.左右对开;
         L3Cut         = new PaperTreeNode(Level, (Len - Cut * 2) / 3, Width, this, Kaidu * 3);
         L3Cut.CutMode = CutModeMenu.左右三开;
         W2Cut         = new PaperTreeNode(Level, Len, (Width - Cut) / 2, this, Kaidu * 2);
         W2Cut.CutMode = CutModeMenu.对开;
         W3Cut         = new PaperTreeNode(Level, Len, (Width - 2 * Cut) / 3, this, Kaidu * 3);
         W3Cut.CutMode = CutModeMenu.开;
     }
     else
     {
         return;
     }
 }
Beispiel #2
0
        public Tree()
        {
            BigRoot   = new PaperTreeNode(Common.BigPaper);
            SmallRoot = new PaperTreeNode(Common.SmallPaper);


            AllBig   = new List <PaperTreeNode>();
            AllSmall = new List <PaperTreeNode>();
            AllPs    = new List <PaperTreeNode>();

            GetAllChild(BigRoot, AllBig);
            GetAllChild(SmallRoot, AllSmall);
        }
Beispiel #3
0
 private void GetAllChild(PaperTreeNode root, List <PaperTreeNode> list)
 {
     if (root != null)
     {
         if (root.Len != 0)
         {
             list.Add(root);
             GetAllChild(root.L2Cut, list);
             GetAllChild(root.W2Cut, list);
             GetAllChild(root.L3Cut, list);
             GetAllChild(root.W3Cut, list);
         }
     }
 }
Beispiel #4
0
        public Rectange GetPaperRect()
        {
            PaperTreeNode pt  = this;
            PaperTreeNode pt1 = this;

            while (pt != null)
            {
                pt1 = pt;
                pt  = pt.Root;
            }
            Rectange result = new Rectange(pt1.Len, pt1.Width);

            result.Name = EnumHelper.GetEnumName <CutModeMenu>((int)CutMode) + pt1.Kaidu.ToString() + "开";
            result.Id   = 0;
            return(result);
        }
Beispiel #5
0
        public Rectange GetPsRect()
        {
            PaperTreeNode pt  = this;
            PaperTreeNode pt1 = this;

            while (pt.Root != null)
            {
                pt1 = pt;
                pt  = pt.Root;
            }
            Rectange result = new Rectange(pt1.Len, pt1.Width);

            result.Name = "上机尺寸:" + pt1.Kaidu.ToString() + "开";
            result.Id   = 0;
            return(result);
        }
Beispiel #6
0
        public List <PaperTreeNode> GetCutList(int l, int h)
        {
            Rectange      rect  = new Rectange(l, h);
            PaperTreeNode big   = GetFitSize(l, h, AllBig);
            PaperTreeNode small = GetFitSize(l, h, AllSmall);

            List <Model.PaperTreeNode> list = big.GetCutRouter();
            decimal r = GetPaperRation(l, h, list);

            List <Model.PaperTreeNode> list2 = small.GetCutRouter();
            decimal r1 = GetPaperRation(l, h, list2);

            if (r > r1)
            {
                return(list);
            }
            else
            {
                return(list2);
            }
        }
Beispiel #7
0
        public List <PaperTreeNode> GetCutRouter()
        {
            List <PaperTreeNode> list = new List <PaperTreeNode>();
            PaperTreeNode        pt   = this;
            PaperTreeNode        pt1  = this;

            while (pt != null)
            {
                pt1 = pt;
                list.Add(pt1);
                pt = pt.Root;
            }
            if (list.Count > 0)
            {
                return(list);
            }
            else
            {
                return(null);
            }
        }