示例#1
0
        public void AddOperation(AbstractElectrodeOperation eleOper, AbstractCreateOperation oper, Node node)
        {
            Node nextNode1 = node.FirstChildNode;

            if (nextNode1 == null)
            {
                eleOper.Oper.Insert(eleOper.Oper.Count, oper);
                AddOpeTotree(oper, node, null, png);
                return;
            }
            bool sibling = true;

            while (sibling)
            {
                Node nextNode2;
                nextNode2 = nextNode1.NextSiblingNode;
                if (nextNode2 == null)
                {
                    sibling = false;
                    break;
                }
                else
                {
                    nextNode1 = nextNode2;
                }
            }
            AbstractCreateOperation ao = FindOperationForOperNode(nextNode1, eleOper);
            int index = eleOper.Oper.IndexOf(ao);

            eleOper.Oper.Insert(index + 1, oper);
            AddOpeTotree(oper, node, nextNode1, png);
            node.Expand(Node.ExpandOption.Expand); //展开节点
        }
示例#2
0
        /// <summary>
        /// 添加刀路
        /// </summary>
        /// <param name="node">程序Node</param>
        /// <param name="eleOper"></param>
        /// <param name="oper"></param>
        public void AddOperation(AbstractElectrodeOperation eleOper, AbstractCreateOperation oper)
        {
            Node proNode   = FindNodeForProName(oper.NameModel.ProgramName);
            Node nextNode1 = proNode.FirstChildNode;

            if (nextNode1 == null)
            {
                eleOper.Oper.Insert(eleOper.Oper.Count, oper);
                AddOpeTotree(oper, proNode, null, png);
                return;
            }
            bool sibling = true;

            while (sibling)
            {
                Node nextNode2;
                nextNode2 = nextNode1.NextSiblingNode;
                if (nextNode2 == null)
                {
                    sibling = false;
                    break;
                }
                else
                {
                    nextNode1 = nextNode2;
                }
            }
            AbstractCreateOperation ao = FindOperationForOperNode(nextNode1, eleOper);
            int index = eleOper.Oper.IndexOf(ao);

            eleOper.Oper.Insert(index + 1, oper);
            AddOpeTotree(oper, proNode, nextNode1, png);
        }
示例#3
0
        public static AbstractElectrodeOperation CreateOperation(string template, ElectrodeModel ele, ElectrodeCAMInfo info)
        {
            AbstractElectrodeOperation ao = null;

            switch (template)
            {
            case "直电极":
                ao = new SimplenessVerticalEleOperation(ele, info);
                break;

            case "直+等宽":
                ao = new PlanarAndSufaceEleOperation(ele, info);
                break;

            case "直+等高":
                ao = new PlanarAndZleveEleOperation(ele, info);
                break;

            case "等宽+等高":
                ao = new SufaceAndZleveEleOperation(ele, info);
                break;

            case "等高电极":
                ao = new ZleveEleOperation(ele, info);
                break;

            case "User":
                ao = new UserDefinedEleOperation(ele, info);
                break;

            default:
                break;
            }
            return(ao);
        }
示例#4
0
        /// <summary>
        /// 拷贝程序
        /// </summary>
        /// <param name="eleOper"></param>
        /// <param name="node"></param>
        public void CopyOperation(AbstractElectrodeOperation eleOper, Node node)
        {
            AbstractCreateOperation ao   = FindOperationForOperNode(node, eleOper);
            AbstractCreateOperation copy = ao.CopyOperation();
            int index = eleOper.Oper.IndexOf(ao);

            eleOper.Oper.Insert(index + 1, copy);
            AddOpeTotree(copy, node.ParentNode, node, png);
        }
示例#5
0
        /// <summary>
        /// 移动刀路
        /// </summary>
        /// <param name="eleOper"></param>
        /// <param name="node"></param>
        /// <param name="afterNode"></param>
        public void MoveOperation(AbstractElectrodeOperation eleOper, Node node, Node afterNode)
        {
            AbstractCreateOperation ao1 = FindOperationForOperNode(node, eleOper);
            AbstractCreateOperation ao2 = FindOperationForOperNode(afterNode, eleOper);

            this.AddOpeTotree(ao1, afterNode.ParentNode, afterNode, png);
            eleOper.Oper.Remove(ao1);
            int index = eleOper.Oper.IndexOf(ao2);

            eleOper.Oper.Insert(index + 1, ao1);
            this.tree.DeleteNode(node);
        }
