Clone() public method

public Clone ( ) : object
return object
        /// <summary>
        /// Executes the command. 
        /// Creates, gets parameters and add a Distributed line load to the selected line elements.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            DistributedSpanLoad load = new DistributedSpanLoad();

            //services.GetProperties(Title, load, false);

            if (Canguro.Controller.Grid.LoadEditFrm.EditLoad(load) == System.Windows.Forms.DialogResult.OK)
            {

                List<Item> selection = services.GetSelection();

                foreach (Item item in selection)
                {
                    if (item is LineElement)
                        ((LineElement)item).Loads.Add((DistributedSpanLoad)load.Clone());
                }
            }
        }
        /// <summary>
        /// Executes the command. 
        /// Creates, gets parameters and add a Distributed line load to the selected line elements.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            if (Canguro.Controller.Grid.LoadEditFrm.EditLoad(this) == System.Windows.Forms.DialogResult.OK)
            {
                DistributedSpanLoad newLoad = new DistributedSpanLoad();
                newLoad.Da = 0;
                newLoad.Db = 1;
                newLoad.Direction = direction;
                newLoad.La = load;
                newLoad.Lb = load;
                newLoad.Type = type;

                List<Item> selection = services.GetSelection();

                foreach (Item item in selection)
                {
                    if (item is LineElement)
                        ((LineElement)item).Loads.Add((DistributedSpanLoad)newLoad.Clone());
                }
            }
        }
示例#3
0
        /// <summary>
        /// Distributes a DistributedSpanLoad between the line element where it is and a new adjacent line element.
        /// </summary>
        /// <param name="newLineLoads">The AssignedLoads object of the new Line Element</param>
        /// <param name="lc">The Load Case to which the load belongs.</param>
        /// <param name="x">The dividing point of the two line elements [0, 1]</param>
        /// <param name="load">The Load to distribute in two elements</param>
        /// <returns>true if the load was moved to the new Line Element (so the caller removes it). false otherwise.</returns>
        private static bool RelocateDistributedLoads(AssignedLoads newLineLoads, LoadCase lc, float x, DistributedSpanLoad load)
        {
            if (load.Da < x && load.Db < x)
            {
                load.Da = load.Da / x;
                load.Db = load.Db / x;
                return false;
            }
            if (load.Da >= x && load.Db >= x)
            {
                load = (DistributedSpanLoad)load.Clone();
                load.Id = 0;
                load.Da = (load.Da - x) / (1 - x);
                load.Db = (load.Db - x) / (1 - x);
                newLineLoads.Add(load, lc);
                return true;
            }
            if (load.Da > load.Db)
            {
                float tmp = load.Db;
                load.Db = load.Da;
                load.Da = tmp;
                tmp = load.Lb;
                load.Lb = load.La;
                load.La = tmp;
            }
            DistributedSpanLoad nLoad = (DistributedSpanLoad)load.Clone();
            nLoad.Id = 0;
            load.Da = load.Da / x;
            load.Db = 1f;
            load.Lb = (load.La) + (x - load.Da) * (load.Lb - load.La) / (load.Db - load.Da);

            nLoad.Da = 0;
            nLoad.Db = (nLoad.Db - x) / (1 - x);
            nLoad.La = load.Lb;
            newLineLoads.Add(nLoad, lc);
            return false;
        }