public void AddChildren(CadLayer layer) { Layer = layer; for (int i = 0; i < Layer.FigureList.Count; i++) { CadFigure fig = Layer.FigureList[i]; CadObjTreeItem item = new CadFigTreeItem(fig); Add(item); } }
public void AddChildren(CadLayer layer, Func <CadFigure, bool> filterFunc) { Layer = layer; for (int i = 0; i < Layer.FigureList.Count; i++) { CadFigure fig = Layer.FigureList[i]; if (!filterFunc(fig)) { continue; } CadObjTreeItem item = new CadFigTreeItem(fig); Add(item); } }
public static CadFigure GetCurrentFigure(CadObjTreeItem item, CadFigure currentFig) { CadFigure fig = null; //DOut.pl("TreeViewUtil.GetCurrentFigure " + item.GetType().ToString()); if (item is CadFigTreeItem) { CadFigTreeItem figItem = (CadFigTreeItem)item; if (figItem.IsChecked) { fig = figItem.Fig; } else { if (currentFig == figItem.Fig) { fig = null; } } } else if (item is CadPointTreeItem) { CadPointTreeItem ptItem = (CadPointTreeItem)item; if (ptItem.Parent != null) { if (ptItem.Parent.IsChecked) { fig = ptItem.Fig; } else { if (currentFig == ptItem.Fig) { fig = null; } } } } return(fig); }
public CadFigTreeItem(CadFigure fig) { Fig = fig; int idx = 0; for (int i = 0; i < Fig.PointList.Count; i++) { CadVertex p = Fig.PointList[i]; CadPointTreeItem pi = new CadPointTreeItem(fig, idx); Add(pi); idx++; } for (int i = 0; i < Fig.ChildList.Count; i++) { CadFigure c = Fig.ChildList[i]; CadFigTreeItem pi = new CadFigTreeItem(c); Add(pi); } }