private void GetConjointSegment(System.Drawing.Point point, bool isUSegment,
ref SegmentLine2D removeSegLine)
{
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)
{
// 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);
}
if ((0 == uSegIndexes.Count && 1 == vSegIndexes.Count))
{
// the source segment is an V segment, and the result segment is a V segment too.
// they're connected and in one line, so the result V segment should be removed,
// according to the UI rule
if (false == isUSegment)
{
removeSegLine = m_vGridLines2D[vIndex].Segments[vSegIndexes[0]];
return;
}
}
else if (1 == uSegIndexes.Count && 0 == vSegIndexes.Count)
{
// the source segment is an U segment, and the result segment is a U segment too.
// they're connected and in one line, so the result U segment should be removed,
// according to the UI rule
if (true == isUSegment)
{
removeSegLine = m_uGridLines2D[uIndex].Segments[uSegIndexes[0]];
return;
}
}
}