Пример #1
0
        /// <summary>
        /// Paints all objects from the ROIList into the HALCON window
        /// </summary>
        /// <param name="window">HALCON window</param>
        public void paintData(hvppleDotNet.HWindow window)
        {
            window.SetDraw("margin");
            window.SetLineWidth(1);

            if (ROIList.Count > 0)
            {
                //
                //window.SetColor(inactiveCol);

                window.SetDraw("margin");

                for (int i = 0; i < ROIList.Count; i++)
                {
                    window.SetColor(((ROI)ROIList[i]).Color);
                    window.SetLineStyle(((ROI)ROIList[i]).flagLineStyle);
                    ((ROI)ROIList[i]).draw(window, Convert.ToInt32(viewController.ImgCol2 - viewController.ImgCol1), Convert.ToInt32(viewController.ImgRow2 - viewController.ImgRow1));
                }

                if (activeROIidx != -1)
                {
                    window.SetColor(activeCol);
                    window.SetLineStyle(((ROI)ROIList[activeROIidx]).flagLineStyle);
                    ((ROI)ROIList[activeROIidx]).draw(window, Convert.ToInt32(viewController.ImgCol2 - viewController.ImgCol1), Convert.ToInt32(viewController.ImgRow2 - viewController.ImgRow1));

                    window.SetColor(activeHdlCol);
                    ((ROI)ROIList[activeROIidx]).displayActive(window, Convert.ToInt32(viewController.ImgCol2 - viewController.ImgCol1), Convert.ToInt32(viewController.ImgRow2 - viewController.ImgRow1));
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Repaints the HALCON window 'window'
        /// </summary>
        public void repaint(hvppleDotNet.HWindow window)
        {
            try
            {
                int          count = HObjImageList.Count;
                HObjectEntry entry;

                HSystem.SetSystem("flush_graphic", "false");
                window.ClearWindow();
                mGC.stateOfSettings.Clear();

                //显示图片及文字
                showHObjectList();

                //显示region
                showHRegionList();

                //显示ROI
                showROIList();

                showHat(window);

                showBorder(window);

                HSystem.SetSystem("flush_graphic", "true");

                //注释了下面语句,会导致窗口无法实现缩放和拖动
                window.SetColor("dim gray");
                window.DispLine(-100.0, -100.0, -101.0, -101.0);
            }
            catch (Exception exc)
            {
            }
        }