コード例 #1
0
ファイル: InnerChartEditor.cs プロジェクト: weimingtom/pap2
        /// <summary>
        /// 刷新插槽信息
        /// </summary>
        /// <param name="innerChart">子绘图结点</param>
        /// <param name="inIDList">入口插槽ID链表</param>
        /// <param name="outIDList">出口插槽ID链表</param>
        /// <param name="inSlotInfo">入口插槽信息</param>
        /// <param name="outSlotInfo">出口插槽信息</param>
        private void RefreshSlotInfo(InnerChart innerChart, List <int> inIDList, List <int> outIDList, Hashtable inSlotInfo, Hashtable outSlotInfo)
        {
            StringBuilder descriptionInfo = new StringBuilder();

            descriptionInfo.AppendLine("<bold>入口插槽");

            // 刷新插槽信息
            inIDList.Sort();
            List <SlotGraphElement> slotList = innerChart.GetInSlotList();

            for (int i = 0; i < inIDList.Count; i++)
            {
                string nodeID   = inIDList[i].ToString();
                string nodeName = inSlotInfo[nodeID] as string;
                slotList[i].Tag         = nodeID;
                slotList[i].TooltipText = nodeName;

                descriptionInfo.AppendLine(string.Format("{0}:{1}", i, nodeName));
            }

            outIDList.Sort();
            slotList = innerChart.GetOutSlotList();

            descriptionInfo.AppendLine("<split>");
            descriptionInfo.AppendLine("<bold>出口插槽");

            for (int i = 0; i < outIDList.Count; i++)
            {
                string nodeID   = outIDList[i].ToString();
                string nodeName = outSlotInfo[nodeID] as string;
                slotList[i].Tag = nodeID;

                descriptionInfo.AppendLine(string.Format("{0}:{1}", i, nodeName));
            }

            // 刷新提示信息
            tooltipText = descriptionInfo.ToString();
        }
コード例 #2
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);
        }