LunarPresentation/Expressions/Tree.cs

(开头部分) 55KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Xml;

namespace SHomeWorkshop.LunarPresentation.Expressions
{
    public class Tree : CanvasExpression
    {
        public Tree(SubPanel rootPanel, SubPanel parentPanel, Editor editor)
            : base(rootPanel, parentPanel, editor)
        {
            this.chineseName = "树";
        }

        protected override void RefreshSubPanelRelatios()
        {
            //根据SuperLeafExID的值来刷新每个公式的“SubLeafs”列表。
            if (this.rootLeaf != null) this.rootLeaf.NextLevelLeaves.Clear();//这句应该是多余的!!

            for (int i = 0; i < this.Children.Count; i++)
            {
                if (this.Children[i] is LeafPanel == false) continue;
                LeafPanel leaf = this.Children[i] as LeafPanel;
                leaf.NextLevelLeaves.Clear();

                for (int j = 0; j < this.Children.Count; j++)
                {
                    if (j == i) continue;//一个叶不可能是自身的下级叶。

                    if (this.Children[j] is LeafPanel == false) continue;

                    LeafPanel elseLeaf = this.Children[j] as LeafPanel;
                    if (elseLeaf.PreLevelLeafExID == leaf.ExID)
                    {
                        leaf.NextLevelLeaves.Add(elseLeaf);
                    }
                }
            }

            for (int i = 0; i < this.Children.Count; i++)
            {
                if (this.Children[i] is LeafPanel == false) continue;
                LeafPanel leaf = this.Children[i] as LeafPanel;
                SortNextLevelleaves(leaf);
            }
        }

        public static readonly double defWidthOfLinesArea = 30;

        /// <summary>
        /// TODO 要根据“Index”来对每一个叶的子叶进行排序。
        /// ——这将决定每个子叶的纵坐标。
        /// </summary>
        /// <param name="leaf"></param>
        private void SortNextLevelleaves(LeafPanel leaf)
后面还有 1447 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。