Model Command to split a Line Element in many.
Inheritance: Commands.ModelCommand
Beispiel #1
0
        public static void Intersect(Canguro.Model.Model model, IList <Joint> joints, IList <LineElement> lines)
        {
            System.Windows.Forms.Cursor cursor = System.Windows.Forms.Cursor.Current;
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

            try
            {
                int nJoints = (joints == null) ? 0 : joints.Count;
                int nLines  = (lines == null) ? 0 : lines.Count;

                Joint joint;
                for (int i = 0; i < nLines; i++)
                {
                    System.Windows.Forms.Application.DoEvents();
                    for (int j = i + 1; j < nLines; j++)
                    {
                        if (lines[i] != null && lines[j] != null)
                        {
                            joint = Intersect(model, lines[i], lines[j]);
                            if (joint != null)
                            {
                                joints.Add(joint);
                            }
                        }
                    }
                }

                //for (int i = 0; i < nJoints; i++)
                //{
                //    Joint joint = joints[i];
                //    if (joint != null)
                foreach (LineElement line in lines)
                {
                    if (line != null)
                    {
                        SplitCmd.Split(line, joints, model);
                        System.Windows.Forms.Application.DoEvents();
                    }
                }
                //}
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = cursor;
            }
        }