public void DrawLink(Graphics g, Link l, Pen p) { if (l.percentage >= 1) g.DrawLine(Pens.Black, zoom * TranslateX(PointList.Locations[l.source].X), zoom *TranslateY(PointList.Locations[l.source].Y), zoom *TranslateX(PointList.Locations[l.target].X), zoom *TranslateY(PointList.Locations[l.target].Y)); else { // Dibuja parcial PointF a = TranslatePoint(PointList.Locations[l.source]); PointF b = TranslatePoint(PointList.Locations[l.target]); float offsetx = a.X - b.X; float offsety = a.Y - b.Y; float perc = Math.Max(0, Math.Min(1, l.percentage)); PointF a2 = new PointF((a.X - offsetx * perc * .5F), (a.Y - offsety * l.percentage * .5F)); PointF b2 = new PointF((b.X + offsetx * perc * .5F), (b.Y + offsety * l.percentage * .5F)); g.DrawLine(p, zoom * a.X, zoom * a.Y , zoom *a2.X, zoom * a2.Y); g.DrawLine(p, zoom * b.X, zoom * b.Y , zoom *b2.X, zoom * b2.Y); } }
public void Feed(Link []linkList) { foreach (Link link in linkList) { ulong key = link.key; Link refLink; refLink = (Link) allStableLinks[key]; if (refLink == null) { // se fija si está muriendo... refLink = (Link) allDyingLinks[key]; if (refLink != null) { // lo revive... allBornLinks.Add(key, refLink); allDyingLinks.Remove(key); } else { // no está ni estable ni muriendo ni naciendo... refLink = (Link) allBornLinks[key]; if (refLink == null) { // si no está naciendo, lo tiene que hacer nacer... refLink = link; allBornLinks.Add(key, link); } } } refLink.generation = gen; } }