コード例 #1
0
        /// <summary>
        /// Draws the level graphics.
        /// </summary>
        /// <param name="startAngle">The start angle.</param>
        /// <param name="graphics">The graphics.</param>
        /// <param name="s">The Shared Node s.</param>
        /// <param name="PrevX">The previous x position.</param>
        /// <param name="PrevY">The previous y y position.</param>
        /// <param name="highlight">if set to <c>true</c> [highlight].</param>
        /// <param name="zoom">The zoom.</param>
        /// <returns></returns>
        public List <Node> DrawLevelGraphics(double startAngle, Graphics graphics, SharedNodes s, double PrevX, double PrevY, bool highlight, double zoom)
        {
            Node        node = new Node(this, highlight, PrevX, PrevY);
            List <Node> n    = new List <Node>();

            n.Add(node);
            node.Draw(graphics, zoom);
            n.AddRange(DrawChildrenGraphics(X_position, Y_position, startAngle, graphics, s, highlight, zoom));
            return(n);
        }
コード例 #2
0
 /// <summary>
 /// Gets the shared level this refers to.
 /// </summary>
 /// <param name="s">The SharedNodes s.</param>
 /// <returns></returns>
 public Level GetSharedLevel(SharedNodes s)
 {
     if (this.ConvergedKey != null)
     {
         return(s.Level.First(item => item.Key == this.ConvergedKey));
     }
     else if (this.CDAKey != null)
     {
         return(s.Level.First(item => item.Key == this.CDAKey));
     }
     else if (this.Name == null && this.Key != null)
     {
         return(s.Level.First(item => item.Key == this.Key));
     }
     return(null);
 }
コード例 #3
0
ファイル: Dimension.cs プロジェクト: emmazee/Sun-Model
        /// <summary>
        /// Gets the tree for this dimension.
        /// </summary>
        /// <param name="s">The shared nodes s.</param>
        /// <returns></returns>
        public TreeNode GetTree(SharedNodes s)
        {
            if (this.Level == null)
            {
                TreeNode t1 = new TreeNode(this.Name);
                t1.Tag = this;
                // t1.Name = this.UID;
                return(t1);
            }
            List <TreeNode> array = new List <TreeNode>();

            array.Add(this.Level.GetTree(s));
            TreeNode t2 = new TreeNode(this.Name, array.ToArray());

            t2.Tag = this;
            // t2.Name = this.UID;
            return(t2);
        }
コード例 #4
0
        /// <summary>
        /// Gets the tree for this level.
        /// </summary>
        /// <param name="s">The Shared Nodes s.</param>
        /// <param name="highlight">The highlight.</param>
        /// <returns></returns>
        public TreeNode GetTree(SharedNodes s, Color?highlight = null)
        {
            List <TreeNode> array = new List <TreeNode>();

            if (this.IsSharedLevel())
            {
                Level sharedLevel = new Level(GetSharedLevel(s));

                if (sharedLevel.Level1 != null)
                {
                    foreach (Level l in sharedLevel.Level1)
                    {
                        array.Add(l.GetTree(s, Color.Red));
                    }
                }
                TreeNode st = new TreeNode(sharedLevel.Name, array.ToArray());
                st.Name = this.UID;
                Level tagLevel = this;
                st.Tag       = tagLevel;
                st.ForeColor = highlight.GetValueOrDefault(Color.Red);
                //   return sharedLevel.GetTree(s, Color.Red);
                return(st);
            }
            else
            {
                if (this.Level1 != null)
                {
                    foreach (Level l in this.Level1)
                    {
                        array.Add(l.GetTree(s, highlight));
                    }
                }
                TreeNode t1 = new TreeNode(this.Name, array.ToArray());
                t1.Name      = this.UID;
                t1.Tag       = this;
                t1.ForeColor = highlight.GetValueOrDefault(Color.Black);
                return(t1);
            }
        }
コード例 #5
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);
        }
コード例 #6
0
ファイル: Dimension.cs プロジェクト: emmazee/Sun-Model
        /// <summary>
        /// Draws the dimension graphics.
        /// </summary>
        /// <param name="startAngle">The start angle.</param>
        /// <param name="graphics">The graphics.</param>
        /// <param name="s">The Shared Nodess.</param>
        /// <param name="zoom">The zoom.</param>
        /// <returns></returns>
        public List <Node> DrawDimensionGraphics(double startAngle, Graphics graphics, SharedNodes s, double zoom)
        {
            if (Level == null)
            {
                return(new List <Node>());;
            }
            if (Level.IsSharedLevel())
            {
                Level start = new Level(Level.GetSharedLevel(s));


                start.UID = Guid.NewGuid().ToString();

                start.X_position = Math.Sin(startAngle);
                start.Y_position = Math.Cos(startAngle);

                start.X_position *= 80.0 * zoom;
                start.Y_position *= 80.0 * zoom;
                start.X_position += X_position;
                start.Y_position += Y_position;

                return(start.DrawLevelGraphics(startAngle, graphics, s, X_position, Y_position, true, zoom));
            }
            else
            {
                Level.X_position = Math.Sin(startAngle);
                Level.Y_position = Math.Cos(startAngle);

                Level.X_position *= 80.0 * zoom;
                Level.Y_position *= 80.0 * zoom;
                Level.X_position += X_position;
                Level.Y_position += Y_position;

                return(Level.DrawLevelGraphics(startAngle, graphics, s, X_position, Y_position, false, zoom));
            }
        }