Esempio n. 1
0
        /// <summary>
        /// Paints all objects from the ROIList into the HALCON window
        /// </summary>
        /// <param name="window">HALCON window</param>
        public void PaintData(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++)
                {
                    if (ActiveROIidx != i)
                    {
                        //显示ROI
                        window.SetLineStyle(ROIList[i].flagLineStyle);
                        ROIList[i].Draw(window);

                        //显示序号
                        if (RoiDrawConfig.IsDrawIndex)
                        {
                            ROI    roi    = ROIList[i];
                            var    point  = roi.GetCenter();
                            double row    = point.Y + RoiDrawConfig.PaneWidth;
                            double column = point.X + RoiDrawConfig.PaneWidth;
                            HOperatorSet.SetTposition(window, row, column);
                            HOperatorSet.WriteString(window, i.ToString());
                        }
                    }
                }

                if (ActiveROIidx != -1)
                {
                    //显示选中的ROI
                    window.SetColor(ActiveCol);
                    window.SetLineStyle(ROIList[ActiveROIidx].flagLineStyle);
                    ROIList[ActiveROIidx].Draw(window);

                    //显示选中的ROI序号
                    if (RoiDrawConfig.IsDrawIndex)
                    {
                        ROI roi    = ROIList[ActiveROIidx];
                        var point  = roi.GetCenter();
                        var row    = point.Y + RoiDrawConfig.PaneWidth;
                        var column = point.X + RoiDrawConfig.PaneWidth;
                        HOperatorSet.SetTposition(window, row, column);
                        HOperatorSet.WriteString(window, ActiveROIidx.ToString());
                    }

                    //显示选中的小方框
                    window.SetColor(ActiveHdlCol);
                    ROIList[ActiveROIidx].DisplayActive(window);
                }
            }
        }