Exemple #1
0
 public void Add(Node node)
 {
     Children.Add (node);
 }
Exemple #2
0
 public void Remove(Node node)
 {
     Children.Remove (node);
 }
Exemple #3
0
        public void Render(Node<Entity> node, double x, double y, double w, double h, int level)
        {
            double lw = Math.Log(300000, Math.E) - level*2;
            double myWidth = pixel_unit * 300000;

            if (level % 2 == 1)
            {
                double xA = x + w / 2 - myWidth / 2;
                double xB = x + w / 2 + myWidth / 2;

                DrawLine(xA, y + h / 2, xB, y + h / 2, lw);

                foreach (var item in node.Children)
                {
                    double x0 = xA + (xB - xA) * (node.Children.IndexOf(item)) / node.Children.Count;
                    double x1 = xA + (xB - xA) * node.Children.IndexOf(item) / node.Children.Count;
                    Render(item, x0, y, x1 - x0, h, level+1);
                }
            }
            else
            {
                double yA = y + h / 2 - myWidth / 2;
                double yB = y + h / 2 + myWidth / 2;
                DrawLine(x + w / 2, yA, x + w / 2, yB, lw);

                foreach (var item in node.Children)
                {
                    double y0 = yA + (yB - yA) * (node.Children.IndexOf(item)) / node.Children.Count;
                    double y1 = yA + (yB - yA) * node.Children.IndexOf(item) / node.Children.Count;
                    Render(item, x, y0, w, y1 - y0, level +1);
                }
            }
        }