/// <summary> /// 移除组关系对象(不会移除节点以及节点的关联) /// </summary> /// <param name="relationShipZone"></param> public void RemoveRelationShipZone(RelationShipZone relationShipZone) { if (relationShipZone != null) { relationShipZoneList.Remove(relationShipZone); } }
/// <summary> /// 创建组关系 /// </summary> /// <param name="startZone">起始组</param> /// <param name="endZone">结束组</param> /// <param name="relationShipZone">返回的节点组</param> /// <returns></returns> public bool CreateRelationShipZone(List <int> startZone, List <int> endZone, out RelationShipZone relationShipZone) { relationShipZone = null; if (!(startZone == null || startZone.Count == 0 || endZone == null || endZone.Count == 0)) { startZone = startZone.Distinct().ToList(); endZone = endZone.Distinct().ToList(); int sumCount = startZone.Concat(endZone).Distinct().Count(); if (sumCount == startZone.Count + endZone.Count)//判断两者之间没有交集 { relationShipZone = GetRelationShipZone(startZone.ToArray(), endZone.ToArray()); if (relationShipZone == null) { relationShipZone = new RelationShipZone(); relationShipZone.StartIDList = startZone; relationShipZone.EndIDList = endZone; relationShipZone.JudgingStatus = Enums.EnumTaskProgress.Sucessed; relationShipZone.EditorColor = Color.green; relationShipZoneList.Add(relationShipZone); return(true); } } } return(false); }