public override void Clear() { List <_graphicpos> l = new List <_graphicpos>(_list); for (int i = 0; i < l.Count; i++) { _graphicpos gp = l[i]; gp.g.Father = null; } }
/// <summary> /// 将一个compositegraphic的内容merge到本对象中 /// </summary> public void MergeComposite(CompositeGraphic cg, double left = 0.0f, double top = 0.0f) { List <_graphicpos> lgp = cg.getGraphicPosList(); List <_graphicpos> l = new List <_graphicpos>(lgp); for (int i = 0; i < l.Count; i++) { _graphicpos gp = l[i]; this.Add(gp.g, left + gp.left, top + gp.top); } cg.Father = null; }
/// <summary> /// 全选 /// </summary> public CompositeGraphic SelectAll() { CompositeGraphic cg = new CompositeGraphic(); cg.Width = this.Width; cg.Height = this.Height; List <_graphicpos> l = new List <_graphicpos>(_list); for (int i = 0; i < l.Count; i++) { _graphicpos gp = l[i]; cg.Add(gp.g, gp.left, gp.top); } this.Add(cg); return(cg); }
/// <summary> /// 这个辅助函数用来删掉一个子graphic /// </summary> public void Remove(MyGraphic g) { _graphicpos mgp = null; foreach (_graphicpos gp in _list) { if (gp.g == g) { mgp = gp; break; } } if (mgp != null) { _list.Remove(mgp); } }
public override CompositeGraphic SelectRect(Rect r, double left = 0.0f, double top = 0.0f) { CompositeGraphic compositegraphic = new CompositeGraphic(); compositegraphic.isTemporary = true; RectangleGeometry rg = new RectangleGeometry(r); if (getBorder(left, top).FillContainsWithDetail(rg) != IntersectionDetail.Empty || isTemporary) { if (!isCombined) { List <_graphicpos> lg = new List <_graphicpos>(_list); for (int i = 0; i < lg.Count; i++) { _graphicpos gp = lg[i]; CompositeGraphic cg = gp.g.SelectRect(r, gp.left, gp.top); if (cg == null || cg.isEmpty()) { continue; } cg.isTemporary = true; compositegraphic.MergeComposite(cg, left, top); } } else { return(this); } } if (compositegraphic.isEmpty()) { return(null); } this.Add(compositegraphic); return(compositegraphic); }