Canguro.Commands.Model.SplitCmd.RelocateLoads C# (CSharp) Method

RelocateLoads() private static method

Relocates all the LineLoads in the oldLine to keep the position in both, the old and new lines.
private static RelocateLoads ( LineElement oldLine, LineElement newLine, float x, Canguro model ) : void
oldLine Canguro.Model.LineElement The line which used to be a whole
newLine Canguro.Model.LineElement The line which forms part of the old line
x float The dividing point
model Canguro The Model object
return void
        private static void RelocateLoads(LineElement oldLine, LineElement newLine, float x, Canguro.Model.Model model)
        {
            AssignedLineLoads loads = (AssignedLineLoads)oldLine.Loads;
            foreach (LoadCase lc in model.LoadCases.Values)
            {
                IList<Canguro.Model.Load.Load> list = loads[lc];
                if (list != null)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        bool relocated = false;
                        Canguro.Model.Load.Load ll = list[i];
                        if (ll is ConcentratedSpanLoad)
                            relocated = RelocateConcentratedLoads(newLine.Loads, lc, x, (ConcentratedSpanLoad)ll);
                        else if (ll is DistributedSpanLoad)
                            relocated = RelocateDistributedLoads(newLine.Loads, lc, x, (DistributedSpanLoad)ll);
                        if (relocated)
                            loads[lc].RemoveAt(i);
                    }
                }
            }
        }