Exemple #1
0
        public void funcMeasureLineDistance()
        {
            viewPort.Focus();

            HWindow window = viewPort.hvppleWindow;

            HWndMessage message = new HWndMessage(clsWellsLanguage.getString(126), 20, 20, 20, "green", "window");

            message.DispMessage(window, message.coordSystem, 1);

            isStaticWnd = true;

            viewPort.ContextMenuStrip = null;

            double r1, c1, r2, c2;
            HTuple dd;

            //获取当前显示信息
            HTuple hv_Red = null, hv_Green = null, hv_Blue = null;
            int    hv_lineWidth;

            window.GetRgb(out hv_Red, out hv_Green, out hv_Blue);

            hv_lineWidth = (int)window.GetLineWidth();
            string hv_Draw = window.GetDraw();

            window.SetLineWidth(1);   //设置线宽
            window.SetLineStyle(new HTuple());
            window.SetColor("green"); //画点的颜色

            window.DrawLine(out r1, out c1, out r2, out c2);
            window.DispLine(r1, c1, r2, c2);

            //恢复窗口显示信息
            window.SetRgb(hv_Red, hv_Green, hv_Blue);
            window.SetLineWidth(hv_lineWidth);
            window.SetDraw(hv_Draw);


            HOperatorSet.DistancePp(r1, c1, r2, c2, out dd);
            double dr = Math.Abs(r2 - r1);
            double dc = Math.Abs(c2 - c1);

            Wells.class_Public.Show(null, string.Format(clsWellsLanguage.getString(127), dd.D, dc, dr), clsWellsLanguage.getString(128), MessageBoxButtons.OK, MessageBoxIcon.Information);


            viewPort.ContextMenuStrip = hv_MenuStrip;

            isStaticWnd = false;

            repaint(window);
        }
Exemple #2
0
        public void funcShowGrayHisto()
        {
            viewPort.Focus();

            HImage image = null;

            if (HObjImageList.Count > 0)
            {
                image = new HImage(((HObjectEntry)HObjImageList[0]).HObj);
            }

            if (image == null)
            {
                class_Public.Show(null, clsWellsLanguage.getString(122), clsWellsLanguage.getString(1), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            HWindow window = viewPort.hvppleWindow;

            HWndMessage message = new HWndMessage(clsWellsLanguage.getString(125), 20, 20, 20, "green", "window");

            message.DispMessage(window, message.coordSystem, 1);

            isStaticWnd = true;

            viewPort.ContextMenuStrip = null;

            double r1, c1, r2, c2;
            //HTuple dd;

            //获取当前显示信息
            HTuple hv_Red = null, hv_Green = null, hv_Blue = null;
            int    hv_lineWidth;

            window.GetRgb(out hv_Red, out hv_Green, out hv_Blue);
            hv_lineWidth = (int)window.GetLineWidth();
            string hv_Draw = window.GetDraw();

            window.SetLineWidth(1);   //设置线宽
            window.SetLineStyle(new HTuple());
            window.SetColor("green"); //画点的颜色


            window.DrawRectangle1(out r1, out c1, out r2, out c2);
            window.DispRectangle1(r1, c1, r2, c2);
            Form frm = new Form();

            frm.Text          = "GrayHisto";
            frm.StartPosition = FormStartPosition.CenterParent;

            ThresholdUnit.ThresholdUnit thresUnit = new ThresholdUnit.ThresholdUnit();
            Size size = thresUnit.Size;

            size.Height = (int)(size.Height + 50);
            size.Width  = (int)(size.Width + 50);
            frm.Size    = size;
            frm.Controls.Add(thresUnit);
            thresUnit.Dock = DockStyle.Fill;
            HTuple grayVals;

            grayVals = class_Hvpple.getGrayHisto(image, new HTuple(r1, c1, r2, c2));
            thresUnit.setAxisAdaption(ThresholdUnit.ThresholdPlot.AXIS_RANGE_INCREASING);
            thresUnit.setLabel(clsWellsLanguage.getString(123), clsWellsLanguage.getString(124));
            thresUnit.setFunctionPlotValue(grayVals);

            thresUnit.computeStatistics(grayVals);

            frm.ShowDialog();


            //window.DrawLine(out r1, out c1, out r2, out c2);
            //window.DispLine(r1, c1, r2, c2);


            //恢复窗口显示信息
            window.SetRgb(hv_Red, hv_Green, hv_Blue);
            window.SetLineWidth(hv_lineWidth);
            window.SetDraw(hv_Draw);

            viewPort.ContextMenuStrip = hv_MenuStrip;

            isStaticWnd = false;

            repaint();
        }