示例#1
0
        /// <summary>
        /// Layout systems
        /// </summary>
        /// <param name="systemList">systems, which will be layouted</param>
        /// <param name="nodeList">nodes</param>
        private void DoSystemLayout(List<EcellObject> systemList, List<EcellObject> nodeList)
        {
            if (systemList == null || nodeList == null)
                return;

            Dictionary<string, EcellObject> sysDict = new Dictionary<string, EcellObject>();
            foreach (EcellObject sys in systemList)
                sysDict.Add(sys.Key, sys);
            Dictionary<string, SystemContainer> containerDict = new Dictionary<string, SystemContainer>();
            SystemContainer rootContainer = null;
            foreach (EcellObject sys in systemList)
            {
                SystemContainer container = new SystemContainer();
                container.Self = sys;
                if (sys.Children.Count == 0)
                    continue;
                SystemContainer childDummyContainer = new SystemContainer();
                childDummyContainer.ChildNodeNum = sys.Children.Count;
                childDummyContainer.IsDummyContainer = true;
                container.AddChildContainer(childDummyContainer);

                if (sys.Key.Equals("/"))
                    rootContainer = container;
                containerDict.Add(sys.Key, container);
            }
            foreach (SystemContainer sysCon in containerDict.Values)
            {
                if (containerDict.ContainsKey(sysCon.Self.ParentSystemID))
                {
                    containerDict[sysCon.Self.ParentSystemID].AddChildContainer(sysCon);
                }
            }
            // Settle system coordinates
            rootContainer.ArrangeAllCoordinates(0, 0);
        }