コード例 #1
0
        /// <summary>
        /// 获取连出的所有插槽容器的链表(辅助函数)
        /// </summary>
        /// <param name="slotContainer">当前插槽容器</param>
        /// <param name="list">当前搜索的所有插槽容器的链表</param>
        public void GetAllNextSlotContainers(SlotContainer slotContainer, List <SlotContainer> list)
        {
            if (!list.Contains(slotContainer)) // 避免出现死循环
            {
                list.Add(slotContainer);

                foreach (SlotGraphElement slot in slotContainer.GetOutSlotList())
                {
                    if (slot.Binded && slot.BindingConnector.Line.OutSlotContainer != null)
                    {
                        GetAllNextSlotContainers(slot.BindingConnector.Line.OutSlotContainer, list);
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取连出的插槽容器链表
        /// </summary>
        /// <param name="slotContainer">当前插槽容器</param>
        /// <returns>连出的插槽容器链表</returns>
        public List <SlotContainer> GetNextSlotContainers(SlotContainer slotContainer)
        {
            List <SlotContainer> list = new List <SlotContainer>();

            foreach (SlotGraphElement slot in slotContainer.GetOutSlotList())
            {
                if (slot.Binded && slot.BindingConnector.Line.OutSlotContainer != null &&
                    !list.Contains(slot.BindingConnector.Line.OutSlotContainer))
                {
                    list.Add(slot.BindingConnector.Line.OutSlotContainer);
                }
            }

            return(list);
        }
コード例 #3
0
        /// <summary>
        /// 获取连出的图元链表
        /// </summary>
        /// <param name="graphElement">当前图元</param>
        /// <param name="hasInnerChart">是否处理子绘图</param>
        /// <returns>连出的图元链表</returns>
        public List <GraphElement> GetNextGraphElements(GraphElement graphElement, bool dealInnerChart)
        {
            List <GraphElement> list = new List <GraphElement>();

            if (graphElement is SlotContainer) // 当前图元是插槽容器
            {
                SlotContainer slotContainer = graphElement as SlotContainer;

                foreach (SlotGraphElement slot in slotContainer.GetOutSlotList())
                {
                    if (slot.Binded)
                    {
                        list.Add(slot.BindingConnector.Line);
                    }
                }
            }
            else if (graphElement is ConnectorContainer) // 当前图元是连接线控制点容器
            {
                ConnectorContainer line = graphElement as ConnectorContainer;

                if (line.OutSlotContainer != null)
                {
                    if (dealInnerChart)
                    {
                        SlotContainer slotContainer = line.OutSlotContainer;

                        if (slotContainer is InnerChart)
                        {
                            SlotGraphElement slot             = slotContainer.GetBindedInSlot(line);
                            InnerChartEditor innerChartEditor = GetDataElement(slotContainer) as InnerChartEditor;

                            if (slot != null)
                            {
                                InterfaceGraphElement interfaceNode = innerChartEditor.GetInterfaceNode(slot.Tag.ToString());

                                if (interfaceNode != null)
                                {
                                    GraphElement connectedGraphElement = interfaceNode.GetConnectedOutGraphElement();

                                    if (connectedGraphElement != null)
                                    {
                                        list.Add(connectedGraphElement);
                                    }
                                }
                            }
                        }
                        else if (slotContainer is InterfaceGraphElement)
                        {
                            InnerChart innerChart = FindGraphElementByID(int.Parse(slotContainer.Tag as string)) as InnerChart;

                            foreach (SlotGraphElement slot in innerChart.GetOutSlotList())
                            {
                                if (slot.Binded)
                                {
                                    ConnectorContainer connectedLine = slot.BindingConnector.Line;
                                    string             lineData      = GetData(connectedLine) as string;

                                    if (!string.IsNullOrEmpty(lineData))
                                    {
                                        string[] dataArray = lineData.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);

                                        if (dataArray[0] == slotContainer.ID.ToString())
                                        {
                                            list.AddRange(GetNextGraphElements(slot.BindingConnector.Line, true));
                                            break;
                                        }
                                    }

                                    /*
                                     * if (!string.IsNullOrEmpty(connectedLine.Text))
                                     * {
                                     *  string[] dataArray = connectedLine.Text.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                                     *
                                     *  if (dataArray[0] == slotContainer.ID.ToString())
                                     *  {
                                     *      list.AddRange(GetNextGraphElements(slot.BindingConnector.Line, true));
                                     *      break;
                                     *  }
                                     * }
                                     */
                                }
                            }

                            /*
                             * foreach (SlotGraphElement slot in innerChart.GetOutSlotList())
                             * {
                             *  if (slot.Tag.ToString() == slotContainer.ID.ToString())
                             *  {
                             *      slotGraphElement = slot;
                             *      break;
                             *  }
                             * }
                             *
                             * if (slotGraphElement != null)
                             * {
                             *  if (slotGraphElement.Binded)
                             *  {
                             *      list.AddRange(GetNextGraphElements(slotGraphElement.BindingConnector.Line, true));
                             *  }
                             * }
                             */
                        }
                        else
                        {
                            list.Add(slotContainer);
                        }
                    }
                    else
                    {
                        list.Add(line.OutSlotContainer);
                    }
                }
            }

            return(list);
        }