PurplePen.EventDB.FixControlPointGaps C# (CSharp) Method

FixControlPointGaps() private method

private FixControlPointGaps ( ) : void
return void
        void FixControlPointGaps()
        {
            List<Id<ControlPoint>> controlIds = new List<Id<ControlPoint>>(AllControlPointIds);

            foreach (Id<ControlPoint> controlId in controlIds) {
                ControlPoint control = GetControl(controlId);
                if (control.gaps != null && control.gaps.ContainsKey(0)) {
                    // Fix up these gaps by adding the gap value in each scale being used (map scale and each course scale)
                    // Note that we are modifying control objects directly, which is normally a BAD thing, because is bypasses the 
                    // undo manager. But in this case, it is what we want to do because this is a load-time operation which shouldn't be undoable.
                    CircleGap[] gaps = control.gaps[0];

                    control.gaps.Remove(0);
                    control.gaps[(int) Math.Round(GetEvent().mapScale)] = gaps;

                    foreach (Course course in AllCourses)
                        control.gaps[(int) Math.Round(course.printScale)] = gaps;
                }
            }
        }