private CFace makeRectangleFaceInPopup()
        {
            double minX, minZ, maxX, maxZ;

            minX = minZ = 1e100;
            maxX = maxZ = -1e100;

            CFace face = new CFace();

            if (false == isRectangleShapeInPopup())
            {
                return(null);
            }

            foreach (CPointUI pointUI in ListPointUI)
            {
                if (minX > Convert.ToDouble(pointUI.StrCoordX))
                {
                    minX = Convert.ToDouble(pointUI.StrCoordX);
                }

                if (minZ > Convert.ToDouble(pointUI.StrCoordZ))
                {
                    minZ = Convert.ToDouble(pointUI.StrCoordZ);
                }

                if (maxX < Convert.ToDouble(pointUI.StrCoordX))
                {
                    maxX = Convert.ToDouble(pointUI.StrCoordX);
                }

                if (maxZ < Convert.ToDouble(pointUI.StrCoordZ))
                {
                    maxZ = Convert.ToDouble(pointUI.StrCoordZ);
                }
            }

            if (minX >= maxX || minZ >= maxZ)
            {
                return(null);
            }

            face.setRectanglePoints(minX, minZ, maxX, maxZ);

            return(face);
        }
        // Base Point 와 상대좌표로 좌표값이 저장되는 Face 가 생성된다.
        public CFace makeFaceInPopup()
        {
            try
            {
                CFace face = new CFace();

                face.BasePoint.X = Double.Parse(textBoxBaseX.Text);
                face.BasePoint.Y = Double.Parse(textBoxBaseY.Text);

                if (FaceType == EMFaceType.RECTANGLE)
                {
                    if (ListPointUI.Count != 2)
                    {
                        CNotice.printLogID("TATP1");
                        return(null);
                    }

                    double x1, y1, x2, y2;

                    x1 = Double.Parse(ListPointUI[0].StrCoordX);
                    y1 = Double.Parse(ListPointUI[0].StrCoordZ);
                    x2 = Double.Parse(ListPointUI[1].StrCoordX);
                    y2 = Double.Parse(ListPointUI[1].StrCoordZ);

                    face.setRectanglePoints(x1, y1, x2, y2);
                }
                else
                {
                    if (ListPointUI.Count < 4)
                    {
                        CNotice.printLogID("TANM");
                        return(null);
                    }

                    // PartType 가 코일이고 Polygon 형상을 가지고 있는 경우라면 (DXF로 읽어드리고 코일로 지정하는 경우)
                    // Rectangle 로 바꾸어 저장한다.
                    // 만약, Retangle 조건이 아니라면 지나쳐서 Polygon 으로 저장한다.
                    if (PartType == EMKind.COIL)
                    {
                        CFace retFace = makeRectangleFaceInPopup();

                        if (retFace != null)
                        {
                            return(retFace);
                        }
                    }

                    List <CPoint> listPoint = new List <CPoint>();

                    foreach (CPointUI pointControl in ListPointUI)
                    {
                        // 매번 신규로 생성을 해야 한다.
                        CPoint point = new CPoint();

                        point.X = Double.Parse(pointControl.StrCoordX);
                        point.Y = Double.Parse(pointControl.StrCoordZ);

                        if (pointControl.IsArc == true)
                        {
                            point.LineKind = EMLineKind.ARC;
                        }
                        else
                        {
                            point.LineKind = EMLineKind.STRAIGHT;
                        }

                        if (pointControl.IsArcDirection == true)
                        {
                            point.DirectionArc = EMDirectionArc.BACKWARD;
                        }
                        else
                        {
                            point.DirectionArc = EMDirectionArc.FORWARD;
                        }

                        listPoint.Add(point);
                    }

                    face.setPolygonPoints(listPoint);
                }

                return(face);
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
                return(null);
            }
        }
Exemple #3
0
        // Base Point 와 상대좌표로 좌표값이 저장되는 Face 가 생성된다.
        public CFace makeFace()
        {
            try
            {
                CFace face = new CFace();

                face.BasePoint.m_dX = Double.Parse(textBoxBaseX.Text);
                face.BasePoint.m_dY = Double.Parse(textBoxBaseY.Text);

                if (FaceType == EMFaceType.RECTANGLE)
                {
                    if (ListPointControl.Count != 2)
                    {
                        CNotice.printTraceID("TATP1");
                        return(null);
                    }

                    double x1, y1, x2, y2;

                    x1 = Double.Parse(ListPointControl[0].StrCoordX);
                    y1 = Double.Parse(ListPointControl[0].StrCoordY);
                    x2 = Double.Parse(ListPointControl[1].StrCoordX);
                    y2 = Double.Parse(ListPointControl[1].StrCoordY);

                    face.setRectanglePoints(x1, y1, x2, y2);
                }
                else
                {
                    if (ListPointControl.Count < 4)
                    {
                        CNotice.printTraceID("TANM");
                        return(null);
                    }

                    List <CPoint> listPoint = new List <CPoint>();

                    foreach (CPointControl pointControl in ListPointControl)
                    {
                        // 매번 신규로 생성을 해야 한다.
                        CPoint point = new CPoint();

                        point.m_dX = Double.Parse(pointControl.StrCoordX);
                        point.m_dY = Double.Parse(pointControl.StrCoordY);

                        if (pointControl.IsArc == true)
                        {
                            point.m_emLineKind = EMLineKind.ARC;
                        }
                        else
                        {
                            point.m_emLineKind = EMLineKind.STRAIGHT;
                        }

                        if (pointControl.IsArcDirection == true)
                        {
                            point.m_emDirectionArc = EMDirectionArc.BACKWARD;
                        }
                        else
                        {
                            point.m_emDirectionArc = EMDirectionArc.FORWARD;
                        }

                        listPoint.Add(point);
                    }

                    face.setPolygonPoints(listPoint);
                }

                return(face);
            }
            catch (Exception ex)
            {
                CNotice.printTrace(ex.Message);
                return(null);
            }
        }