示例#6
0
        /// <summary>
        /// 删除程序组
        /// </summary>
        /// <param name="node"></param>
        /// <param name="eleOper"></param>
        public void DeleteProgramNode(Node node, AbstractElectrodeOperation eleOper)
        {
            string oldProName = node.GetColumnDisplayText(0);
            List <AbstractCreateOperation> opers = FindOperationForProNode(node, eleOper);

            foreach (AbstractCreateOperation ao in opers)
            {
                eleOper.Oper.Remove(ao);
            }
            this.tree.DeleteNode(node);
            UpdateTree(eleOper);
        }
示例#7
0
        /// <summary>
        /// 操作往下移动
        /// </summary>
        /// <param name="node"></param>
        /// <param name="eleOper"></param>
        public void MoveDownOperation(Node node, AbstractElectrodeOperation eleOper)
        {
            Node sibling = node.NextSiblingNode;

            if (sibling != null)
            {
                AbstractCreateOperation ao = FindOperationForOperNode(node, eleOper);
                AddOpeTotree(ao, node.ParentNode, sibling, png);
                int index = eleOper.Oper.IndexOf(ao);
                eleOper.Oper.Remove(ao);
                eleOper.Oper.Insert(index - 1, ao);
                this.tree.DeleteNode(node);
            }
        }
示例#8
0
        /// <summary>
        /// 操作往上移动
        /// </summary>
        /// <param name="node"></param>
        /// <param name="eleOper"></param>
        public void MoveUpOperation(Node node, AbstractElectrodeOperation eleOper)
        {
            Node previous = node.PreviousSiblingNode;

            if (previous != null)
            {
                AbstractCreateOperation ao = FindOperationForOperNode(previous, eleOper);
                AddOpeTotree(ao, node.ParentNode, node, png);
                int index = eleOper.Oper.IndexOf(ao);
                eleOper.Oper.Remove(ao);
                eleOper.Oper.Insert(index + 1, ao);
                this.tree.DeleteNode(previous);
            }
        }
示例#9
0
 /// <summary>
 /// 更新刀路
 /// </summary>
 /// <param name="eleOper"></param>
 /// <param name="ao"></param>
 public void UpdateOperation(AbstractElectrodeOperation eleOper, AbstractCreateOperation ao)
 {
     if (ao.NameModel.ProgramName.Equals(ao.Node.ParentNode.GetColumnDisplayText(0)))
     {
         ao.Node.SetColumnDisplayText(0, ao.NameModel.OperName);
         ao.Node.SetColumnDisplayText(1, ao.NameModel.ToolName);
     }
     else
     {
         eleOper.Oper.Remove(ao);
         this.tree.DeleteNode(ao.Node);
         this.AddOperation(eleOper, ao);
     }
 }
示例#10
0
        /// <summary>
        /// 更新树
        /// </summary>
        /// <param name="eleOper"></param>
        public void UpdateTree(AbstractElectrodeOperation eleOper)
        {
            List <Node> nodes = GetProgramNode();

            for (int i = 0; i < nodes.Count; i++)
            {
                string name = "O000" + (i + 1).ToString();
                nodes[i].SetColumnDisplayText(0, name);
            }
            for (int i = 0; i < nodes.Count; i++)
            {
                foreach (AbstractCreateOperation ao in FindOperationForProNode(nodes[i], eleOper))
                {
                    ao.SetProgramName(i + 1);
                }
            }
        }
示例#11
0
        /// <summary>
        /// 添加刀路
        /// </summary>
        /// <param name="eleOper"></param>
        public void AddOperTree(AbstractElectrodeOperation eleOper)
        {
            DeleteAllNode();
            List <string> progs = eleOper.Oper.GroupBy(p => p.NameModel.ProgramName).OrderBy(p => p.Key).Select(p => p.Key).ToList();

            foreach (string ao in progs)
            {
                Node pNode = this.tree.CreateNode(ao);
                this.tree.InsertNode(pNode, null, null, Tree.NodeInsertOption.Last);
                pNode.SetColumnDisplayText(0, ao);
                pNode.SetColumnDisplayText(2, eleOper.EleModel.EleInfo.EleName);
                List <AbstractCreateOperation> oprs = eleOper.Oper.FindAll(a => a.NameModel.ProgramName.Equals(ao));

                foreach (AbstractCreateOperation an in oprs)
                {
                    AddOpeTotree(an, pNode, null, png);
                }
                pNode.Expand(Node.ExpandOption.Expand); //展开节点
            }
        }
