Esempio n. 1
0
        public void AddShapeToList(int AltId, int ANumAlt, TBaseWorkShape WShape, int IdParentShape)
        {
            TNodeMain     Nd;
            TNodeMain     NPrior;
            TNodeAncestor NAc;
            int           ParentBlock;
            int           pos = 0;

            if (!CheckAlternateNode(AltId, ANumAlt))
            {
                return;
            }
            NPrior = FindLastNodeToAlternate(AltId, ANumAlt, IdParentShape);

            Nd               = new TNodeMain();
            Nd.IdBlock       = WShape.BlockId; //s
            Nd.IdParentShape = IdParentShape;
            Nd.WorkShape     = WShape;
            Nd.IdAlternate   = AltId;
            Nd.NumAlt        = ANumAlt;
            if (NPrior != null) //не первый узел
            {
                NPrior.Next = Nd;
                Nd.Prior    = NPrior;
            }

            MainList.Add(Nd);
            if ((FOnListChange != null) && (!f_Update))
            {
                OnListChange();
            }
            f_Changes = true;

            TNodeAlt NAlt = CheckFirstNodeAlt();

            if ((NAlt != null) && (AltId == 0))
            {
                NAlt.NodeStart = Nd;
            }

            if (IdParentShape != 0)
            {
                DoAddNodeAncestor(Nd.IdBlock, Nd.IdParentShape);
                while (true)
                {
                    if (Nd.IdParentShape == 0)
                    {
                        return;
                    }
                    ParentBlock = FindBlockOutShape(Nd.IdParentShape);


                    Nd = FindNode(ParentBlock, ref pos);
                    if (Nd.IdParentShape != 0)
                    {
                        DoAddNodeAncestor(Nd.IdBlock, Nd.IdParentShape);
                    }
                }
            }
        }
Esempio n. 2
0
 public TNodeAlt()
 {
     ID        = -1;
     Num       = -1;
     NodeStart = null;
     NodeEnd   = null;
 }
Esempio n. 3
0
 public TAltInfoItem()
 {
     f_Id            = 0;
     f_Num           = 0;
     f_ParentShapeId = 0;
     f_NodeStart     = null;
     f_NodeEnd       = null;
     f_Main          = false;
 }
Esempio n. 4
0
 /*      void FreeList();*/
 public TAlternateTreeList()
 {
     f_List      = new List <object>();
     f_Main      = false;
     f_NodeStart = null;
     f_NodeEnd   = null;
     f_ID        = -1;
     f_Num       = -1;
 }
Esempio n. 5
0
 public void AddNode(TNodeMain ANode, int APos)
 {
     if (!IsExistsNode(ANode))
     {
         TStackDustItemWS Item = new TStackDustItemWS(ANode);
         Item.NodePos = APos;
         f_ListWS.Add(Item);
     }
 }
Esempio n. 6
0
 public TNodeMain()
 {
     IdBlock       = 0;
     IdParentShape = 0;
     IdAlternate   = 0;
     NumAlt        = 0;
     TypeCreate    = 0;
     WorkShape     = null;
     Prior         = null;
     Next          = null;
 }
Esempio n. 7
0
        bool IsExistsNode(TNodeMain ANode)
        {
            TStackDustItemWS Item;

            for (int i = 0; i <= f_ListWS.Count - 1; i++)
            {
                Item = (TStackDustItemWS)f_ListWS.ElementAt(i);
                if (Item.Node == ANode)
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 8
0
        public TAltInfoItem AddAltIfo(int AId, int ANum, int AParentShapeId, TNodeMain ANodeStart, TNodeMain ANodeEnd)
        {
            if (FindItem(AId, ANum, AParentShapeId) != null)
            {
                return(null);
            }
            TAltInfoItem Item = new TAltInfoItem();

            Item.f_Id            = AId;
            Item.f_Num           = ANum;
            Item.f_ParentShapeId = AParentShapeId;
            Item.f_NodeStart     = ANodeStart;
            Item.f_NodeEnd       = ANodeEnd;
            f_List.Add(Item);
            return(Item);
        }
Esempio n. 9
0
        /*   public void PrepareDeleteWorkShape(TBaseWorkShape AWS);
         * public int DeleteWorkShape();
         * public void SaveAllToFile(AnsiString AFileName, int ATypeParam, TDischargedMassiv AOgrSovm);
         * public TNodeMain CreateNode(TBaseWorkShape WS);
         * public TNodeAncestor CreateNodeAncestor(int AId, int AIdAncestor);
         * public void PrepareAddNode(TNodeMain Nd);
         * public void ClearNodeTypeCreate();
         * public TNode CheckAlternateWSFirst(TBaseWorkShape AWS);
         * public TNode CheckAlternateWSEnd(TBaseWorkShape AWS);*/
        public void LoadInfoForAlternate(ref TAltInfo AltIfo, int AParentShapeID)
        {
            TNodeAlt     Itm;
            TNodeMain    Node, First = null, Last = null;
            TAltInfoItem AI;

            AltIfo.Clear();
            for (int i = 0; i <= AlternateCount - 1; i++)
            {
                Itm = GetAlternateItem(i);
                if (Itm.NodeStart.IdParentShape == AParentShapeID)
                {
                    AI = AltIfo.AddAltIfo(Itm.ID, Itm.Num, AParentShapeID, Itm.NodeStart, Itm.NodeEnd);
                    if (AI != null && (Itm.ID == 0) && (Itm.Num == 0) && (AParentShapeID == 0))
                    {
                        AI.Main = true;
                    }
                }
            }
            for (int i = 0; i <= MainList.Count - 1; i++)
            {
                Node = (TNodeMain)(MainList.ElementAt(i));
                if (Node != null && Node.IdParentShape == AParentShapeID)
                {
                    AI = AltIfo.AddAltIfo(Node.IdAlternate, Node.NumAlt, AParentShapeID, First, Last);
                    if (AI != null)
                    {
                        AI.Main = true;
                        First   = Node;
                        while (First.Prior != null)
                        {
                            First = First.Prior;
                        }

                        Last = Node;
                        while (Last.Next != null)
                        {
                            Last = Last.Next;
                        }

                        AI.NodeStart = First;
                        AI.NodeEnd   = Last;
                    }
                }
            }
        }
Esempio n. 10
0
        public TNodeMain SearchNextNodeToAlternate(int AltId, int ANumAlt, TNodeMain Node)
        {
            TNodeMain TempN;

            if (Node == null)
            {
                return(null);
            }
            for (int i = 0; i <= MainList.Count - 1; i++)
            {
                TempN = (TNodeMain)MainList.ElementAt(i);
                if ((TempN.IdAlternate == AltId) && (TempN.NumAlt == ANumAlt))
                {
                    if (TempN.Prior != null)
                    {
                        if (TempN.Prior == Node)
                        {
                            return(TempN);
                        }
                    }
                }
            }
            return(null);
        }
Esempio n. 11
0
 public TStackDustItemWS(TNodeMain ANode)
 {
     f_Node         = ANode;
     f_NodePos      = -1;
     f_CheckNesting = f_CheckAlternate = false;
 }