예제 #1
0
    void createCube(float length, float width)
    {
        Vector3 posleft   = new Vector3(-length / 2f, 1 / 4f, width / 2f);
        Vector3 posright  = new Vector3(length / 2f, 1 / 4f, width / 2f);
        Vector3 posbleft  = new Vector3(-length / 2f, 1 / 4f, -width / 2f);
        Vector3 posbright = new Vector3(length / 2f, 1 / 4f, -width / 2f);

        controlNode topleft     = new controlNode(posleft, 1f);
        controlNode topright    = new controlNode(posright, 1f);
        controlNode bottomleft  = new controlNode(posbleft, 1f);
        controlNode bottomright = new controlNode(posbright, 1f);        //控制节点,对应着上顶,侧面和底面使用controlnode的bottom来构造Square,在断裂的时候将传入新的position来分块

        Square top     = new Square(topleft, topright, bottomright, bottomleft);
        Square bottom  = new Square(topright.bottom, topleft.bottom, bottomleft.bottom, bottomright.bottom);
        Square left    = new Square(topleft, bottomleft, bottomleft.bottom, topleft.bottom);
        Square right   = new Square(bottomright, topright, topright.bottom, bottomright.bottom);
        Square forward = new Square(topright, topleft, topleft.bottom, topright.bottom);
        Square back    = new Square(bottomleft, bottomright, bottomright.bottom, bottomleft.bottom);

        //每个面初始化的4个顶点,按照tl,tr,bl,br的顺序构造

        squares.Add(top);
        squares.Add(left);
        squares.Add(right);
        squares.Add(forward);
        squares.Add(back);
        squares.Add(bottom);         //将每个面加入队列,在Generate中遍历队列,逐个面计算顶点和三角形
    }
예제 #2
0
        private static string getUserControl(List <M_testCaseSteps> myControls, List <caseFramework> frames, List <project> pjs)
        {
            List <frameTreeNode> frameNodes = new List <frameTreeNode>();


            foreach (var f in frames)
            {
                frameTreeNode tmp = new frameTreeNode();
                tmp.FID  = f.ID;
                tmp.text = f.workName;

                frameNodes.Add(tmp);
            }


            //项目节点


            foreach (var r in frameNodes)
            {
                foreach (var p in pjs)
                {
                    projectTreeNode tmpP = new projectTreeNode();
                    tmpP.PID  = p.ID;
                    tmpP.text = p.Pname;



                    //control 分组
                    var tmpControls = from t in myControls
                                      where t.PID == p.ID && t.FID == r.FID
                                      select t;

                    if (tmpControls.Count() > 0)//没有control
                    {
                        r.children.Add(tmpP);
                    }

                    foreach (var c in tmpControls)
                    {
                        controlNode cn = new controlNode();
                        cn.id = c.ID;
                        //cn.text = c.name;

                        cn.name = "userstep_" + c.ID;
                        cn.desc = c.name;
                        cn.FID  = c.FID.Value;
                        cn.PID  = c.PID.Value;
                        tmpP.children.Add(cn);
                    }
                }

                //没有分组的control
                var noControls = from t in myControls
                                 where t.PID == null && t.FID == r.FID
                                 select t;

                foreach (var c in noControls)
                {
                    controlNode cn = new controlNode();
                    cn.id   = c.ID;
                    cn.name = "userstep_" + c.ID;
                    cn.desc = c.name;
                    cn.FID  = c.FID;
                    cn.PID  = c.PID;
                    r.children.Add(cn);
                }
            }


            var jSetting = new JsonSerializerSettings();

            jSetting.NullValueHandling = NullValueHandling.Ignore;

            string json = JsonConvert.SerializeObject(frameNodes, jSetting);

            return(json);
        }