/// <summary> /// 사각형의 4 포인트를 생성하고 저장한다. /// </summary> public bool setRectanglePoints(double x1, double y1, double x2, double y2) { double bigX, smallX; double bigY, smallY; m_listRelativePoint.Clear(); m_emFaceType = EMFaceType.RECTANGLE; if (x1 > x2) { bigX = x1; smallX = x2; } else { bigX = x2; smallX = x1; } if (y1 > y2) { bigY = y1; smallY = y2; } else { bigY = y2; smallY = y1; } /// Base Point 가 좌하점이기 때문에 /// 박스를 그리는 순서는 좌하점 부터 반시계 방향으로 그린다. // 1 점 (좌하) m_listRelativePoint.Add(new CPoint(smallX, smallY, EMLineKind.STRAIGHT, EMDirectionArc.FORWARD)); // 2 점 (우하) m_listRelativePoint.Add(new CPoint(bigX, smallY, EMLineKind.STRAIGHT, EMDirectionArc.FORWARD)); // 3 점 (우상) m_listRelativePoint.Add(new CPoint(bigX, bigY, EMLineKind.STRAIGHT, EMDirectionArc.FORWARD)); // 4 점 (좌상) m_listRelativePoint.Add(new CPoint(smallX, bigY, EMLineKind.STRAIGHT, EMDirectionArc.FORWARD)); return(true); }
/// <summary> /// Face 의 형상 정보가 없는 경우 호출되는 생성자로 /// 툴바의 파트 생성 버튼을 사용할 때 호출되는 생성자이다. /// </summary> public PopupShape(EMFaceType drawType, EMKind emKind) { InitializeComponent(); m_strPartName = string.Empty; m_partType = emKind; m_bCreatePopupWindow = true; textBoxBaseX.Text = "0.0"; textBoxBaseY.Text = "0.0"; switch (m_partType) { case EMKind.COIL: labelPartName.Text = "Coil Name :"; this.Text = "Add Coil"; break; case EMKind.MAGNET: labelPartName.Text = "Magnet Name :"; this.Text = "Add Magnet"; break; case EMKind.STEEL: labelPartName.Text = "Steel Name :"; this.Text = "Add Steel"; break; default: CNotice.printLogID("TPTI"); return; } // 콤보박스 데이터는 파라메터로 넘어오는 대로 강제로 지정한다. comboBoxFaceType.SelectedItem = drawType.ToString(); comboBoxNodeType.SelectedItem = m_partType.ToString(); /// 코일의 경우는 코일계산 때문에 Rectangle 로 고정을 해야 한다. if (emKind == EMKind.COIL) { comboBoxFaceType.Enabled = false; } comboBoxNodeType.Enabled = false; }
/// <summary> /// 다각형의 포인트를 저장한다. /// </summary> /// <param name="listPoint"></param> /// <returns></returns> public bool setPolygonPoints(List <CPoint> listPoint) { if (listPoint.Count < MIN_POINT_COUNT) { CNotice.printLogID("YATT"); return(false); } m_listRelativePoint.Clear(); m_emFaceType = EMFaceType.POLYGON; foreach (CPoint point in listPoint) { m_listRelativePoint.Add(point); } return(true); }