/// <summary> /// 检查是否更新事件结点 /// </summary> /// <param name="graphManager">图元管理器</param> /// <param name="graphElement">当前图元</param> /// <param name="eventNode">事件结点</param> /// <returns>是否需要更新</returns> private bool CheckCanBindEventNode(GraphManager graphManager, GraphElement graphElement, EventGraphElement eventNode) { bool avail = true; DataManager dataManager = graphManager.CurrentFlowChartManager.CurrentDataManager; IComparable com1; IComparable com2; if (graphElement is SlotContainer) // 插槽容器 { SlotContainer slotContainer = graphElement as SlotContainer; if (slotContainer.EventNode != null && slotContainer.EventNode != eventNode) { com1 = dataManager.GetData(slotContainer.EventNode) as IComparable; com2 = dataManager.GetData(eventNode) as IComparable; avail = (com1.CompareTo(com2) == 0); } } else if (graphElement is ConnectorContainer) // 连接线 { ConnectorContainer line = graphElement as ConnectorContainer; if (line.EventNode != null && line.EventNode != eventNode) { com1 = dataManager.GetData(line.EventNode) as IComparable; com2 = dataManager.GetData(eventNode) as IComparable; avail = (com1.CompareTo(com2) == 0); } } return avail; }
List<GraphElement> graphElementList; // 图元链表 /// <summary> /// 构造函数 /// </summary> /// <param name="graphManager">绘图管理器</param> /// <param name="graphElementList">图元链表</param> public SearchResultForm(GraphManager graphManager, List<GraphElement> graphElementList) { this.graphManager = graphManager; this.graphElementList = graphElementList; InitializeComponent(); Init(); }
private List<List<SlotContainer>> circleList; // 当前循环的圈 /// <summary> /// 构造函数 /// </summary> /// <param name="graphManager">绘图管理器</param> /// <param name="circleList">当前循环的圈</param> public CheckCircleForm(GraphManager graphManager, List<List<SlotContainer>> circleList) { this.graphManager = graphManager; this.circleList = circleList; InitializeComponent(); Init(); }
/// <summary> /// 构造函数 /// </summary> /// <param name="graphManager">绘图管理器对象</param> public EventManager(GraphManager graphManager) { this.graphManager = graphManager; }
/// <summary> /// 初始化数据 /// </summary> /// <param name="canvas">绘图板实例</param> /// <param name="propertyGrid">属性面板实例</param> public void Init(Canvas canvas) { graphManager = new GraphManager(this, canvas); dataManager = new DataManager(this); dataBaseManager = DataBaseManager.GetDataBaseManager(); int i = path.IndexOf('\\'); mapName = path.Substring(0, i); flowChartInteractor = new FlowChartInteractor(); }
/// <summary> /// 设置图元是否可用 /// </summary> /// <param name="graphManager">图元管理器</param> /// <param name="list">遍历过的图元链表</param> /// <param name="graphElement">当前图元</param> /// <param name="eventNode">事件结点</param> /// <param name="enable">图元是否可用</param> public void ReBindEventNode(GraphManager graphManager, List<GraphElement> list, GraphElement graphElement, EventGraphElement eventNode, bool enable) { if (!list.Contains(graphElement)) // 还没有遍历过当前图元 { DataManager dataManager = graphManager.CurrentFlowChartManager.CurrentDataManager; if (graphElement is SlotContainer) // 该图元是插槽容器 { SlotContainer slotContainer = graphElement as SlotContainer; if (!enable && slotContainer.EventNode != null && dataManager.IsConnect(slotContainer.EventNode, slotContainer)) // 不需要更新当前图元的事件结点 { } else { list.Add(slotContainer); slotContainer.Enable = enable; slotContainer.EventNode = eventNode; foreach (GraphElement g in dataManager.GetNextGraphElements(graphElement)) { ReBindEventNode(graphManager, list, g, eventNode, enable); } } } else if (graphElement is ConnectorContainer) // 该图元是连接线控制点容器 { ConnectorContainer line = graphElement as ConnectorContainer; if (!enable && line.EventNode != null && dataManager.IsConnect(line.EventNode, line)) // 不需要更新当前图元的事件结点 { } else { list.Add(line); line.Enable = enable; line.EventNode = eventNode; foreach (GraphElement g in dataManager.GetNextGraphElements(graphElement)) { ReBindEventNode(graphManager, list, g, eventNode, enable); } } } } }