public void TranslateToOrigin(HTNode node) { HTDrawNode drawNode = draw.FindDrawNode(node); draw.TranslateToOrigin(drawNode); return; }
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; }
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; }
override internal void FastMode(bool mode) { base.FastMode(mode); HTDrawNode child = null; for (IEnumerator i = Children(); i.MoveNext();) { child = (HTDrawNode)i.Current; child.FastMode(mode); } }
override internal void EndTranslation() { base.EndTranslation(); HTDrawNode child = null; for (IEnumerator i = Children(); i.MoveNext();) { child = (HTDrawNode)i.Current; child.EndTranslation(); } }
override public String ToString() { String result = base.ToString(); HTDrawNode child = null; result += "\n\tChildren :"; for (IEnumerator i = Children(); i.MoveNext();) { child = (HTDrawNode)i.Current; result += "\n\t-> " + child.GetName(); } return(result); }
override internal void DrawNodes(Graphic g) { if (fastMode == false) { base.DrawNodes(g); HTDrawNode child = null; for (IEnumerator i = Children(); i.MoveNext();) { child = (HTDrawNode)i.Current; child.DrawNodes(g); } } }
public void MouseClicked(object sender, MouseEventArgs e) { // TODO: is shift down -> model.restore() Debug.WriteLine("MouseClicked!!"); clickPoint.X = (int)e.GetPosition((UIElement)sender).X; clickPoint.Y = (int)e.GetPosition((UIElement)sender).Y; HTDrawNode node = model.FindNode(clickPoint); if (node != null) { model.TranslateToOrigin(node); } }
override internal void RefreshScreenCoordinates(HTCoordS sOrigin, HTCoordS sMax) { base.RefreshScreenCoordinates(sOrigin, sMax); HTDrawNode child = null; for (IEnumerator i = Children(); i.MoveNext();) { child = (HTDrawNode)i.Current; child.RefreshScreenCoordinates(sOrigin, sMax); HTGeodesic geod = (HTGeodesic)geodesics[child]; if (geod != null) { geod.RefreshScreenCoordinates(sOrigin, sMax); } } }
override internal void Restore() { base.Restore(); HTDrawNode child = null; for (IEnumerator i = Children(); i.MoveNext();) { child = (HTDrawNode)i.Current; child.Restore(); HTGeodesic geod = (HTGeodesic)geodesics[child]; if (geod != null) { geod.Rebuild(); } } }
override internal void DrawBranches(Graphic g) { HTDrawNode child = null; for (IEnumerator i = Children(); i.MoveNext();) { child = (HTDrawNode)i.Current; HTGeodesic geod = (HTGeodesic)geodesics[child]; if (geod != null) { geod.Draw(g, child.GetBranchColor()); } child.DrawBranches(g); } }
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; } } }
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; } } }
override internal HTDrawNode FindNode(HTCoordS zs) { HTDrawNode result = base.FindNode(zs); if (result != null) { return(result); } else { HTDrawNode child = null; for (IEnumerator i = Children(); i.MoveNext();) { child = (HTDrawNode)i.Current; result = child.FindNode(zs); if (result != null) { return(result); } } return(null); } }
override internal int GetSpace() { int space = base.GetSpace(); if (children.Count > 0) { HTDrawNode child = (HTDrawNode)children[0]; HTCoordS zC = child.GetScreenCoordinates(); int dC = zs.GetDistance(zC); if (space == -1) { return(dC); } else { return(Math.Min(space, dC)); } } else { return(space); } }
internal void TranslateToOrigin(HTDrawNode node) { view.StopMouseListening(); //AnimThread t = new AnimThread(node); //t.Start(); }
internal void MapNode(HTNode htNode, HTDrawNode drawNode) { drawToHTNodeMap.Add(htNode, drawNode); return; }
public HTNodeLabel(HTDrawNode node) { this.node = node; }
void AddChild(HTDrawNode child) { children.Add(child); geodesics.Add(child, new HTGeodesic(GetCoordinates(), child.GetCoordinates())); }
internal void SetBrother(HTDrawNode brother) { this.brother = brother; }
internal HTDrawNode FindDrawNode(HTNode htNode) { HTDrawNode drawNode = (HTDrawNode)drawToHTNodeMap[htNode]; return(drawNode); }