Example #1
0
        private void RemnantMatInfoForm_Load(object sender, EventArgs e)
        {
            // build the remnant material from the sheet.
            double dMergeDis = 10;

            m_polyMat = NestFacadeEx.BuildRemnantMat(m_sheet, m_dConnectTol, dMergeDis);

            // init the tree.
            UpdateTree();

            /************************************************************************/
            // init the view port.

            m_matViewPort.InitEnv(matViewWnd.Handle, 0.00001, 10000);

            // all polygons in material.
            Poly2DListEx poly2DList = new Poly2DListEx();

            poly2DList.AddPoly(m_polyMat.GetMatPolygon());
            poly2DList.AddPolyList(m_polyMat.GetUselessHoleList());

            // set the drawing area.
            Int32     iWidth       = matViewWnd.Right - matViewWnd.Left;
            Int32     iHeight      = matViewWnd.Bottom - matViewWnd.Top;
            Rect2DEx  geomRect     = poly2DList.GetRectBox();
            Point2DEx leftBottomPt = new Point2DEx();
            double    dXDirRange   = m_matViewPort.GetFitAllParam(iWidth, iHeight, geomRect, 1.2, leftBottomPt);

            m_matViewPort.SetDrawingArea(1.1 * dXDirRange, iWidth, iHeight, leftBottomPt);
            /************************************************************************/

            mergeDisTextBox.Text = dMergeDis.ToString("0.000");
        }
Example #2
0
        // fit the view port to the rect.
        static public void FitWindow(Rect2DEx geomRect, GlViewPortEx viewPort, Control window)
        {
            Int32     iWidth       = window.Right - window.Left;
            Int32     iHeight      = window.Bottom - window.Top;
            Point2DEx leftBottomPt = new Point2DEx();
            double    dXDirRange   = viewPort.GetFitAllParam(iWidth, iHeight, geomRect, 1.2, leftBottomPt);

            viewPort.SetDrawingArea(1.1 * dXDirRange, iWidth, iHeight, leftBottomPt);
        }