Revit.SDK.Samples.CurtainWallGrid.CS.GridDrawing.IsPointIsolate C# (CSharp) Method

IsPointIsolate() private method

check whether the segments which have the same junction with the specified junction will be isolated if we delete the specified segment for example: 2 grid line has one junction, so there'll be 4 segments connecting to this junction let's delete 2 segments out of the 4 first, then if we want to delete the 3rd segment, the 4th segment will be a "isolated" one, so we will pick this kind of segment out
private IsPointIsolate ( System point ) : bool
point System /// the junction of several segments ///
return bool
        private bool IsPointIsolate(System.Drawing.Point point)
        {
            int uIndex = -1;
             List<int> uSegIndexes = new List<int>();
             // get which U grid line contains the point
             uIndex = GetOutlineIndex(m_uLinePathList, point);

             int vIndex = -1;
             List<int> vSegIndexes = new List<int>();
             // get which V grid line contains the point
             vIndex = GetOutlineIndex(m_vLinePathList, point);

             if (-1 == uIndex || -1 == vIndex)
             {
            return false;
             }

             if (-1 != uIndex)
             {
            // get the grid line containing the point and its segments
            List<SegmentLine2D> segList = m_uGridLines2D[uIndex].Segments;
            // get which segments of the grid line contains the point
            uSegIndexes = GetOutlineIndexes(segList, point);
             }

             if (-1 != vIndex)
             {
            // get the grid line containing the point and its segments
            List<SegmentLine2D> segList = m_vGridLines2D[vIndex].Segments;
            // get which segments of the grid line contains the point
            vSegIndexes = GetOutlineIndexes(segList, point);
             }

             // TODO: improve the comments
             // there's only 1 v segment contains the point and no u segment, so the segment is an isolated one
             if (0 == uSegIndexes.Count && 1 == vSegIndexes.Count)
             {
            SegmentLine2D seg = m_vGridLines2D[vIndex].Segments[vSegIndexes[0]];
            seg.Isolated = true;

            // recursive check
            IsPointIsolate(seg.StartPoint);
            IsPointIsolate(seg.EndPoint);
             }
             else if (1 == uSegIndexes.Count && 0 == vSegIndexes.Count)
             {
            SegmentLine2D seg = m_uGridLines2D[uIndex].Segments[uSegIndexes[0]];
            seg.Isolated = true;

            // recursive check
            IsPointIsolate(seg.StartPoint);
            IsPointIsolate(seg.EndPoint);
             }

             return false;
        }