Ejemplo 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);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public void AddAlternate(TNodeAlt ANodeAlt)
 {
     if (!IsExistsAlternate(ANodeAlt))
     {
         f_ListAlt.Add(ANodeAlt);
     }
 }
Ejemplo n.º 3
0
 bool IsExistsAlternate(TNodeAlt ANodeAlt)
 {
     for (int i = 0; i <= f_ListAlt.Count - 1; i++)
     {
         if ((TNodeAlt)f_ListAlt.ElementAt(i) == ANodeAlt)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
        public TNodeAlt LastAlt()
        {
            TNodeAlt Res = null;

            if (f_ListAlt.Count > 0)
            {
                f_posAlt = f_ListAlt.Count - 1;
                Res      = (TNodeAlt)f_ListAlt.ElementAt(f_posAlt);
            }
            return(Res);
        }
Ejemplo n.º 5
0
        public TNodeAlt PriorAlt()
        {
            TNodeAlt Res = null;

            f_posAlt--;
            if ((f_ListAlt.Count > f_posAlt) && (f_posAlt >= 0))
            {
                Res = (TNodeAlt)f_ListAlt.ElementAt(f_posAlt);
            }
            return(Res);
        }
Ejemplo n.º 6
0
        public TNodeAlt FirstAlt()
        {
            TNodeAlt Res = null;

            f_posAlt = 0;
            if (f_ListAlt.Count > 0)
            {
                Res = (TNodeAlt)f_ListAlt.ElementAt(f_posAlt);
            }
            return(Res);
        }
Ejemplo n.º 7
0
        /*     public int DecayWorkShape(TBaseWorkShape WDecay, TBaseWorkShape WN1, TBaseWorkShape WN2);
         *   public void FusionWorkShape(TBaseWorkShape WFusion, TBaseWorkShape WN1, TBaseWorkShape WN2);
         *   public TBaseWorkShape FindWorkShapeOutBaseShape(TBaseShape Shape, int &ShapeId);
         *   public TBaseWorkShape FindWorkShapeOutBaseShapeID(int ShapeID, TBaseShape Shape);*/
        public bool CreateAlternate(TBaseWorkShape WS, TBaseWorkShape WE, int AID, int ANumAlt)
        {
            TNodeAlt  Alt;
            TNodeMain NS, NE;

            if (WS == null && WE == null)
            {
                Alt           = new TNodeAlt();
                Alt.ID        = AID;
                Alt.NodeStart = null;
                Alt.NodeEnd   = null;
                Alt.Num       = ANumAlt;
                AlternateList.Add(Alt);
                return(true);
            }
            NS = FindNode(WS);
            NE = FindNode(WE);
            if ((NS == null) || (NE == null))
            {
                return(false);
            }
            for (int i = 0; i <= AlternateList.Count - 1; i++)
            {
                Alt = (TNodeAlt)AlternateList.ElementAt(i);
                if (Alt.ID == AID)
                {
                    return(false);
                }
            }
            Alt           = new TNodeAlt();
            Alt.ID        = AID;
            Alt.NodeStart = NS;
            Alt.NodeEnd   = NE;
            Alt.Num       = ANumAlt;
            AlternateList.Add(Alt);
            return(true);
        }