public HTAction(HTDraw model) { this.model = model; startPoint = new HTCoordE(); endPoint = new HTCoordE(); clickPoint = new HTCoordS(); }
internal void Draw(Graphic g) { int fh = 30; int space = node.GetSpace(); // TODO:unfinished if (space >= fh) { active = true; HTCoordS zs = node.GetScreenCoordinates(); String name = node.GetName(); Color color = node.GetColor(); height = fh + 2 * node.GetSize(); width = space + 10 + 2 * node.GetSize(); x = zs.X - (width / 2) - node.GetSize(); y = zs.Y - (fh / 2) - node.GetSize(); g.DrawDot(zs.X, zs.Y, 3, color); g.DrawLabel(x, y, width, height, name, color); } else { active = false; } }
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 virtual int GetSpace() { int dF = -1; int dB = -1; if (father != null) { HTCoordS zF = father.GetScreenCoordinates(); dF = zs.GetDistance(zF); } if (brother != null) { HTCoordS zB = brother.GetScreenCoordinates(); dB = zs.GetDistance(zB); } if ((dF == -1) && (dB == -1)) { return(int.MaxValue); } else if (dF == -1) { return(dB); } else if (dB == -1) { return(dF); } else { return(Math.Min(dF, dB)); } }
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 virtual HTDrawNode FindNode(HTCoordS zs) { if (label.Contains(zs)) { return(this); } else { return(null); } }
internal bool Contains(HTCoordS zs) { int length = GetDistance(zs); if (length <= ZONE_LENGTH) { return true; } else { return false; } }
internal bool Contains(HTCoordS zs) { int length = GetDistance(zs); if (length <= ZONE_LENGTH) { return(true); } else { return(false); } }
internal HTGeodesic(HTCoordE za, HTCoordE zb) { this.za = za; this.zb = zb; zc = new HTCoordE(); zo = new HTCoordE(); a = new HTCoordS(); b = new HTCoordS(); c = new HTCoordS(); Rebuild(); }
public HTDrawNode(HTDrawNodeComposite father, HTModelNode node, HTDraw model) { this.father = father; this.node = node; this.model = model; label = new HTNodeLabel(this); ze = new HTCoordE(node.GetCoordinates()); oldZe = new HTCoordE(ze); zs = new HTCoordS(); model.MapNode(node.GetNode(), this); return; }
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); } } }
internal bool Contains(HTCoordS zs) { if (active) { if ((zs.X >= x) && (zs.X <= (x + width)) && (zs.Y >= y) && (zs.Y <= (y + height))) { return true; } else { return false; } } else { return node.GetScreenCoordinates().Contains(zs); } }
internal bool Contains(HTCoordS zs) { if (active) { if ((zs.X >= x) && (zs.X <= (x + width)) && (zs.Y >= y) && (zs.Y <= (y + height))) { return(true); } else { return(false); } } else { return(node.GetScreenCoordinates().Contains(zs)); } }
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 ProjectionEtoS(HTCoordE ze, HTCoordS sOrigin, HTCoordS sMax) { x = (int)Math.Round(ze.X * sMax.X) + sOrigin.X; y = -(int)Math.Round(ze.Y * sMax.Y) + sOrigin.Y; }
internal virtual HTDrawNode FindNode(HTCoordS zs) { if (label.Contains(zs)) { return this; } else { return null; } }
internal int GetDistance(HTCoordS z) { int d2 = (z.x - x) * (z.x - x) + (z.y - y) * (z.y - y); return (int)Math.Round(Math.Sqrt(d2)); }
internal int GetDistance(HTCoordS z) { int d2 = (z.x - x) * (z.x - x) + (z.y - y) * (z.y - y); return((int)Math.Round(Math.Sqrt(d2))); }
public HTCoordS(HTCoordS z) { this.X = z.X; this.Y = z.Y; }
internal virtual void RefreshScreenCoordinates(HTCoordS sOrigin, HTCoordS sMax) { zs.ProjectionEtoS(ze, sOrigin, sMax); }
internal HTDrawNode FindNode(HTCoordS zs) { return(drawRoot.FindNode(zs)); }
internal void RefreshScreenCoordinates(HTCoordS sOrigin, HTCoordS sMax) { a.ProjectionEtoS(za, sOrigin, sMax); b.ProjectionEtoS(zb, sOrigin, sMax); c.ProjectionEtoS(zc, sOrigin, sMax); }
internal override 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); } } }
internal override 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; } }
internal HTDrawNode FindNode(HTCoordS zs) { return drawRoot.FindNode(zs); }
internal void ProjectionStoE(int x, int y, HTCoordS sOrigin, HTCoordS sMax) { this.X = (double)(x - sOrigin.X) / (double)sMax.X; this.Y = -((double)(y - sOrigin.Y) / (double)sMax.Y); }