示例#12
0
        /// <summary>
        /// 添加程序组
        /// </summary>
        /// <param name="node"></param>
        /// <param name="eleOper"></param>
        /// <returns></returns>
        public Node AddProgramNode(Node node, AbstractElectrodeOperation eleOper)
        {
            List <Node> nodes = GetProgramNode();

            if (nodes.Count != 0)
            {
                for (int i = 0; i < nodes.Count; i++)
                {
                    if (node.Equals(nodes[i]))
                    {
                        string proName = "O000" + (i + 2).ToString();
                        Node   newNode = this.tree.CreateNode(proName);
                        this.tree.InsertNode(newNode, null, node, Tree.NodeInsertOption.Last);
                        newNode.SetColumnDisplayText(0, proName);
                        newNode.SetColumnDisplayText(2, eleOper.EleModel.EleInfo.EleName);
                        UpdateTree(eleOper);
                        return(newNode);
                    }
                }
            }
            return(null);
        }
示例#13
0
        /// <summary>
        /// 程序组往下移动
        /// </summary>
        /// <param name="node"></param>
        /// <param name="eleOper"></param>
        public void MoveDownProgram(Node node, AbstractElectrodeOperation eleOper)
        {
            Node sibling = node.NextSiblingNode;

            if (sibling != null)
            {
                List <AbstractCreateOperation> aos = FindOperationForProNode(node, eleOper);
                Node newNode = this.tree.CreateNode(node.GetColumnDisplayText(0));
                this.tree.InsertNode(newNode, null, sibling, Tree.NodeInsertOption.Last);
                newNode.SetColumnDisplayText(0, node.GetColumnDisplayText(0));
                newNode.SetColumnDisplayText(2, eleOper.EleModel.EleInfo.EleName);
                if (aos.Count != 0)
                {
                    foreach (AbstractCreateOperation an in aos)
                    {
                        AddOpeTotree(an, newNode, null, png);
                    }
                }
                newNode.Expand(Node.ExpandOption.Expand); //展开节点
                this.tree.DeleteNode(node);
                UpdateTree(eleOper);
            }
        }
示例#14
0
        /// <summary>
        /// 通过程序组Node 查找刀路
        /// </summary>
        /// <param name="node"></param>
        /// <param name="eleOper"></param>
        /// <returns></returns>
        private List <AbstractCreateOperation> FindOperationForProNode(Node node, AbstractElectrodeOperation eleOper)
        {
            List <AbstractCreateOperation> ao = new List <AbstractCreateOperation>();
            Node next = node.FirstChildNode;

            if (next != null)
            {
                ao.Add(FindOperationForOperNode(next, eleOper));
                bool sibling = true;
                while (sibling)
                {
                    next = next.NextSiblingNode;
                    if (next != null)
                    {
                        ao.Add(FindOperationForOperNode(next, eleOper));
                    }
                    else
                    {
                        sibling = false;
                    }
                }
            }
            return(ao);
        }
示例#15
0
 /// <summary>
 /// 通过刀路Node 查找刀路
 /// </summary>
 /// <param name="node"></param>
 /// <param name="eleOper"></param>
 /// <returns></returns>
 public AbstractCreateOperation FindOperationForOperNode(Node node, AbstractElectrodeOperation eleOper)
 {
     return(eleOper.Oper.Find(a => a.Node.Equals(node)));
 }
示例#16
0
 /// <summary>
 /// 删除刀路
 /// </summary>
 /// <param name="node"></param>
 /// <param name="eleOper"></param>
 /// <param name="oper"></param>
 public void DeleteOperation(Node node, AbstractElectrodeOperation eleOper)
 {
     eleOper.Oper.Remove(FindOperationForOperNode(node, eleOper));
     this.tree.DeleteNode(node);
 }