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;
}