/// <summary> /// Merges divider sections that are incident on the specified intersection. This gets /// called when one of the lines causing an intersection is being removed (deactivated). /// </summary> /// <param name="x">An intersection that is being removed</param> /// <returns>The number of sections after the merge</returns> internal override int MergeSections(Intersection x) { for (int i = 0; i < (m_Sections.Count - 1); i++) { IDivider a = m_Sections[i]; if (a.To == x) { IDivider b = m_Sections[i + 1]; // If either divider is an overlap, it would be BAD to merge if (a is SectionDivider && b is SectionDivider) { m_Sections.RemoveAt(i + 1); m_Sections[i] = new SectionDivider(Line, a.From, b.To); } } } return(m_Sections.Count); }
/// <summary> /// Merges divider sections that are incident on the specified intersection. This gets /// called when one of the lines causing an intersection is being removed (deactivated). /// </summary> /// <param name="x">An intersection that is being removed</param> /// <returns>The number of sections after the merge</returns> internal override int MergeSections(Intersection x) { for (int i=0; i<(m_Sections.Count-1); i++) { IDivider a = m_Sections[i]; if (a.To == x) { IDivider b = m_Sections[i+1]; // If either divider is an overlap, it would be BAD to merge if (a is SectionDivider && b is SectionDivider) { m_Sections.RemoveAt(i+1); m_Sections[i] = new SectionDivider(Line, a.From, b.To); } } } return m_Sections.Count; }