public bool AddDashULine(System.Drawing.Point mousePosition)
{
bool mouseInGrid = VerifyMouseLocation(mousePosition);
// mouse is outside the curtain grid boundary
if (false == mouseInGrid)
{
m_mouseLocationValid = false;
return false;
}
// if the mouse laps over another grid line, it's invalid
bool isOverlapped = IsOverlapped(mousePosition, m_uLinePathList);
if (true == isOverlapped)
{
m_mouseLocationValid = false;
string msg = "It's not allowed to add grid line lapping over another grid line";
m_myDocument.Message = new KeyValuePair<string, bool>(msg, true);
return false;
}
// there's no "overlap", it's valid
else
{
string msg = "Specify a point within the curtain grid to locate the grid line";
m_myDocument.Message = new KeyValuePair<string, bool>(msg, false);
}
m_mouseLocationValid = true;
// get a parallel U line first
GridLine2D uLine2D;
// for "Curtain Wall: Curtain Wall 1", there's no initial U/V grid lines, so we use the boundary
// line instead (the same result)
if (null == m_uGridLines2D || 0 == m_uGridLines2D.Count)
{
uLine2D = m_boundLines2D[0];
}
else
{
uLine2D = m_uGridLines2D[0];
}
System.Drawing.Point startPoint = uLine2D.StartPoint;
System.Drawing.Point endPoint = uLine2D.EndPoint;
// move the start point and the end point parallelly
startPoint.Y = mousePosition.Y;
endPoint.Y = mousePosition.Y;
// get the dash u line
GridLine2D dashULine = new GridLine2D(startPoint, endPoint);
// initialize the pan
Pen redPen = new Pen(System.Drawing.Color.Red, m_sketchPenWidth);
Brush brush = Brushes.Red;
redPen.DashCap = DashCap.Flat;
redPen.DashStyle = DashStyle.Dash;
// add the dash line to the assistant line list for drawing
m_drawObject = new DrawObject(dashULine, redPen);
return true;
}