public void DrawGroup(GroupBean groupbean) { if (groupbean == null) return; List<PointDrawer> lp_temp = convertToTrueListPoints(groupbean.lchildern); Draw(DrawItem.POINT, PointType.GROUP, lp_temp.ToArray()); List<RouteDrawer> lr_temp = null; lr_temp = new List<RouteDrawer>(); foreach(NetworkBean networkbean in MyXml.networks) { List<LinkBean> l = networkbean.llb.FindAll(delegate(LinkBean lb) { return groupbean.lchildern.Contains(lb.source) && groupbean.lchildern.Contains(lb.target); }); if(l != null && l.Count > 0) lr_temp.AddRange(DrawConverter(l)); } List<RouteDrawer> lld = convertToTrueListRoutes(lr_temp, lp_temp); if (lld != null) Draw(DrawItem.ROUTE, RouteType.GROUP, lld.ToArray()); graph.Flush(); }
public static NodeBean findNodeBeanById(string id, GroupBean gb) { if (gb == null) return null; return gb.lchildern.Find(delegate(NodeBean nodebean){ return nodebean.id.Equals(id); }); }
public static NodeBean findNodeBeanById(string id, GroupBean gb) { if (gb == null) { return(null); } return(gb.lchildern.Find(delegate(NodeBean nodebean){ return nodebean.id.Equals(id); })); }
public void getGroups(ref List<GroupBean> groups) { if (groups == null) groups = new List<GroupBean>(); XmlNodeList xmlNodeList = getNodeClasses(); foreach (XmlNode node in xmlNodeList) { GroupBean gb = new GroupBean(); gb.id = getNodeAttrValue(node, AttrType.Id); gb.group_type = getNodeAttrValue(node, AttrType.Type); getNodes(gb, node); groups.Add(gb); } }
public void getGroups(ref List <GroupBean> groups) { if (groups == null) { groups = new List <GroupBean>(); } XmlNodeList xmlNodeList = getNodeClasses(); foreach (XmlNode node in xmlNodeList) { GroupBean gb = new GroupBean(); gb.id = getNodeAttrValue(node, AttrType.Id); gb.group_type = getNodeAttrValue(node, AttrType.Type); getNodes(gb, node); groups.Add(gb); } }
private void getNodes(GroupBean gb, XmlNode nodeclass) { XmlNodeList xmlNodeList = getChildern(nodeclass); foreach (XmlNode node in xmlNodeList) { NodeBean nodebean = new NodeBean(); nodebean.id = getNodeAttrValue(node, AttrType.Id); nodebean.group = gb; XmlAttributeCollection collection = getNodeAttrs(node); foreach (XmlAttribute atrr in collection) { nodebean.AddAttribute(atrr.Name, atrr.Value); } gb.lchildern.Add(nodebean); } }
public static bool Equals(GroupBean bean1, GroupBean bean2) { return (bean1 == null || bean2 == null) ? ((bean1 == null) ? (bean2 == null) : false) : (bean1.id.Equals(bean2.id)); }
private void getNodes(GroupBean gb, XmlNode nodeclass) { XmlNodeList xmlNodeList = getChildern(nodeclass); foreach(XmlNode node in xmlNodeList) { NodeBean nodebean = new NodeBean(); nodebean.id = getNodeAttrValue(node, AttrType.Id); nodebean.group = gb; XmlAttributeCollection collection = getNodeAttrs(node); foreach(XmlAttribute atrr in collection) { nodebean.AddAttribute(atrr.Name, atrr.Value); } gb.lchildern.Add(nodebean); } }
public static bool Equals(GroupBean bean1, GroupBean bean2) { return((bean1 == null || bean2 == null) ? ((bean1 == null) ? (bean2 == null) : false) : (bean1.id.Equals(bean2.id))); }
private List<GroupBean> removeGroup(List<GroupBean> lst, GroupBean group) { // 这边将消耗很多内存!! List<GroupBean> lgb = new List<GroupBean>(); foreach(GroupBean grp in lst) { if (!GroupBean.Equals(group, grp)) { GroupBean g = new GroupBean(); g.id = grp.id; g.lchildern = grp.lchildern; lgb.Add(g); } } return lgb; }
private List<GroupBean> newC(GroupBean Ci, GroupBean Cj) { // Not append it to the result set but replace the original one at the // the position where it was! int index = findLocation(C(), Ci); List<GroupBean> newSolution = removeGroup(C(), Ci); newSolution.Insert(index, mergeGroup(Ci, Cj)); newSolution = removeGroup(newSolution, Cj); return newSolution; }
public NetworkBean(GroupBean g1, GroupBean g2) { this.group1 = g1; this.group2 = g2; llb = new List<LinkBean>(); }
private void initializeGroups() { int count = 0; List<GroupBean> lgb = new List<GroupBean>(); foreach(NodeBean bean in MyXml.getAllNodes()) { GroupBean gb = new GroupBean(); gb.id = count.ToString(); gb.group_type = bean.group.group_type; gb.lchildern.Add(bean); lgb.Add(gb); count++; } lstC.Add(lgb); }
private int findLocation(List<GroupBean> lst, GroupBean group) { int count = 0; foreach (GroupBean grp in lst) { if (GroupBean.Equals(group, grp)) { break; } count++; } return count; }
public NetworkBean(GroupBean g1, GroupBean g2) { this.group1 = g1; this.group2 = g2; llb = new List <LinkBean>(); }
public NodeBean(string id, GroupBean group) { this.id = id; this.group = group; this.attributes = new Hashtable(); }
private GroupBean mergeGroup(GroupBean a, GroupBean b) { GroupBean newGroup = new GroupBean(); newGroup.id = a.id + "+" + b.id; newGroup.lchildern.AddRange(a.lchildern); foreach(NodeBean nb in b.lchildern) { if(!a.lchildern.Contains(nb)) newGroup.lchildern.Add(nb); //NodeBean bean = a.lchildern.Find(delegate(NodeBean nodebean) //{ // return nodebean.id.Equals(nb.id); //}); //if(bean == null) // newGroup.lchildern.Add(nb); } return newGroup; }