Exemple #1
0
        public TBaseWorkShape FindFirstChild(int AltId, int ANumAlt, int AIdParentShape, ref int AUID)
        {
            int         nUid;
            TNodeMain   TempN;
            TNodeSearch Node;

            nUid = FindNextUid();
            AUID = nUid;
            Node = new TNodeSearch();
            List.Add(Node);
            Node.UID            = nUid;
            Node.indexFindChild = -1;
            TempN = MainList.SearchFirstNodeToAlternate(AltId, ANumAlt, AIdParentShape);
            while (TempN != null)
            {
                Node.List.Add(TempN.WorkShape);
                TempN = MainList.SearchNextNodeToAlternate(AltId, ANumAlt, TempN);
            }
            if (Node.List.Count > 0)
            {
                Node.indexFindChild = 0;
                return((TBaseWorkShape)(Node.List.ElementAt(Node.indexFindChild)));
            }
            return(null);
        }
Exemple #2
0
        public void FillTreeFromList(ref TListNode AListNode)
        {
            TTreeStackItem     Item;
            TAltInfoItem       AltInfoItem;
            TAlternateTreeList AT;
            TNodeMain          Node;
            TTreeListTFS       Tfs;
            TMainTreeList      AMT;
            TMainTreeList      MNew;
            TTreeListItem      LI;

            Init(0);
            Item = f_Stack.GetLevel();
            while (Item != null)
            {
                AMT = FindByLevel(f_TreeList, Item.Level);
                if (AMT != null)
                {
                    AListNode.LoadInfoForAlternate(ref f_AltInfo, Item.Level);
                    for (int i = 0; i <= f_AltInfo.ItemCount - 1; i++)
                    {
                        AltInfoItem        = f_AltInfo.GetItem(i);
                        AT                 = new TAlternateTreeList();
                        AT.MainAlternative = AltInfoItem.Main;
                        AT.NodeStart       = AltInfoItem.NodeStart;
                        AT.NodeEnd         = AltInfoItem.NodeEnd;
                        AT.ID              = AltInfoItem.ID;
                        AT.Num             = AltInfoItem.Num;
                        Node               = AListNode.SearchFirstNodeToAlternate(AltInfoItem.ID, AltInfoItem.Num, Item.Level);
                        while (Node != null)
                        {
                            Tfs = new TTreeListTFS(Node.WorkShape);
                            AT.AddToAlternate(Tfs);
                            for (int j = 0; j <= Tfs.ItemCount - 1; j++)
                            {
                                LI = Tfs.GetTreeTFEItem(j);
                                f_Stack.AddToStack(LI.BaseShape.ID);
                                if (AListNode.IsContainsChildShape(LI.BaseShape.ID))
                                {
                                    if (LI.MainNode == null)
                                    {
                                        MNew        = new TMainTreeList();
                                        MNew.Level  = LI.BaseShape.ID;
                                        LI.MainNode = MNew;
                                    }
                                }
                            }
                            Node = AListNode.SearchNextNodeToAlternate(AltInfoItem.ID, AltInfoItem.Num, Node);
                        }
                        AMT.AddToTree(AT);
                    }
                }
                Item.Fixed = true;
                Item       = f_Stack.GetLevel();
            }
        }