Example #1
0
        /// <summary>
        /// Draws the children graphics.
        /// </summary>
        /// <param name="startX">The start x.</param>
        /// <param name="startY">The start y.</param>
        /// <param name="startAngle">The start angle.</param>
        /// <param name="graphics">The graphics.</param>
        /// <param name="s">The Shared Node s.</param>
        /// <param name="highlight">if set to <c>true</c> [highlight].</param>
        /// <param name="zoom">The zoom.</param>
        /// <returns></returns>
        public List <Node> DrawChildrenGraphics(double startX, double startY, double startAngle, Graphics graphics, SharedNodes s, bool highlight, double zoom)
        {
            List <Node> p = new List <Node>();

            if (Level1 == null)
            {
                return(p);
            }
            if (this.IsSharedLevel())
            {
                Level shared = GetSharedLevel(s);
                shared.UID = Guid.NewGuid().ToString();
                p.AddRange(shared.DrawChildrenGraphics(startX, startY, startAngle, graphics, s, true, zoom));
            }
            double incrementAngleAtt = 2 * Math.PI / (Level1.Count() + 3);

            startAngle += -Math.PI;
            startAngle += incrementAngleAtt;

            foreach (Level l in Level1)
            {
                startAngle += incrementAngleAtt;


                if (l.IsSharedLevel())
                {
                    Level shared = new Level(l.GetSharedLevel(s));

                    shared.X_position  = Math.Sin(startAngle);
                    shared.Y_position  = Math.Cos(startAngle);
                    shared.X_position *= 90.0 * zoom;
                    shared.Y_position *= 90.0 * zoom;
                    shared.X_position += startX;
                    shared.Y_position += startY;
                    shared.UID         = Guid.NewGuid().ToString();
                    p.AddRange(shared.DrawLevelGraphics(startAngle, graphics, s, startX, startY, true, zoom));
                }
                else
                {
                    l.X_position = Math.Sin(startAngle);
                    l.Y_position = Math.Cos(startAngle);

                    l.X_position *= 90.0 * zoom;
                    l.Y_position *= 90.0 * zoom;
                    l.X_position += startX;
                    l.Y_position += startY;
                    p.AddRange(l.DrawLevelGraphics(startAngle, graphics, s, startX, startY, highlight, zoom));
                }
            }
            return(p);
        }