public HTDraw(HTModel model, HTView view) { drawToHTNodeMap = new Dictionary <HTNode, HTDrawNode>(); this.view = view; this.model = model; HTModelNode root = model.GetRoot(); sOrigin = new HTCoordS(); sMax = new HTCoordS(); ray = new double[4]; ray[0] = model.GetLength(); for (int i = 1; i < ray.Length; i++) { ray[i] = (ray[0] + ray[i - 1]) / (1 + (ray[0] * ray[i - 1])); } if (root.IsLeaf()) { drawRoot = new HTDrawNode(null, root, this); } else { drawRoot = new HTDrawNodeComposite(null, (HTModelNodeComposite)root, this); } return; }
internal HTDrawNodeComposite(HTDrawNodeComposite father, HTModelNodeComposite node, HTDraw model) : base(father, node, model) { this.node = node; this.children = new ObservableCollection <HTDrawNode>(); this.geodesics = new Dictionary <HTDrawNode, HTGeodesic>(); HTModelNode childNode = null; HTDrawNode child = null; HTDrawNode brother = null; bool first = true; bool second = false; for (IEnumerator i = node.Children(); i.MoveNext();) { childNode = (HTModelNode)i.Current; if (childNode.IsLeaf()) { child = new HTDrawNode(this, childNode, model); } else { child = new HTDrawNodeComposite(this, (HTModelNodeComposite)childNode, model); } AddChild(child); if (first) { brother = child; first = false; second = true; } else if (second) { child.SetBrother(brother); brother.SetBrother(child); brother = child; second = false; } else { child.SetBrother(brother); brother = child; } } }