Example #1
0
 /// <summary>
 /// Removes an intersection from this index
 /// </summary>
 /// <param name="x">The intersection to remove (on successful removal, the
 /// <see cref="Intersection.IsIndexed"/> property will be set false)
 /// </param>
 internal void RemoveIntersection(Intersection x)
 {
     if (m_ExtraData.Remove(x))
         x.IsIndexed = false;
 }
Example #2
0
 /// <summary>
 /// Includes an intersection in this index.
 /// </summary>
 /// <param name="x">The intersection to add to the index (and sets the 
 /// <see cref="Intersection.IsIndexed"/> property to true)
 /// </param>
 internal void AddIntersection(Intersection x)
 {
     m_ExtraData.Add(x);
     x.IsIndexed = true;
 }
        /// <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;
        }